// 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('
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 = '