(function() {
var ymk_id = '2cfb5e69-3dbd-44ba-9292-9848e5c03cab';
var ymk_player_id = "player-2cfb5e69-3dbd-44ba-9292-9848e5c03cab";
var ymk_title = "洞庭湖堤防決壊、一晩中避難の住民、当局は情報遮断/NATOサミットで米国が中共へ厳しい姿勢 など|NTD ワールドウォッチ(2024年7月10日)";
var ymk_m3u8 = 'https://vod.brightchat.com/assets/2cfb5e69-3dbd-44ba-9292-9848e5c03cab/playlist.m3u8';
var ymk_duration = 493;
var ymk_poster = 'https://vod.brightchat.com/assets/2024/0710/2cfb5e69-3dbd-44ba-9292-9848e5c03cab/thumbnail_h_1720605055309.jpg';
var ymk_ratio = "16:9";
var ymk_autostart = true;
var ymk_mute = true;
var ymk_ads = true;
var ymk_init = true;
var ymk_logo = false;
var ymk_controls = true;
var ymk_schedule_time = 1720605381;
var ymk_premiere = 0;
var ymk_channel_uid = "fa017bb4-7c83-4fb6-9503-35f21d17ef9a";
var ymk_live = "0";
var ymk_tracking = true;
var ymk_domain = 'vod.brightchat.com';
var ymk_assets_host = "vod.brightchat.com";
var ymk_live_host = "live-c.brightchat.com";
var ymk_live_assets_host = "live.brightchat.com";
if (typeof videojs === 'undefined') {
var css = [
'//' + ymk_assets_host + '/static/assets/css/vplayer.css?ver=15.2',
];
for (var m = 0; m < css.length; m++) {
var css_link = document.createElement('link');
css_link.rel = 'stylesheet';
css_link.type = 'text/css';
css_link.href = css[m];
document.head.appendChild(css_link);
}
var scripts = [
"//" + ymk_assets_host + "/static/assets/js/epochplayer7.min.js?ver=12",
"//" + ymk_assets_host + "/static/assets/js/vplayer.min.js?ver=15.10",
];
if (ymk_ads) {
load_script('//imasdk.googleapis.com/js/sdkloader/ima3.js', true, false);
scripts.push('//' + ymk_assets_host + '/static/assets/js/epochplayer7.ads.min.js');
}
for (var i = 0; i < scripts.length; i++) {
load_script(scripts[i], false, (i == scripts.length - 1 ? true : false));
}
} else {
load_player();
}
function load_script (url, is_async, is_callback) {
var script = document.createElement('script');
script.src = url;
script.async = is_async;
document.body.appendChild(script);
if (is_callback) {
script.addEventListener('load', function() {
load_player();
});
}
}
function load_player () {
var playerIns = videojs.getPlayer(ymk_player_id);
if (typeof playerIns !== 'undefined') {
playerIns.dispose();
}
var player_container_html = '';
if (videojs.browser.IE_VERSION) {
player_container_html = '';
}
var player_container = document.getElementById("player-container-" + ymk_id);
if (player_container) {
player_container.innerHTML = player_container_html;
}
var player = videojs(ymk_player_id, {
liveui: (ymk_live == 1 && !ymk_m3u8) || ymk_premiere == 1,
errorDisplay: false,
mute: ymk_mute,
aspectRatio: ymk_ratio,
poster: ymk_poster,
controls: ymk_controls,
controlBar: {
pictureInPictureToggle: false
},
html5: {
hls: {
cacheEncryptionKeys: true,
},
}
});
player.setting({
tracking: ymk_tracking,
});
if (ymk_premiere == 1) {
ymk_ads = false;
var finishTime = ymk_schedule_time + ymk_duration * 1;
player.premiere({
scheduleTime: ymk_schedule_time * 1000,
finishTime: finishTime * 1000,
videoId: ymk_id,
videoSrc: ymk_m3u8,
thumbnail: ymk_poster,
});
} else if (ymk_live == 1 && !ymk_m3u8) {
ymk_ads = false;
player.one('live_end_reload', function () {
setTimeout(function() {
var head= document.getElementsByTagName('head')[0];
var script= document.createElement('script');
script.src= 'https://' + ymk_domain + '/static/assets/player/' + ymk_id + '?api=7&noads=true';
head.appendChild(script);
}, 1000);
});
player.live({
videoId: ymk_id,
liveHost: ymk_live_assets_host,
scheduleTime: ymk_schedule_time * 1000,
});
} else {
player.src({
type: "application/x-mpegURL",
src: ymk_m3u8,
});
if (ymk_autostart) {
player.autoplay(ymk_mute ? 'muted' : 'play');
}
}
if (typeof player.ima === "function" && typeof google !== "undefined" && ymk_ads) {
player.ima({
adTagUrl: get_vast_tag(),
adsManagerLoadedCallback: function() {
player.ima.addEventListener(google.ima.AdEvent.Type.SKIPPED, function () {
player.el().focus();
});
player.ima.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED, function () {
if (player.remainingTime() > 3 && player.paused()) {
var promise = player.play();
if (promise && promise.catch) {
promise.catch(function(error) {
console.log('CONTENT_RESUME_REQUESTED');
player.muted(true);
player.play();
player.getChild('ymkUnmuteBtn').removeClass('vjs-hidden');
});
}
}
});
}
});
}
function get_vast_tag () {
var ymk_referrer_url = window.location.href;
var embed_domain = getEmbedDomain();
var vast_tag_ = 'https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&url=' + encodeURI(ymk_referrer_url) + '&description_url=' + encodeURI(ymk_referrer_url) + '&correlator=[timestamp]&iu=%2F5965368%2F';
var all_identification = {
'ntd.com': "NTD_News_Preroll",
'theepochtimes.com': "EET_News_Preroll",
'epochtimes.fr': "epochtimes.fr_preroll",
'lagranepoca.com': "lagranepoca.com_preroll",
'epochtimes.com.br': "epochtimes.com.br_preroll",
'ntdtv.kr': "ntdtv.kr_preroll",
'ntdtv.jp': "ntdtv.jp_preroll",
'epochtimes.it': "epochtimes.it_preroll",
'epochtimes.de': "epochtimes.de_preroll",
'epochtimes.nl': "epochtimes.nl_preroll",
'epochtimes.se': "epochtimes.se_preroll",
'epochtimes.com': "epochtimes.com_preroll",
'ntdtv.com': "ntdtv.com_preroll",
};
if (embed_domain in all_identification) {
ymk_placement = all_identification[embed_domain];
} else {
ymk_placement = "Youmaker.com_Preroll_Default";
}
vast_tag_ += ymk_placement;
vast_tag_ += '&pageurl=__page-url__';
if (embed_domain === 'epochtimes.it') {
vast_tag_ = 'https://optimized-by.4wnetwork.com/impression.php?code=234682;110690;80180;0&from=';
}
console.log('vast_tag: ' + vast_tag_);
console.log('site: ' + embed_domain);
return vast_tag_;
}
function getEmbedDomain() {
var hostname = window.location.href.replace("https:", "").replace("http:", "").replace("//", "");
hostname = (hostname.split('/'))[0];
hostname = (hostname.split(':'))[0];//remove port part
if (hostname != '') {
var parts = hostname.split('.').reverse();
var cnt = parts.length;
if (cnt >= 3) {
// see if the second level domain is a common SLD.
if (parts[1].match(/^(com|edu|gov|net|mil|org|nom|co|name|info|biz)$/i)) {
return parts[2] + '.' + parts[1] + '.' + parts[0];
}
}
return parts[1]+'.'+parts[0];
}
return '';
}
}
})();