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

CAN'T START MP4 VIDEO AT 10 SECONDS IN IOS USING DEFAULT PLAY BUTTON


We have the MP4 video autostarting at 10 seconds everywhere except iOS using this code...

jwplayer().onPlay(function() {
jwplayer().seek(10);
}
});

In iOS we know autostart does not work. But after the video loads, when we hit the default play button (the one in the video) the video starts at 0 and not 10. Shouldn't the above code make it start at 10?

I'm hoping it's something very simple. Logic says this above code should work. This does not work either...

firsttime = true;
jwplayer().onTime(function(event) {
if((event.position > 0) && (firsttime)){
jwplayer().seek(10);
firsttime = false;
}
});

6 Community Answers

Ethan Feldman

JW Player Support Agent  
0 rated :

Can you provide an example link?

JW Player

User  
0 rated :

@Bill

bc.. <code>
if((event.position > 0) && (firsttime)){
</code>



This way a similar situation that I came across sometime ago that drove me 'bonkers' giving me more grey hair than I need until I delved into it wanting to know why it wasn't working.

If you look closely on the code above, you will recognize that you are effectively comparing
*apples and oranges*.

Why is that?

Simply put you cannot compare two different entities.

*An event.position is a floating-point number whereas the seek time you gave is an integer* and comparison cannot be made directly.

What needs to happen is to convert the event.position into an integer and then make a comparison with your seek time.

Here is how.

bc.. if (parseInt(evt.position) >0 && (firsttime)){




This will compare two integers for a condition. That is to say two apples or two oranges.

In my JWPlayer 'Video Concerts' and chapters example on my web site that uses a JSON playlist where the chapters are declared with a *start and end* parameters

A seek function, " seek(start,end)" is used to find the chapter and then tests for the condition
if the evt.position == end
bc.. if (parseInt(evt.position) == end)



Hope this may have given you some "food for thought" but as Ethan stated a link would be most helpful to troubleshoot your issue.

If you want/wish to see this in action then visit my web site and view the JWP6.8 examples.




Ethan Feldman

JW Player Support Agent  
0 rated :

Would really like to see an example link though.

JW Player

User  
0 rated :

@Ethan

ask and ye shall receive

www.starbase-alpha.com/beta6-68.html and have a peek at the seek function in the code

click on a concert then on a chapter

Ethan Feldman

JW Player Support Agent  
0 rated :

I means the customers ;) but this is nice too !

Ethan Feldman

JW Player Support Agent  
0 rated :

I means the customers ;) but this is nice too !

This question has received the maximum number of answers.