// full program video player and an embeddable version too var v_players = new Array(); function v_embplay (targetvideoid, targetplayer){ if(targetplayer == undefined){ targetplayer = 'elplayer'; } var thisplayer; for(var x = 0; x < v_players.length; x++){ if(v_players[x].id = targetplayer){ thisplayer = v_players[x].player; } } if(thisplayer.covemode){ $("#commManagerDiv").remove(); $("#npaplayer").remove(); } $("#v_main").html(''); $("#" + thisplayer.divtarget).html(''); thisplayer.currentvideoid = targetvideoid; thisplayer.autoplay = true; thisplayer.initialise(); } function v_seekpoint (targetseekpoint, targetplayer){ if(targetplayer == undefined){ targetplayer = 'elplayer'; } var thisplayer; for(var x = 0; x < v_players.length; x++){ if(v_players[x].id = targetplayer){ thisplayer = v_players[x].player; } } if(thisplayer.covemode){ thisplayer.player_module.playoffset(targetseekpoint); } } function v_chapter (seekchapter){ var thisplayer; for(var x = 0; x < v_players.length; x++){ thisplayer = v_players[x].player; } thisplayer.playchapter(seekchapter); } function v_fp (inarray) { this.timerinc = 0; this.covemode = false; this.ipadmode = false; this.mobilemode = false; this.chapteridx = 0; this.intcnt = 5; this.overlayon = false; this.loginterval = 60; this.relloader = 0; this.chaptercount = 0; this.showingchapteridx = -1; this.chaptercode = ''; this.chaptersplotted = false; this.prepared = false; this.relatedrendered = false; this.externalexcerpt = false; this.embinfoup = false; this.firstrun = true; this.autoplay = false; this.showingchapter = false; this.commentobj = new Object(); this.overrideshare = (inarray.sharedisable != undefined)? inarray.sharedisable:false; this.relup = false; this.reltimer = 0; var playerreg = new Object(); this.iframemode = (inarray.iframemode != undefined)? inarray.iframemode:false; this.iframeupdate = (inarray.iframeupdate != undefined)? inarray.iframeupdate:''; this.playerid = (inarray.idcode != undefined)? inarray.idcode:'elplayer'; playerreg.id = this.playerid; playerreg.player = this; v_players.push(playerreg); this.nocove = (inarray.nocove != undefined)? inarray.nocove:false; this.dvdlink = (inarray.dvdlink != undefined)? inarray.dvdlink:''; this.ituneslink = (inarray.ituneslink != undefined)? inarray.ituneslink:''; this.overridetitle = (inarray.overridetitle != undefined)? inarray.overridetitle:''; this.startscript = (inarray.startscript != undefined)? inarray.startscript:''; // this is for modes 2 + 3, expanding mode this.chdata = (inarray.chapter_data != undefined)? inarray.chapter_data:''; // this is for mode 3, chapter data listener this.chupd = (inarray.chapter_updates != undefined)? inarray.chapter_updates:''; // this is for mode 3, chapter change listener this.thumbnailoverride = (inarray.overridethumbnail != undefined)? inarray.overridethumbnail:''; this.startscriptrun = false; this.fakeurl = (inarray.fakeurl != undefined)? inarray.fakeurl:''; this.overridetimes = (inarray.override != undefined)? inarray.override:false; this.modecode = (inarray.mode != undefined)? inarray.mode:1; // 0: embed, 1: full show, 2: full show (smaller), 3: full show (chromeless), 4: external embed this.starttime = (inarray.starttime != undefined)? (inarray.starttime * 1000):0; this.endtime = (inarray.endtime != undefined)? (inarray.endtime * 1000):0; this.admode = (inarray.admode != undefined)? inarray.admode:false; this.currentvideoid = (inarray.videoid != undefined)? inarray.videoid:''; this.related = (inarray.related != undefined)? inarray.related:true; this.replayonly = (inarray.replayonly != undefined)? inarray.replayonly:false; this.fullshow = (inarray.fullshow != undefined)? inarray.fullshow:false; this.workaround = false; if(this.modecode == 1 || this.modecode == 2 || this.modecode == 3){ this.fullshow = true; } if(this.modecode == 4 && this.currentvideoid.indexOf('@') != -1){ this.overridetimes = true; this.externalexcerpt = true; var splits = this.currentvideoid.substring(this.currentvideoid.indexOf('@') + 1,this.currentvideoid.length) var x = splits.split('.'); this.starttime = parseInt(x[0],16) *1000; this.endtime = parseInt(x[1],16) *1000; this.currentvideoid = this.currentvideoid.substring(0,this.currentvideoid.indexOf('@')); } if(this.modecode == 4 && this.currentvideoid.indexOf('*') != -1){ this.workaround = true; } this.w = (inarray.w != undefined)? inarray.w:512; // width, only used in embeds this.h = (inarray.h != undefined)? inarray.h:288; // height, only used in embeds this.isopen = false; this.divtarget = (inarray.divtarget != undefined)? inarray.divtarget:'videospace'; this.stayopen = (inarray.stayopen)? inarray.stayopen:false; if(this.modecode != 1){ this.stayopen = true; } this.draw=v_fp_draw; this.pbsproblems = 0; this.embedcode=v_fp_embedcode; this.embedcodeclose=v_fp_embedcodeclose; this.embedcodechange=v_fp_embedcodechange; this.fauxstartmode = false; this.ext_chupdate=v_fp_chapterdatupdate; this.ext_chdata=v_fp_chdata; this.toggle=v_fp_toggle; this.outerresize=v_fp_outerresize; this.initialise=v_fp_initialise; this.social=v_fp_social; this.playchapter=v_fp_play; this.player = new Object(); this.ended=v_fp_ended; this.covechapterupd=v_fp_covech; this.timerstop=v_fp_timerstop; this.timerstart=v_fp_timerstart; this.legacytimerstart=v_fp_legacytimerstart; this.embinfo=v_fp_embinfo; this.commentscount=v_fp_commentscount; this.timerupd=v_fp_timerupd; this.legacychapterchange=v_fp_legacychapterdetect; this.relatedrender=v_fp_relatedrender; this.chapterupdate=v_fp_chapterupdate; this.overlayon=v_fp_overlayshow; this.overlayhide=v_fp_overlayhide; this.pbsissues=v_fp_issues; this.relchangeable=true; this.relatedclick=v_fp_relatedclick; this.relatedhighlight=v_fp_relatedhighlight; this.clipinfo=v_fp_clipinfo; this.prepare=v_fp_prepare; this.show_when_ready=v_fp_show_when_ready; this.show=v_fp_show; this.embrelated_up=v_emb_relatedup; this.embrelated_down=v_emb_relateddown; this.current_video=v_fp_current_video; this.cachedinfo = new Object(); this.loadchecker=v_fp_directloadcheck; this.server = Object.beget(flp_comm); this.video = Object.beget(flp_video); this.videorendered = false; this.currentrel = -1; this.closedheight = (inarray.closedheight != undefined)? inarray.closedheight:30; this.openheight = (inarray.openheight != undefined)? inarray.openheight:435; this.restmode = false; this.reststart = 0; if(!this.related){ this.openheight = this.openheight - 125; } if(navigator.userAgent && navigator.userAgent.indexOf('iPad') != -1){ ipadmode = true; mobilemode = true; this.openheight -= 32; } if(!this.stayopen && this.modecode == 1){ this.autoplay = true; } if(window.location.href.indexOf('?autoplay') != -1 || window.location.href.indexOf('&autoplay') != -1){ this.autoplay = true; this.stayopen = true; } if(navigator.userAgent && navigator.userAgent.indexOf('iPhone') != -1){ mobilemode = true; this.openheight -= 32; } if(this.stayopen){ this.initialise(); } else { this.draw(); } } function v_fp_chdata (chapters){ if(this.chdata != undefined && this.chdata != ''){ this.chdata.call(this,chapters); } } function v_fp_chapterdatupdate (chapteridx){ if(this.chupd != undefined && this.chupd != ''){ this.chupd.call(this,chapteridx); } } function v_fp_initialise () { this.video.clean(); this.video.parse_video_id(this.currentvideoid).get_data_from_server(this.server); this.loadcheck = new Number(); this.loadcheck = setInterval(this.loadchecker,500); } function v_fp_prepare (vidid,autoplay) { this.playlist = new Array(); this.playlist.push(this.video); // this.autoplay = autoplay; this.player_module = Object.beget(flp_player); this.show_when_ready(); } function v_fp_outerresize (inar) { var targetitem = this.divtarget; var newcss = new Array(); if(inar.height != undefined){ newcss.height = inar.height + 'px'; } if(inar.width != undefined && this.modecode != 0){ newcss.width = inar.width + 'px'; } if(iframemode){ this.iframeupdate.call(); } $("#" + targetitem).css(newcss); } function v_fp_social () { var promourl = window.location.href; if(promourl.indexOf('/wgbh/pages/frontline/') != -1){ var workstring = promourl.substring(promourl.indexOf('/wgbh/pages/frontline/') + 22, promourl.length); var ws = workstring.split("/"); promourl = 'http://www.pbs.org/wgbh/pages/frontline/' + ws[0]; } outp = ''; outp += ''; return outp; } function v_fp_embinfo () { var v = this.current_video(); if(this.externalexcerpt || (this.overridetitle && (this.modecode == 2 || this.modecode == 3 || this.modecode == 0))){ if(this.externalexcerpt){ if((this.endtime - this.starttime) > 1000000){ this.overridetitle = v.pkg_title; } else { this.overridetitle = "From " + v.pkg_title + ""; } } if(this.overridetimes){ $("#v_embinfo").html('' + this.overridetitle + '(' + v_secformat((this.endtime / 1000) - (this.starttime / 1000)) + ')'); } else { if(this.modecode == 2 || this.modecode == 3){ $("#v_embinfo").html('' + this.overridetitle + ''); } else { $("#v_embinfo").html('' + this.overridetitle + '(' + v_secformat(v.seg_length) + ')'); } } } else { if(this.overridetimes){ $("#v_embinfo").html('' + v.seg_title + '' + v.seg_desc + ' (' + v_secformat((this.endtime / 1000) - (this.starttime / 1000)) + ')'); } else { $("#v_embinfo").html('' + v.seg_title + '' + v.seg_desc + ' (' + v_secformat(v.seg_length) + ')'); } } if(this.w < 350){ $("#v_embinfo").css({ 'font-size': '12px', 'line-height': '13px' }); } var subthis = this; $("#v_embinfo").fadeIn("slow"); embinfoup = true; } function v_emb_relatedup (idx,tim) { if((this.video.related_content[idx].tim + 11) > tim){ this.currentrel = idx; this.video.related_content[idx].fired = true; clearTimeout(this.reltimer); var subthis = this; $("#v_embrel").stop(); $("#v_embrel").css({ 'opacity': 1, 'width': ($("#v_embp").width() - 8) + 'px' }); $("#v_embrel").html(this.video.related_content[idx].lbl + ' »'); $("#v_embrel").fadeIn("slow"); $("#v_embrel").click(function () { subthis.relatedclick(subthis.currentrel,1); }); $("#v_embrel").mouseenter( function () { clearTimeout(subthis.reltimer); }); $("#v_embrel").mouseleave( function () { var nt = subthis.player_module.timerupdate(); var timerleft = ((subthis.video.related_content[subthis.currentrel].tim + 12) - nt) * 1000; if(timerleft < 4000){ timerleft = 4000; } subthis.reltimer = setTimeout(subthis.embrelated_down, timerleft); }); this.reltimer = setTimeout(subthis.embrelated_down, 12000); relup = true; } } function v_emb_relateddown () { relup = false; $("#v_embrel").stop(); $("#v_embrel").unbind("click"); $("#v_embrel").unbind("mouseenter"); $("#v_embrel").unbind("mouseleave"); $("#v_embrel").fadeOut("slow"); clearTimeout(this.reltimer); this.video.related_content[this.currentrel].fired = false; } function v_fp_ended () { if(mobilemode && this.fullshow && (this.chapteridx < (this.chaptercount - 1))){ this.chapteridx++; this.video.upd_chapter((this.chapteridx + 1)); this.relatedrendered = false; $("#v_relarea").animate({ 'opacity':0 }); this.clipinfo(); chapterupdate(this.chapteridx, true); } else { if(!this.overylayon){ if(!(this.player_module.mode == 'npa' && this.modecode != 1)){ this.overlayon(); } if(this.showingchapter){ this.hidechapterinfo(); } var nt = this.player_module.timerupdate(); var extlog = (this.modecode == 4)? 1:0; if(this.player_module.mode != 'cove'){ this.server.sendlog(this.video,nt,extlog); } this.timerstop(); $("#v_replay").show(); var subthis = this; this.firstrun = true; if(this.modecode == 1){ if(replayonly){ $("#v_endrel").hide(); $("#v_replay").css({ 'float':'none', 'margin-left': (($("#v_fp").width() / 2) - 75) + 'px' }); } else { if(_catmap[_cat] != undefined){ _catcode = _catmap[_cat]; // get related shows $.ajax({ type: "GET", url: "/wgbh/pages/frontline/xml/cats/" + _catcode + "_v.xml", dataType: "xml", success: function(xml) { var cnt = Math.floor(($("#v_fp").width() - 220) / 210); var embedded = $(xml).find('bod').text(); $("#v_endrel").html('RELATED FRONTLINE REPORTS' + embedded); $("#v_relshows").find('div').each(function () { if($(this).attr('ptit') == subthis.video.pkg_title || cnt == 0){ $(this).remove(); } else { cnt--; } }); $("#v_relshows").fadeIn(); } }); } } } else { $("#v_endrel").hide(); if(this.player_module.mode != 'npa'){ if(this.modecode == 4){ $("#v_replay").css({ 'margin-top': (((this.h) / 2) - 45) + 'px' }); var social = ''; var promourl = this.video.seg_link; if(promourl.substring(promourl.length - 1,promourl.length) == '/'){ promourl = promourl.substring(0,promourl.length - 1); } $("#v_embsocial").html('
'); $("#v_continue").css({ 'text-align':'left' }); if(this.externalexcerpt){ var comout = ''; $("#v_contmsg").html(comout); $("#v_contmsg").css({ "top": ((this.h / 2) - 65) + 'px', 'width': (this.w - 150) + 'px' }); $("#v_contmsg").fadeIn(); } if(this.commentobj.airdate){ if(this.commentobj.upcoming){ $("#v_embend").css({ "margin-top": ((this.h / 2) - 25) + 'px' }); $("#v_embend").html('Watch on air and online starting ' + this.commentobj.airdate + '. Check local listings »'); } else { if(this.w > 500){ $("#v_embend").css({ "margin-top": '25px' }); } else { $("#v_embend").css({ "margin-top": '15px' }); } var comout = new String(); if(this.commentobj.comments.length > 1 && !this.externalexcerpt){ comout += 'COMMENTS (' + this.commentobj.commentcount + ')ADD YOUR COMMENT »'; } $("#v_embend").html(comout); } $("#v_embend").css({ 'width': (this.w - 150) + 'px' }); $("#v_embend").show(); } var xfactor = (this.player_module.mode == 'cove')? 0:36; $("#v_embsocial").css({ "margin-top": (this.h - xfactor) + 'px', "width": (this.w - 6) + 'px' }); } else { $("#v_replay").css({ 'margin-top': (((this.h) / 2) - 90) + 'px', 'margin-left': (($("#v_embp").width() / 2) - 75) + 'px' }); } } else { $("#v_replay").remove(); } } if($("#v_replay")){ $("#v_replay").unbind("click"); $("#v_replay").click(function (){ if(subthis.modecode == 1 || subthis.modecode == 2){ if(window.location.href.indexOf('autoplay') != -1){ window.location.reload(); } else { window.location.href = window.location.href + '?autoplay'; } } else { $("#v_replay").unbind("click"); subthis.autoplay = true; subthis.initialise(); } }); } } } } function v_fp_overlayshow (progress,immediate) { if(this.modecode == 1){ $("#v_continue").css({ 'width' : ($("#v_fp").width() - 20) + 'px', 'height' : (this.openheight - 120) + 'px'}); $("#v_continueback").css({ 'width' : $("#v_fp").width() + 'px', 'height' : this.openheight + 'px'}); } else { var hoh = (this.player_module.mode == "npa")? 32:0; if(this.modecode == 0 || this.modecode == 2 || this.modecode == 3){ if(this.modecode == 0){ $("#v_continue").css({ 'width' : ($("#v_embp").width() - 20) + 'px', 'height' :( $("#v_embp").height() - hoh) + 'px'}); $("#v_continueback").css({ 'width' : $("#v_embp").width() + 'px', 'height' : ($("#v_embp").height() ) + 'px'}); } else { if(this.modecode == 3){ $("#v_continue").css({ 'width' : ($("#v_embp").width() - 20) + 'px', 'height' : $("#v_embp").height() + 'px'}); $("#v_continueback").css({ 'width' : $("#v_embp").width() + 'px', 'height' : $("#v_embp").height() + 'px'}); } else { hoh += 10; $("#v_continue").css({ 'width' : ($("#v_embp").width() - 20) + 'px', 'height' :( $("#v_embp").height() - hoh) + 'px'}); $("#v_continueback").css({ 'width' : $("#v_embp").width() + 'px', 'height' : ($("#v_embp").height() - 40) + 'px'}); } } } else { if(this.modecode == 4){ $("#v_continue").css({ 'width' : $("#v_embp").width() + 'px', 'height' :( $("#v_embp").height() - (hoh + 30)) + 'px', 'margin-top': '30px' }); $("#v_continueback").css({ 'width' : $("#v_embp").width() + 'px', 'height' : ($("#v_embp").height() - 60) + 'px', 'margin-top': '30px' }); } else { $("#v_continue").css({ 'width' : $("#v_embp").width() + 'px', 'height' :( $("#v_embp").height() - (hoh + 30)) + 'px'}); $("#v_continueback").css({ 'width' : $("#v_embp").width() + 'px', 'height' : ($("#v_embp").height() - 60) + 'px'}); } } } if(immediate){ $("#v_continueback").show(); $("#v_continue").show(); } else { if(this.modecode == 4){ $("#v_continue").html('
'); } else { $("#v_continue").html('
'); } $("#v_continueback").fadeIn(); $("#v_continue").fadeIn(); } if(progress){ $("#v_continue").html('
48
'); } $("#v_title").hide(); $("#v_topwrap").unbind('mouseenter'); this.overylayon = true; } function v_fp_issues () { $("#v_continue").html('
PBS.org is experiencing difficulties. Please try back later and we apologize for any inconvenience

