JW Player 6 seek and pause
Asked Answered
L

1

10

How can I get JW Player 6 to seek to a point and pause itself there without losing the ability to seek while continuing playback on subsequent requests.

For example, the following solution is not satisfactory because it pauses the player after every seek request, not just the current one.

var player = jwplayer('target').setup({
  file: '/some-file.mp3'
});

player.onSeek(function(){
  player.pause();
});

player.seek(300);

Really, I'm looking for an API which is as simple as this:

player.seek(toTime, pause = false)

Note that there is a similar open question referring to JW Player 5.4.

Lorsung answered 20/5, 2013 at 13:36 Comment(5)
Do you have an example of where you did this?Publicize
Hey David, were you ever able to figure this out? I'm having trouble with the same thing. I can't get JWPlayer6 to intelligently retain its playing or paused state after seekMccollum
Nope. I think the project ended up going in a different direction before I could come up with a fix.Lorsung
@DavidTuite : Searching for same thing ? have you got solution for itIdaho
@hitesh Nope. Never found a solution. Ended up using the SoundManager2 library instead.Lorsung
T
0

This can be done using attributes of HTML Tags.
Example:

<audio ontimeupdate="tracktime(this)" id="audio" preload="none" controls="controls" width="300" onplay="javascript:onplay()" onpause="javascript:onpause()" onended="javascript:onended()" src="">

<script>
var mediaElement = document.getElementById('audio');

mediaElement.seekable.start();  // Returns the starting time (in seconds)
mediaElement.seekable.end();    // Returns the ending time (in seconds)
mediaElement.currentTime = 122; // Seek to 122 seconds
mediaElement.played.end();      // Returns the number of seconds the browser has played
</script>
Truculent answered 14/12, 2013 at 9:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.