UN Web TV
");
player.addEventListener(player.Event.Core.PAUSE, event => {
jQuery('.player').removeClass('player-play');
jQuery('#un3-video-overlay').fadeIn();
showNav();
});
player.addEventListener(player.Event.Core.PLAY, event => {
jQuery('.player').addClass('player-play');
hideNav();
jQuery('#un3-video-overlay').fadeOut("normal", () => {
if(isWebTVHome) {
jQuery('.un3-video-overlay').removeClass('un-video-overlay-index-fresh');
}
});
if (mediaInfo.entryId == "1_ivjmho1c") {
jQuery('.playkit-watermark').css('display','none');
}
});
// Manage Chapters.
let chapterTimestamps = jQuery('.cue__item').map(function() {
return jQuery(this).data('start-time');
}).get();
if(chapterTimestamps.length > 0) {
let currentChapter = 0;
let nextChapter = 0;
jQuery.fn.scrollTo = function(elem, speed) {
jQuery(this).animate({
scrollLeft: jQuery(this).scrollLeft() - jQuery(this).offset().left + jQuery(elem).offset().left
}, speed === undefined ? 1000 : speed);
return this;
};
player.addEventListener(player.Event.Core.TIME_UPDATE, event => {
if(player.currentTime >= currentChapter && player.currentTime < nextChapter) {
return;
}
jQuery('.cue__item').removeClass('cue__item_active');
jQuery.each(chapterTimestamps, function(index, value) {
if(player.currentTime >= value) {
let nextKey = index + 1;
if(!chapterTimestamps.hasOwnProperty(nextKey) || player.currentTime < chapterTimestamps[nextKey]) {
currentChapter = value;
nextChapter = !chapterTimestamps.hasOwnProperty(nextKey) ? Number.MAX_VALUE : chapterTimestamps[nextKey];
jQuery('.cue__item[data-start-time="' + currentChapter + '"]').addClass('cue__item_active');
jQuery(".cue__items").scrollTo('.cue__item[data-start-time="' + currentChapter + '"]', 2000);
return false;
}
}
});
});
}
});
})
// }
// For UN Web TV Home, clicking on videos on live schedule replaces top video.
jQuery(document).ready(function() {
// Onclick function for the overlay
jQuery('.un3-video-play-button').click(() => {
// console.log('PLAYING');
player.play();
if(mediaScheduled) {
hideNav();
jQuery('#un3-video-overlay').fadeOut("normal", () => {
if(isWebTVHome) {
jQuery('.un3-video-overlay').removeClass('un-video-overlay-index-fresh');
}
});
}
});
jQuery('.cue__chapters_toggle').removeClass('d-none').appendTo('.playkit-bottom-bar .playkit-right-controls');
jQuery('.cue__item').click(function() {
const startTime = jQuery(this).data('start-time');
player.currentTime = startTime;
}).find('.cue__show, .cue__hide').click(function() {
return false;
});
jQuery('.cue__chapters_toggle').click(function() {
jQuery('.cue__chapters_container').toggleClass('d-none');
});
jQuery('.cue__chapters_close').click(function() {
jQuery('.cue__chapters_container').addClass('d-none');
});
jQuery('.cue__show').click(function() {
jQuery(this).closest('.cue__collapse').addClass('show');
});
jQuery('.cue__hide').click(function() {
jQuery(this).closest('.cue__collapse').removeClass('show');
});
})
};