We use an external scrubber (a user interface element that is not the default search string) to search (via jquery ui draggable), and it does not update jwplayer when it should be.
Summary of our code:
$('#scrubber').draggable({
stop: function (event, ui) {
$('#scrubber').draggable('enable');
var intSecFromEnd,
intSeek,
intTotalTime = 0,
intScrubPosition = ui.position.left,
intScrubTime = intScrubPosition;
$.each(playlist, function (i, obj) {
intTotalTime += parseInt(obj.duration);
if (intTotalTime > (intScrubTime)) {
intSecFromEnd = intTotalTime - parseInt(intScrubTime);
intSeek = Math.floor((parseInt(obj.duration) - intSecFromEnd));
jwplayer('videoPlayer').load(playlist);
jwplayer('videoPlayer').playlistItem(i);
jwplayer('videoPlayer').seek(intSeek);
jwplayer('videoPlayer').pause();
return false;
}
});
}
});
You will notice a key bit:
jwplayer('videoPlayer').load(playlist);
jwplayer('videoPlayer').playlistItem(i);
jwplayer('videoPlayer').seek(intSeek);
jwplayer('videoPlayer').pause();
When I put this in the console directly with an integer value, where it intSeekworks exactly as it should, so I am puzzled where this might be a disconnect.
(which only works one item in a playlist)
This only works with the first member of the playlist because the seek () function is considered to be an item 0in the playlist by default .
jwplayer('videoPlayer').load(playlist);
jwplayer('videoPlayer').seek(intSeek);
jwplayer('videoPlayer').pause();
, , jwplayer('videoPlayer').playlistItem(i) , , :
.
, , , .
.seek() onSeek() jwplayer.
, jwplayer onReady . jwplayer(strVideo).playlistItem(i).onReady({ console.log('ready'); });