I've compiled Nginx with the H264 streaming module and tested it using:
wget http://cdn.mydomain.com/video.m4v?start=10
The file returned has the first 10 seconds chopped off it. So I know Nginx is successfully streaming the video.
On my website, I have JW Player 4.5 setup using the following code:
var time = false;
var player = false;
var videos = {
'sd' : 'http://cdn.mydomain.com/sd.m4v',
'hd' : 'http://cdn.mydomain.com/hd.m4v' };
function playerReady(obj)
{
player = document.getElementById(obj['id']);
player.addModelListener('TIME', 'playerTime');
player.addControllerListener('RESIZE', 'playerResized');
}
function playerResized(obj)
{
var offset = time || '0.0';
if (obj.fullscreen)
player.sendEvent('LOAD', videos['hd'] + '?start=' + offset);
else
player.sendEvent('LOAD', videos['sd'] + '?start=' + offset);
player.sendEvent('PLAY', true);
}
function playerTime(obj)
{
time = obj.position;
}
window.onload = function()
{
var so = new SWFObject('js/jwplayer/player.swf', 'ply', '480', '303', '9', '#');
so.addParam('allowfullscreen', 'true');
so.addParam('allowscriptaccess', 'always');
so.addVariable('file', videos['sd']);
so.addVariable('provider', 'http');
so.addVariable('image', 'video-preview.png');
so.addVariable('frontcolor', 'cccccc');
so.addVariable('lightcolor', '71a2d7');
so.addVariable('skin', 'js/jwplayer/stylish.swf');
so.addVariable('backcolor', '111111');
so.write('mediaspace');
};
On page load, the videos['sd']
file starts streaming. Which is great. What I want to do now is have the video switch between 'sd' and 'hd' as the user toggles Fullscreen mode.
Using console.log()
I can see that my callbacks are working. I can see that the correct URL for each video is being loaded as I toggle Fullscreen mode and the correct time is getting appended to the URL.
However, the player doesn't seem to be respecting my start
GET parameter as the video loads from 0.0 seconds in. It also isn't switching to the HD version. It just fullscreens the SD version.
What am I doing wrong? :/