48
'); } function v_fp_overlayhide () { var subthis = this; $("#v_replay").unbind('click'); $("#v_endrel").html(''); $("#v_replay").hide(); $("#v_continueback").fadeOut(); $("#v_continue").fadeOut('fast'); this.overylayon = false; if(!this.stayopen){ $("#v_title").show(); } } function v_fp_covech (idx) { this.chapteridx = idx; this.video.upd_chapter((this.chapteridx + 1)); this.relatedrendered = false; $("#v_relarea").animate({ 'opacity':0 }); this.clipinfo(); chapterupdate(this.chapteridx, false); } function v_fp_relatedrender (alreadyhasit) { var subthis = this; if(alreadyhasit || this.video.relloaded){ this.currentrel = -1; var outp = 'ALSO PART OF THIS REPORT
'; for(var x = 0; x < this.video.related_content.length; x++){ var rel = this.video.related_content[x]; if(rel.idcode == null && rel.lsc == null){ // we can't do related video or external listening yet outp += '
'; if(rel.etmb != undefined && rel.etmb != ''){ outp += ''; } else { outp += ''; } if(rel.lbl != undefined && rel.lbl != ''){ outp += '' + rel.lbl + ''; } if(rel.dsc != undefined && rel.dsc != ''){ outp += '' + rel.dsc + ''; } if(rel.att != undefined && rel.att != ''){ outp += '' + rel.att + ''; } outp += '
'; } } outp += '
'; $("#v_relarea").html(outp); $("#v_relleft").click(function () { subthis.relatedhighlight(subthis.currentrel - 1); subthis.relchangeable = false; setTimeout(function () { subthis.relchangeable = true; }, 20000); }); $("#v_relright").click(function () { subthis.relatedhighlight(subthis.currentrel + 1); subthis.relchangeable = false; setTimeout(function () { subthis.relchangeable = true; }, 20000); }); $("#v_relholder").find('div').each(function () { $(this).click(function () { subthis.relatedclick($(this).attr('idx'),0); }); }); $("#v_relleft").hide(); $("#v_relholder").css({ 'left': (($("#v_relarea").width() / 2) - 176) + 'px' }); $("#v_relarea").animate({ 'opacity':1 }); } else { this.relloader = setTimeout(this.relatedrender,1000); } } function v_fp_relatedclick (targetidx,typ) { var url = this.video.related_content[targetidx].url; if(url.indexOf('pbs.org') != -1){ var ancmode = (url.indexOf('#') != -1)? true:false; var anc = new String(); if(ancmode){ anc = url.substring(url.indexOf('#'),url.length); url = url.substring(0,url.indexOf('#')); } if(url.indexOf('?') != -1){ url += '&'; } else { url += '?'; } url += (typ == 0)? 'utm_campaign=videoplayer&utm_medium=fullplayer&utm_source=relatedlink':'utm_campaign=videoplayer&utm_medium=embplayer&utm_source=relatedlink'; url += (ancmode)? anc:''; } window.open(url, 'links'); } function v_fp_relatedhighlight (targetidx) { this.currentrel = parseInt(targetidx); if(targetidx > 0){ $("#v_relleft").show(); } else { $("#v_relleft").hide(); } if(targetidx < (this.video.related_content.length - 1)){ $("#v_relright").show(); } else { $("#v_relright").hide(); } $("#v_relholder").find("div").each(function (){ $(this).removeClass('v_rel'); if(targetidx == parseInt($(this).attr('idx'))){ $(this).addClass('v_rel'); $(this).removeClass('v_reloff'); } else { $(this).addClass('v_reloff'); } }); $("#v_relholder").stop(); $("#v_relholder").animate({ 'left': ((($("#v_relarea").width() / 2) - 176) - (targetidx * 353)) + 'px' }); } function v_fp_legacytimerstart () { if(this.related){ if(this.video.relloaded){ if(!this.relatedrendered){ this.relatedrender(true); } } else { this.video.get_relc_from_server(this.server); $("#v_relarea").html('
loading
'); setTimeout(this.relatedrender, 1000); } } this.timerstart(); } function v_fp_timerstart () { // this.timer.start(); $("#v_replacementplay").hide(); $("#v_replacementthumb").hide(); if($("#v_embinfo")){ $("#v_embinfo").fadeOut("slow"); } $("#v_replacementplay").unbind('click'); if((this.modecode == 2 || this.modecode == 3) && !this.startscriptrun){ // this is callled in mode 2/3 for expansion if(this.player_module.mode == 'cove'){ if(this.modecode == 2){ if(this.related){ $("#v_embp").css({ "height": (this.h + 171) + "px" }); this.outerresize({ height: (this.h + 171) }); } } else { $("#v_embp").css({ "height": this.h + "px" }); this.outerresize({ height: this.h }); } $("#v_main").css({ "height": this.h + "px" }); if(this.video.relloaded){ if(!this.relatedrendered){ this.relatedrender(true); } } else { this.video.get_relc_from_server(this.server); $("#v_relarea").html('
loading
'); setTimeout(this.relatedrender, 1000); } } else { $("#v_embp").css({ "height": (this.h + 171) + "px" }); this.outerresize({ height: (this.h + 171) }); // $("#v_main").css({ "height": (this.h + 32) + "px" }); } $("#v_relarea").show(); if(this.startscript != ''){ this.startscript.call(); } this.startscriptrun = true; } clearInterval(this.timerinc); var subthis = this; this.timerinc = setInterval(subthis.timerupd,1000); if(this.showingchapter){ this.hidechapterinfo(); } if(this.overlayon){ this.overlayhide(); } } function v_fp_timerupd () { if(!this.player_module.isad){ var nt = this.player_module.timerupdate(); if(this.covemode && nt > 0){ // run the check to see if we're in the right chapter if(!this.player_module.isinseek && !this.player_module.isad){ var toofar = false; var newx = 0; for(var x = 0; x < this.video.jsondata.ditems.length && !toofar; x++){ if(this.video.jsondata.ditems[x].tim <= nt){ newx = x; } else { toofar = true; } } if(newx != this.chapteridx){ this.covechapterupd(newx); } } } if(this.related && this.video.related_content.length > 0 && this.relchangeable){ var reltoofar = false; var realtime = nt; if(!this.mobilemode){ realtime -= this.video.jsondata.ditems[this.chapteridx].tim; } var newy = 0; for(var y = 0; y < this.video.related_content.length && !reltoofar; y++){ var rel = this.video.related_content[y]; if(rel.idcode == null && rel.lsc == null){ // we can't do related video or external listening yet if(rel.tim <= realtime){ newy = y; } else { reltoofar = true; } } } if((this.modecode == 1 || this.modecode == 2 || this.modecode == 3) && newy != this.currentrel){ this.relatedhighlight(newy); } else { if(this.modecode == 0 || this.modecode == 4){ if(!this.video.related_content[newy].fired && realtime >= this.video.related_content[newy].tim){ this.embrelated_up(newy,realtime); } } } } if(this.intcnt == 0){ if(this.player_module.mode != 'npa'){ var extlog = (this.modecode == 4)? 1:0; if(this.player_module.mode != 'cove'){ this.server.sendlog(this.video,nt,extlog); } this.intcnt = this.loginterval; } } this.intcnt--; } } function v_fp_timerstop () { // this.timer.pause(); clearInterval(this.timerinc); } function v_fp_chapterupdate (chidx,switchchapters) { this.chapteridx = parseInt(chidx); this.video.relloaded = false; if(switchchapters){ if(this.player_module.mode == 'html5'){ this.player_module.chapterswitch(this.video.jsondata.ditems[this.chapteridx].src); } else { if(player_module.mode == 'cove'){ if(this.firstrun){ this.firstrun = false; } this.player_module.playbutton(); } } } } function v_fp_show_when_ready () { var subthis = this; window.show_when_ready = function() { if(subthis.video.loaded === true) { subthis.show(); }else { $('#v_main').text("loading video player components"); setTimeout('window.show_when_ready()', 2000); } } window.show_when_ready(); } function v_fp_show () { if(this.chapteridx == undefined){ this.chapteridx = 0; } if(this.autoplay == undefined){ this.autoplay = true; } var v = this.video; if(mobilemode){ this.overlayhide(); if(v.mp4_enabled()){ var tv; var vidfile; if(this.fullshow){ tv = this.video.jsondata.ditems[this.chapteridx]; vidfile = tv.src; } else { tv = this.video; vidfile = tv.video_file; } $("#v_main").css({ 'width':this.w + 'px', 'height':this.h + 'px' }); $('#v_main').html(this.player_module.html5_player(vidfile,this.w,this.h,tv.tmb,this.autoplay)); if(this.modecode == 0 || this.modecode == 2){ // $("#v_embp").css({ 'height': this.h + 30 + 'px' }); // this.outerresize({ height: (this.h + 30) }); // if(this.modecode == 2){ // $("#v_embp").css({ 'width': this.w + 100 + 'px' }); // this.outerresize({ width: (this.w + 100) }); // } // $("#v_mainarea").css({ 'height': this.h + 30 + 'px' }); $("#v_main").css({ 'margin-left':'1px', 'margin-right':'1px' }); $("#v_embinfo").css({ 'margin-top': (this.h - 90) + 'px' }); } if(this.modecode == 4){ $("#v_embp").css({ 'height': this.h + 60 + 'px' }); this.outerresize({ height: (this.h + 60) }); $("#v_mainarea").css({ 'height': this.h + 30 + 'px' }); $("#v_main").css({ 'margin-left':'1px', 'margin-right':'1px' }); $("#v_embinfo").css({ 'margin-top': (this.h - 90) + 'px' }); } this.player_module.html5_evt(); this.player_module.register_task('ended',this.ended); this.player_module.register_task('playing',this.timerstart); this.player_module.register_task('paused',this.timerstop); } else { $('#v_main').html('

This clip does not yet support mobile platforms. We apologize for the inconvenience

'); } } else { if(v.player_type() == "cove") { this.covemode = true; $("#v_main").html(this.player_module.cove_player()); if(this.modecode == 0 || this.modecode == 2){ $("#v_embp").css({ 'height': this.h + 30 + 'px' }); this.outerresize({ height: (this.h + 30) }); } if(this.modecode == 4){ $("#v_embp").css({ 'height': this.h + 78 + 'px'}); this.outerresize({ height: (this.h + 78) }); } if(this.modecode != 1){ if(this.modecode == 3){ $("#v_mainarea").css({ 'height': this.h + 'px' }); $("#v_embinfo").css({ 'margin-top': (this.h - 90) + 'px' }); } else { $("#v_mainarea").css({ 'height': this.h + 30 + 'px' }); $("#v_embinfo").css({ 'margin-top': (this.h - 90) + 'px' }); } $("#v_main").css({ 'width':this.w + 'px', 'height':(this.h) + 'px' }); $("#v_replacementplay").css({ 'padding-top': (((this.h) / 2) - 73) + 'px','padding-bottom': (((this.h) / 2) - 73) + 'px', 'padding-left': ((this.w / 2) - 73) + 'px','padding-right': ((this.w / 2) - 73) + 'px' }); } var chdatastring = new String(); if(this.video.jsondata.ditems[1] != undefined){ for(var x = 0; x < this.video.jsondata.ditems.length; x++){ chdatastring += (x > 0)? '|':''; chdatastring += this.video.jsondata.ditems[x].tim; } } else { chdatastring = '0|0'; } if(this.modecode == 3){ this.ext_chdata(this.video.jsondata.ditems); } var platformautoplay = this.autoplay; if(this.chapteridx > 1){ platformautoplay = false; } var extemb = (this.modecode == 4)? true:false; var thumb = this.video.jsondata.ditems[this.chapteridx].tmb; if(!this.fullshow){ thumb = this.video.tmb; } if(this.thumbnailoverride != '' && this.modecode == 0){ thumb = this.thumbnailoverride; } if(this.autoplay){ this.player_module.cove_player_start(v.tp_media_id,this.w,this.h,true,chdatastring,this.starttime,this.endtime,extemb,this.overridetimes); this.firstrun = false; var tw = this.w; var th = this.h; $("#v_replacementthumb").css({ width: tw + 'px', height: th + 'px' }); } else { var subthis = this; $("#v_replacementplay").show(); var tw = this.w; var th = this.h; var thumbimg = ''; $("#v_replacementthumb").css({ width: tw + 'px', height: th + 'px' }); $("#v_replacementthumb").html(thumbimg); $("#v_replacementthumb").fadeIn(); $("#v_replacementplay").click(function () { $("#v_replacementplay").hide(); $("#v_replacementthumb").remove(); subthis.player_module.cove_player_start(v.tp_media_id,subthis.w,subthis.h,true,chdatastring,subthis.starttime,subthis.endtime,extemb,subthis.overridetimes); subthis.timerstart(); if(subthis.modecode == 1 || subthis.modecode == 2 || subthis.modecode == 3){ subthis.chapterupdate(subthis.chapteridx,true); if(subthis.modecode == 2 || subthis.modecode == 3){ subthis.video.upd_chapter(subthis.chapteridx + 1); subthis.clipinfo(); } } if($("#v_embinfo")){ $("#v_embinfo").fadeOut("slow"); } $("#v_replacementplay").remove(); }); if(this.modecode != 1){ this.embinfo(); } } if(this.modecode != 1){ if($("#v_embtitle")){ var subthis = this; if(this.w > 340){ if(this.externalexcerpt){ if((this.endtime - this.starttime) > 1000000){ $("#v_embtitle").html('' + v.pkg_title + ' »'); } else { $("#v_embtitle").html('From ' + v.pkg_title + ' »'); } } else { $("#v_embtitle").html(v.seg_title + ' »'); } } else { $("#v_embtitle").html('More Information »'); } $("#v_embtitle").mouseenter(function () { $("#v_embtitle").html('More Information »'); }); $("#v_embtitle").mouseleave(function () { if(subthis.w > 340){ var z = subthis.current_video(); if(subthis.externalexcerpt){ if((subthis.endtime - subthis.starttime) > 1000000){ $("#v_embtitle").html('' + v.pkg_title + ' »'); } else { $("#v_embtitle").html('From ' + v.pkg_title + ' »'); } } else { $("#v_embtitle").html(v.seg_title + ' »'); } } }); $("#v_embtitle").click(function () { var url = subthis.video.seg_link; if(url.indexOf('pbs.org') != -1){ var ancmode = (url.indexOf('#') != -1)? true:false; var anc = new String(); if(ancmode){ anc = url.substring(url.indexOf('#'),url.length); url = url.substring(0,url.indexOf('#')); } if(url.indexOf('?') != -1){ url += '&'; } else { url += '?'; } url += 'utm_campaign=videoplayer&utm_medium=embplayer&utm_source=toplink'; url += (ancmode)? anc:''; } window.open(url, 'links'); }); } else { $("#v_embtitle").unbind("click"); $("#v_embtitle").unbind("mouseenter"); $("#v_embtitle").unbind("mouseleave"); $("#v_embtitle").hide(); } } if(this.autoplay){ this.timerstart(); } this.overlayhide(); this.player_module.register_task('ended',this.ended); this.player_module.register_task('playing',this.timerstart); this.player_module.register_task('paused',this.timerstop); // this.timer.register_recurring_task(this.logpoint,180); } else { this.overlayhide(); this.covemode = false; $("#v_embinfo").hide(); if(this.modecode == 0 || this.modecode == 2){ if(this.modecode == 0){ $("#v_embp").css({ 'height': this.h + 32 + 'px', 'width': this.w + 2 }); this.outerresize({ height: (this.h + 32), width: (this.w + 2) }); } else { $("#v_embp").css({ 'height': this.h + 32 + 'px' }); this.outerresize({ height: (this.h + 32) }); } $("#v_mainarea").css({ 'height': this.h + 32 + 'px' }); $("#v_embbot").remove(); } if(this.modecode == 4){ $("#v_embp").css({ 'height': this.h + 62 + 'px', 'width': this.w + 2 }); this.outerresize({ height: (this.h + 62), width: (this.w + 2) }); $("#v_mainarea").css({ 'height': this.h + 32 + 'px', 'width': this.w + 2 }); $("#v_embbot").hide(); } $('#v_main').html(this.player_module.legacy_player()); v.upd_chapter(this.chapteridx + 1); if(v.seg_id == undefined){ v.upd_chapter(1); } var emb = (this.modecode == 1)? true:false; var letter = (this.fullshow)? 'c':'s'; this.player_module.legacy_player_init(v.rest_id.substring(0,6) + letter + v.seg_id.toString(16) + 'q' + v.pkg_id.toString(16),this.w,this.h,this.autoplay,emb,this.fullshow); this.player_module.register_task('ended',this.ended); this.player_module.register_task('playing',this.legacytimerstart); this.player_module.register_task('paused',this.timerstop); this.player_module.register_task('chapterup',this.legacychapterchange); } } if(this.modecode == 0 || this.modecode == 4){ if(this.player_module.mode != 'npa'){ this.relatedrendered = false; this.currentrel = -1; if(!this.workaround){ this.video.upd_chapter(this.chapteridx); this.video.get_relc_from_server(this.server); } } } if(this.video.progid && this.video.progid != '' && this.modecode == 4){ this.commentscount(this.video.progid); } this.videorendered = true; return this; } function v_fp_commentscount (targetfile) { var subthis = this; if(targetfile.indexOf('frol') != -1){ $.ajax({ type: "GET", url: "/wgbh/pages/frontline/xml/comments/" + targetfile + ".xml", dataType: "xml", success: function(xml) { var cnt = $(xml).find('com:first').attr('cnt'); var pth = $(xml).find('com:first').attr('path'); var air = $(xml).find('com:first').attr('air'); subthis.commentobj.upcoming = ($(xml).find('com:first').attr('upc') == '1')? true:false; subthis.commentobj.commentcount = cnt; subthis.commentobj.airdate = air; subthis.commentobj.comments = new Array(); subthis.commentobj.commentslink = 'http://www.pbs.org' + pth + '?utm_campaign=videoplayer&utm_medium=embplayer&utm_source=comments#comments'; $(xml).find('cm').each(function () { var newobj = new Object(); newobj.person = $(this).find('per:first').text(); newobj.message = $(this).find('msg:first').text(); subthis.commentobj.comments.push(newobj); }); if(subthis.w > 340){ $("#v_commentbutton").css({ 'width':'100px' }); $("#v_commentbutton").html(cnt + ' comments'); } else { $("#v_commentbutton").html(cnt); } $("#v_commentbutton").fadeIn(); $("#v_commentbutton").click(function () { window.open('http://www.pbs.org' + pth + '?utm_campaign=videoplayer&utm_medium=embplayer&utm_source=comments#comments', 'links'); }); } }); } else { $("#v_commentbutton").hide(); } } function v_fp_legacychapterdetect () { this.covechapterupd(this.chapteridx + 1); } function v_fp_embedcode () { var outp = '
'; var subthis = this; if(this.modecode == 1){ $("#v_fp").prepend(outp); $("#v_embcodeback").css({ 'width' : $("#v_fp").width() + 'px', 'height' : this.openheight}); $("#v_embcode").css({ 'margin-left': (($("#v_fp").width() / 2) - 155) }); $("#v_embcodeback").fadeIn(); $("#v_embcode").fadeIn(); } else { $("#v_embp").prepend(outp); $("#v_embcodeback").css({ 'width' : $("#v_embp").width() + 'px', 'height' : ($("#v_embp").height() - 30) + 'px' }); $("#v_embcode").css({ 'margin-left': (($("#v_embp").width() / 2) - 155), 'margin-top': (($("#v_embp").height() / 2) - 90) + 'px' }); $("#v_embcodeback").fadeIn(); $("#v_embcode").fadeIn(); } $("#v_embcodeclose").click(function () { subthis.embedcodeclose(); }); var thiscode = this.video.rest_id.substring(0,6) + 's'+this.video.seg_id.toString(16) + 'q' + this.video.pkg_id.toString(16); if(this.overridetimes && (this.modecode == 0 || this.externalexcerpt)){ var st = this.starttime / 1000; var en = this.endtime / 1000; thiscode += '@' + st.toString(16) + '.' + en.toString(16); } this.embedcodechange(514,366,thiscode); } function v_fp_embedcodechange (w,h,code) { $("#v_embcodespace").val(''); var subthis = this; $("#v_embsizer").find(".sel").removeClass('sel').addClass('unsel'); $("#v_embsizer").find('li').each(function () { $(this).unbind("click"); $(this).removeClass('sel'); if($(this).attr('w') == w){ $(this).addClass('sel'); $(this).removeClass('unsel'); } else { $(this).click(function () { subthis.embedcodechange($(this).attr('w'),$(this).attr('h'),code); }); } }); } function v_fp_embedcodeclose () { $("#v_embcode").remove(); $("#v_embcodeback").remove(); } function v_fp_current_video () { if(this.chapteridx == null) { return null; } else { this.video.upd_chapter(this.chapteridx); return this.video; } } function v_fp_directloadcheck () { if(this.video.cblockcheck){ this.video.get_data_from_svc(this.server); } if(this.video.loaded){ clearInterval(this.loadcheck); if(this.video.isblocked || (this.modecode == 4 && !this.video.embeddable)){ this.draw(true); } else { this.chaptercount = this.video.jsondata.ditems.length; if(this.modecode == 0 || this.modecode == 4){ this.fullshow = this.video.fullshow; if(!this.fullshow && !this.overridetimes){ this.starttime = this.video.seg_start * 1000; this.endtime = this.video.seg_end * 1000; } } this.draw(); } } } function v_fp_play (chidx) { this.chapteridx = parseInt(chidx); if(!this.isopen){ toggle(true); } if(this.overlayon){ this.overlayhide(); } $("#v_replacementplay").hide(); $("#v_replacementthumb").hide(); this.hidechapterinfo(); $("#" + this.divtarget).unbind('mouseleave'); if(!this.videorendered){ this.prepare(this.currentvideoid,true); this.chapterupdate(this.chapteridx,false); } else { this.chapterupdate(this.chapteridx,true); } this.timerstart(); this.video.upd_chapter(this.chapteridx + 1); this.clipinfo(); } function v_fp_draw (isblocked) { var subthis = this; $("#" + this.divtarget).html(''); var writ = new String(); if(isblocked){ $("#" + this.divtarget).html("Sorry, this program is not available in your country due to rights restrictions. FRONTLINE apologizes for any inconvenience."); $("#" + this.divtarget).css({ 'background-color': '#ff0000', 'color':'#ffffff', 'text-align':'center', 'padding': '110px' }); } else { if(this.modecode == 1){ if(this.stayopen){ writ = '
'; writ += ''; writ += (this.related)? '':''; writ += '
'; $("#" + this.divtarget).html(writ); this.overlayon(true,true); if(mobilemode){ $("#v_mainarea").css({ 'height': '288px' }); $("#v_main").css({ 'height': '288px' }); } if(isblocked){ $("#v_fp").css({ 'height':this.openheight + 'px' }); this.outerresize({ height: this.openheight }); $("#v_title").hide(); } else { toggle(false); } } else { writ = ''; $("#" + this.divtarget).html(writ); var subthis = this; $("#" + this.divtarget).click(function () { window.location.href = subthis.fakeurl + 'view/?autoplay'; }); } } else { if(this.modecode == 0 || this.modecode == 2){ if(this.modecode == 0){ writ = '