views:

23

answers:

2

Hi, I am serving movie via JW player. I need to provide functionality to change quality of the movie. Each quality has different url. I need a javascript that loads new movie and moves to last position within clip. Example: User is watching a movie in low quality (http://test.com/play?id=1&qual=low) and is currently at position 00:30:15. User presses button requesting medium quality 'http://test.com/play?id=1&qual=medium' and sees movie starting from position from low quality (http://test.com/play?id=1&qual=low)

A: 

if you want do this in this way, so you can use

location.href="http://test.com/play?id=1&qual=low&pos="+getPos();

now you just need to figureout how to get position from jwplayer and after reloading page get $pos variable and set it to jwplayer.

probably you can use setCookie for this if you dont want to pass another param in url

or don't reload whole page, only force jwplayer to reload new movie.

Dobiatowski
You are repeating my question. I was asking how to getposition from jw player, load new movie and set new position in jw player
ITmeze
+1  A: 

Hi ITmeze,

There are a few different ways to do this.

First, I'd strongly urge you to consider using the built in bitrate switching functionality of JW Player 4.6, 5.1, and 5.2 or the HD plugin. If you take this route, you can focus on getting your configuration to work rather than getting your code to work.

The JavaScript route is a bit more complicated. There's no way to poll the player for it's current position. Instead, you'll have to wait for the player to start up, add a listener, and then keep track of the time yourself. I should also point out that when you actually go to switch the video, you'll have to perform a load and then a seek. Additionally, if you're using a playlist, you'll need to switch the playlist item index before seeking.

If you're stil interested in going the JavaScript route, please let me know and I'll come up with some code to do that.

Best,

Zach

Developer, LongTail Video

zach at longtail
that would be nice to have a code for that - load and seek...
ITmeze