Skip to content

Commit

Permalink
Internet Content: Update BBC iPlayer HTML to use SWFPlayer.
Browse files Browse the repository at this point in the history
Better fullscreen experience, and if I ever figure the Javascript API out, it'll be possible to control from the remote.
  • Loading branch information
Robert McNamara committed Dec 9, 2010
1 parent 8d49bf3 commit 885129b
Showing 1 changed file with 111 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,29 +1,114 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<!-- Author: R.D. Vaughan Apr 28th, 2010
Purpose: Implement full screen browser video display for the BBC iPlayer
Example:
file:///usr/local/share/mythtv/mythnetvision/scripts/nv_python_libs/configs/HTML/bbciplayer.html?videocode=b00s5nfv
-->
<script type="text/javascript">
function gup( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}

var videocode = gup( 'videocode' );
var embedded = '<embed width="100%" height="98%" allowfullscreen="true" allowscriptaccess="always" wmode="default" quality="high" flashvars="embedReferer=&amp;embedPageUrl=http%3A%2F%2Fwww.bbc.co.uk%2Fiplay&#10;er%2Fepisode%2FVIDEOCODE%2F%3F&#10;t%3D2m53s&amp;domId=bip-play-emp&amp;config=http%3A%2F%2Fwww.bbc.co.uk%2Femp&#10;%2Fiplayer%2Fconfig.xml&amp;playlist=http%3A%2F%2Fwww.bbc.co.uk%2Fiplayer%2F&#10;playlist%2FVIDEOCODE&amp;holdingImage=http%3A%2F%2Fnode1.bbcimg.co.uk%2Fiplay&#10;er%2Fimages%2Fepisode%2FVIDEOCODE_640_360.jpg&amp;config_settings_bitrateFloo&#10;r=0&amp;config_settings_bitrateCeiling=2500&amp;config_settings_transportHei&#10;ght=35&amp;config_settings_cueItem=b00rqkg0%3A173&amp;config_settings_autoPl&#10;ay=true&amp;config_settings_showPopoutCta=false&amp;config_messages_diagnost&#10;icsMessageBody=Insufficient%20bandwidth%20to%20stream%20this%20programme.%20&#10;Try%20downloading%20instead%2C%20or%20see%20our%20diagnostics%20page.&amp;co&#10;nfig_settings_language=en&amp;guidance=unset" id="bbc_emp_embed_bip-play-emp" src="http://www.bbc.co.uk/emp/10player.swf?revision=15501_15796" type="application/x-shockwave-flash"/>';
document.write('<title>BBC iPlayer Full Screen</title>');
document.write(embedded.replace(/VIDEOCODE/g, videocode));

</script>
</head>
<head>
<style type="text/css">
body {
padding: 0;
margin: 0;
}
</style>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>

<script type="text/javascript">
/* gup function by R.D. Vaughan */
function gup( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}

var video_id = gup( 'videocode' );
var myth_player = null;
var paused = false;
var volume = 50;

var embedPage = "http://www.bbc.co.uk/iplayer/episode/";
embedPage = embedPage.concat(video_id);
embedPage = embedPage.concat("/Top_Gear_Series_13_Episode_1_(new_series)/?t=00m01s");

var pl = "http://www.bbc.co.uk/iplayer/playlist/";
pl = pl.concat(video_id);

var hi = "http://node2.bbcimg.co.uk/iplayer/images/episode/";
hi = hi.concat(video_id);
hi = hi.concat("_640_360.jpg");

function play() {
if (myth_player) {
if (paused) {
myth_player.play();
paused = false;
}
else if (!paused) {
myth_player.pause();
paused = true;
}
}
}

function seek(amount) {
if (myth_player) {
myth_player.seekTo(myth_player.getCurrentTime() + amount);
}
}

function adjustVolume(amount) {
if (myth_player) {
volume += amount;
if (volume > 100)
volume = 100;
if (volume < 0)
volume = 0;
myth_player.setVolume(volume);
}
}

var flashvars = {
embedReferer: '',
embedPageUrl: embedPage,
domId: 'bip-play-emp',
config: 'http://www.bbc.co.uk/emp/iplayer/config.xml',
playlist: pl,
holdingImage: hi,
config_settings_bitrateFloor: 0,
config_settings_bitrateCeiling: 2500,
config_settings_transportHeight: 35,
config_settings_cueItem: "b00ldy1k:875",
config_settings_showPopoutCta: false,
config_messages_diagnosticsMessageBody: "Insufficient bandwidth to stream this programme. Try downloading instead, or see our diagnostics page.",
config_settings_language: "en",
guidance: "unset"
};

var params = {
allowscriptaccess: 'always',
allowfullscreen: 'true',
wmode: 'opaque',
};

var attributes = { id: "mybbcplayer" };

swfobject.embedSWF("http://www.bbc.co.uk/emp/9player.swf?revision=10344_10570", "myth_player", window.innerWidth, window.innerHeight, "9.0.0", "expressInstall.swf", flashvars, params, attributes);

function onPlayerReady(playerId) {
myth_player = document.getElementById("mybbcplayer");
myth_player.setVolume(50);
if (videocode != "") {
myth_player.loadVideoById(videocode);
myth_player.playVideo();
}
}

</script>
</head>
<body>
<div id="myth_player"/>
</body>
</html>

0 comments on commit 885129b

Please sign in to comment.