(function() {
var vplayer_id = 'cdaa9dfc-e8ec-46b2-6e83-8310130a1db4';
var vplayer_player_id = "player-cdaa9dfc-e8ec-46b2-6e83-8310130a1db4";
var vplayer_title = "2020 Election Results Defy Conventional Wisdom About American Voters—Daniel Allott ";
var vplayer_m3u8 = 'https://vod.brightchat.com/assets/cdaa9dfc-e8ec-46b2-6e83-8310130a1db4/playlist.m3u8';
var vplayer_duration = 1928;
var vplayer_poster = 'https://vod.brightchat.com/assets/2020/1108/cdaa9dfc-e8ec-46b2-6e83-8310130a1db4/thumbnail_h.jpg';
var vplayer_ratio = "16:9";
var vplayer_autostart = false;
var vplayer_mute = false;
var vplayer_ads = true;
var vplayer_init = true;
var vplayer_logo = false;
var vplayer_controls = true;
var vplayer_schedule_time = 1604792686;
var vplayer_premiere = 0;
var vplayer_channel_uid = "c98868e4-afdc-4349-b37d-30b04bd9e92d";
var vplayer_live = "0";
var vplayer_tracking = true;
var vplayer_api_host = 'stat.brightchat.org';
var vplayer_assets_host = "vod.brightchat.com";
var vplayer_live_host = "live.brightchat.com";
var vplayer_adTagUrl = "";
if (typeof videojs === "undefined") {
var css = [
"//" + vplayer_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 = [
"//" + vplayer_assets_host + "/static/assets/js/epochplayer7.min.js?ver=12",
"//" + vplayer_assets_host + "/static/assets/js/vplayer.min.js?ver=15.10",
];
if (vplayer_ads) {
load_script("//imasdk.googleapis.com/js/sdkloader/ima3.js", true, false);
scripts.push(
"//" + vplayer_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(vplayer_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-" + vplayer_id
);
if (player_container) {
player_container.innerHTML = player_container_html;
}
var player = videojs(vplayer_player_id, {
liveui: true,
errorDisplay: false,
mute: vplayer_mute,
aspectRatio: vplayer_ratio,
poster: vplayer_poster,
controls: vplayer_controls,
controlBar: {
pictureInPictureToggle: false,
},
html5: {
hls: {
cacheEncryptionKeys: true,
},
},
});
player.setting({
tracking: vplayer_tracking,
apiHost: vplayer_api_host ? 'https://' + vplayer_api_host : '',
assetsHost: vplayer_assets_host ? 'https://' + vplayer_assets_host : '',
});
if (vplayer_premiere == 1) {
vplayer_ads = false;
var finishTime = vplayer_schedule_time + vplayer_duration * 1;
player.premiere({
scheduleTime: vplayer_schedule_time * 1000,
finishTime: finishTime * 1000,
videoId: vplayer_id,
videoSrc: vplayer_m3u8,
thumbnail: vplayer_poster,
});
} else if (vplayer_live == 1 && !vplayer_m3u8) {
vplayer_ads = false;
player.one("live_end_reload", function () {
setTimeout(function () {
var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
script.src =
"https://" +
vplayer_assets_host +
"/static/assets/player/" +
vplayer_id +
"?api=7&noads=true";
head.appendChild(script);
}, 1000);
});
player.live({
videoId: vplayer_id,
liveHost:vplayer_live_host? 'https://' + vplayer_live_host : '',
scheduleTime: vplayer_schedule_time * 1000,
});
} else {
player.src({
type: "application/x-mpegURL",
src: vplayer_m3u8,
});
if (vplayer_autostart) {
player.autoplay(vplayer_mute ? "muted" : "play");
}
}
if (
typeof player.ima === "function" &&
typeof google !== "undefined" &&
vplayer_ads &&
vplayer_adTagUrl
) {
if (!vplayer_adTagUrl.startsWith("http")) {
var vplayer_referrer_url = encodeURI(window.location.href);
vplayer_adTagUrl =
"https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&url=" +
vplayer_referrer_url +
"&description_url=" +
vplayer_referrer_url +
"&correlator=[timestamp]&iu=" +
vplayer_adTagUrl +
"&pageurl=__page-url__";
}
player.ima({
adTagUrl: vplayer_adTagUrl,
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("unmuteButton").removeClass("vjs-hidden");
});
}
}
}
);
},
});
}
}
})();