Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

Auto seek on HD switch

21 replies [Last post]

Hi,

I'd like to auto seek to the current position when I switch to HD mode instead of restart from the begining.

I'm using pseudo streaming with the apache module h264.

I can get the current position with a time listener.
I can detect the switch with the item controller event and the plugin state. But I can't seek to current position 'cause it has already changed when I switch.

I got it !
I just store the previous time position too and seek :D

Last thing : when I switch to HD, the player load the HD file, play from the beginning and then seek to my current position. What a waste of bandwidth !
How can I start to play directly from my current position ?

 
Seeking to the current positin when you switch the HD mode is automatic if you have serverside support for streaming.

For instance, I'm using the FLV and H.264 streaming modules for LightTPD and nginx.

When I switch from SD (the FLV) to HD (the MP4) the player sends a request to the sever that looks like this:"GET /video/ThingsFallApart.mp4?start=19.2 HTTP/1.1" 200 4925406
As you can see, the player requested the MP4, starting at 19.2seconds, which is the point in the FLV where I clicked the HD button. Playing resumed at 19.2seconds with the HD file.

there's no start var in the http request....
Indeed I use mp4 and H264 streaming module for apache.

I use playlist, but it seems not to be the cause.

<script type="text/javascript">
var flashvars = {
id: "video",
file: "playlists/playlist.xml",
playlist: "right",
playlistsize: 280,
repeat: "list",
displayclick: "link",
linktarget: "_self",

plugins: "hd",

"hd.file": "playlists/playlistHD.xml",
"hd.state": false
};

var params = {
wmode: "opaque",
allowfullscreen: true,
allowscriptaccess: "always"
};
var attributes = {
id: "video",
name: "video"
};
swfobject.embedSWF("player.swf", "container", "920", "370", "9","expressInstall.swf", flashvars, params, attributes);

</script>

playlist :

<track>
<title>My video</title>
<location>videos/video.mp4</location>
<meta rel="type">http</meta>
<info><![CDATA[javascript:linkURI();]]></info>
</track>

playlistHD :

<track>
<title>My video HD</title>
<location>videos/video-hd.mp4</location>
<meta rel="type">http</meta>
<info><![CDATA[javascript:linkURI();]]></info>
</track>

 
It seems that things are a bit "broken" if you use a playlist with the HD plugin.

I'm getting a request for the HD file that looks like this:"GET /video/ThingsFallApart.mp4?start=0 HTTP/1.1" 200 5242898

My playlists:

SD

<?xml version='1.0' encoding='UTF-8'?>
<playlist version='1' xmlns='http://xspf.org/ns/0/' xmlns:jwplayer='http://developer.longtailvideo.com/trac/wiki/FlashFormats'>
  <trackList>
    <track>
      <jwplayer:title>Things Fall Apart - SD</jwplayer:title>
      <jwplayer:file>http://willswonders.myip.org:8079/video/ThingsFallApart.flv</jwplayer:file>
      <jwplayer:type>http</jwplayer:type>
    </track>
  </trackList>
</playlist>

HD

<?xml version='1.0' encoding='UTF-8'?>
<playlist version='1' xmlns='http://xspf.org/ns/0/' xmlns:jwplayer='http://developer.longtailvideo.com/trac/wiki/FlashFormats'>
  <trackList>
    <track>
      <jwplayer:title>Things Fall Apart - HD</jwplayer:title>
      <jwplayer:file>http://willswonders.myip.org:8079/video/ThingsFallApart.mp4</jwplayer:file>
      <jwplayer:type>http</jwplayer:type>
    </track>
  </trackList>
</playlist>

there's nothing to do...
It works perfectly but not when I use a playlist.
How can I do ?

Sorry - what's this issue here? Should the player not be tacking on '?start=x'?

Any idea ? I've still the same problem.

HD works with playlists only in the 5.0 version of the player.

Hi all
I am having trouble switching between sd and hd file using 1.1 plugin


s1.addVariable('file','http://www.file/sd_file.flv'); s1.addVariable('hd.file','http://www.file/sd_file.f4v');
s1.addVariable('plugins', 'hd-1.1,drelated,sharing-1');

problem:1
- hd file does not play

problem:2
I tried using xml file instead of video file path:
as here

<title>My video HD</title>
<location>videos/video-hd.mp4</location>
<meta rel="type">http</meta>
<info><![CDATA[javascript:linkURI();]]></info>
</track>

....brings error: xml file not found

any tips thanks

Can you provide a link?

Hi kisscool82

you said: I got it !
I just store the previous time position too and seek.

I have been trying very hard to figure out how to capture the current time "Before" going into the HD state.

Could you please elaborate on how you are able to capture the time right before switching?

I can get it working perfectly with the PAUSED state:

function stateMonitor(obj) { if(obj.newstate == 'PAUSED') { storeTime = currentTime; } };

So in the code I just pasted, if you pause the video it will store the current position in the video, and when you switch to HD it will autoseek to that position. But I just cant figure out how to capture the position the moment before going into HD.

Thanks for the insight!

my previous post got deleted.. never mind. i was asking if there's a possible way of sending the current time got from the following script to the the hd plugin wen switching to the hd file (I'm using wowva 2 rtmp) please help.

The script:

    <script type="text/javascript">
      var player    =  null;
      var playlist  =  null;

      function playerReady(obj)
      {
        player = gid(obj.id);
        addListeners();
      };

      function addListeners()
      {
        playlist = player.getPlaylist();

        if(playlist.length > 0)
        {
          player.addModelListener('TIME', 'timeMonitor');
        }
        else
        {
          setTimeout("addListeners();", 100);
        }
      };

      function timeMonitor(obj)
      {
        gid('time').innerHTML = 'Current Position: ' + obj.position;
      };

      function gid(name)
      {
        return document.getElementById(name);
      };
    </script>

Riki God bless you, after all the time i wasted ... thank you, thank you so much. if i wasn't poor as a bum i would have made a donation for your cause :P . Thank you again

haha, no problem my friend! I also had to spend a lot of time to get it working, but it was worth the effort. Glad someone else can find use for it :)

hi,
are there any plugins to enable hd switching for 2 rtmp streams?
couldn´t find anything yet and with the hd-1 plugin it did not work :(

Riki i spoke to soon , is only half good for me.. i was testing it on a v5 player and i need to use it on v4 and is not working :(, what should i do ?

I was using v4 too (BoR is on v4). If you throw up a sample page I can check it out mate.

sorry, the hd plugin was the guilty bastard, i'v switched to hd-1.0 and now is working

Dear Riki,

Can you please tell me in an idiot-proofed way how to implement your solution?

Sorry and thank you a lot!

Riki's solution relates to videos hosted on bitsontherun.
Can someone post a solution that works on any server?