Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Seek Code Example?


Hi,

Using JW Player 7.1.4 with Wowza Streaming Engine 4.3.

Looking for a solution that uses an API call to seek backward -30 seconds from the live playback position when streaming Wowza DVR content via HLS. Ideally, a simple URL in the player or an HTML hyperlink (preferred) that 'onclick' will grab the current position time and seek back 30 seconds. Doesn't have to be exact.

Wish list: WIth multiple players in a page, use the same command to kick all the players back using the same interval.

This is the code I am using now:

<script type="text/javascript">// <![CDATA[
jwplayer('player1').setup({
        file: 'http://wowza.homeip.net:1935/live/DemoLoop_240p/playlist.m3u8?DVR',
        image: 'images/wowza_poster.jpg',
        width: '426',
height: '240',
        aspectratio: '16:9',
        primary: 'flash',
skin: 'jwplayer/bekle.xml',
autostart: 'true'
    });
// ]]></script>

<a href="#" onclick="jwplayer('player1').seek(1730);jwplayer('player2').stop();jwplayer('player3').stop();jwplayer('player4').stop();jwplayer('player5').stop();jwplayer('player6').stop();jwplayer('player7').stop();jwplayer('player8').stop();">
-30</a>

Comments welcome.

Thank you!

-Tim


1 Community Answers

Todd

JW Player Support Agent  
0 rated :

I do not have a live DVR stream to test with at the moment, but I did check that the following code seeked (sought?) back 30 seconds on an VOD HLS stream:

jwplayer(‘player1’).seek(jwplayer(‘player1’).getPosition()-30);

But with a live DVR stream, the math is a little different. Since seek(0) will take you to the current live time, seek(-30) should do what you need.

As for stopping all the other players on the page, what you have is sufficient. Please see http://support.jwplayer.com/customer/portal/articles/1413089-javascript-api-reference for more details on the getPosition() and seek() events.

This question has received the maximum number of answers.