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

Seek causing iPad to not play video


We've been using JWPlayer for the past 12-18 months for viewing of local government meeting videos, with very good results. Today I had a request to provide unique URLs so users could share videos and have the player start at a specific position. I hadn't done much programming to the API yet, but I put something together thanks to the documentation:

<script>
//Add #t=300 to begin playing at 5 minutes (300 seconds) in
jwplayer().onReady(function() {
if(window.location.hash) {
var offset = window.location.hash.substr(3);
jwplayer().seek(offset);
}
});

jwplayer().onPause( function(event){
var position = jwplayer().getPosition();
window.location.hash = '#t=' + position;
});
</script>

When a user pauses the video, a hash is added to the URL based on the number of seconds of the position. The user then emails that full URL. The received clicks on the link, and the video plays starting at that location. Dandy.

However, on an iPad (iOS 7.1), the video refuses to play if the hash is present. I see the JWPlayer "spinner" and nothing further.

If I remove the above onReady function, or remove the hash, the video plays fine.

Temporarily I've worked around this by checking the HTTP_USER_AGENT and only including the onReady function for non-iOS browsers. Users will play the videos, but they'll always start at the beginning. The pause-to-add-hash function works fine on iOS.

Any idea what's going on, and is there a way to make this work on iOS?

Here are two links for review. First, the page that fails on iOS (but plays fine on other tested browsers):

http://www.douglasma.org/cable/video/streamNew-jwtest.php?program=SBC_2014_05_15.mov&title=School%20Building%20Committee:%20May%2015,%202014#t=300

and the page that plays (but plays at the video start):

http://www.douglasma.org/cable/video/streamNew.php?program=SBC_2014_05_15.mov&title=School%20Building%20Committee:%20May%2015,%202014#t=300

The only difference between the files is the presence of the onReady function in the failing page.

If you'd like to test with additional videos, our main index is here:

http://www.douglasma.org/index.php/pages/committees/online_programs

which leads to the streamNew.php file with suitable parameters.

If you'd like to get the video directly, should that be an issue or question, it's at:

http://streamingdl.douglastv.org/media/video/SBC_2014_05_15.mov

Thanks!

2 Community Answers

jherrieven

User  
0 rated :

Simple really...

iOS does not allow programmatic auto-play and the seek() call is try to do exactly that.

What I would do is look at moving the seek() to the onPlay event for iOS with an additional check to ensure it is only actioned the first time.

James Herrieven

Todd

JW Player Support Agent  
0 rated :

Were you able to get this working correctly?

This question has received the maximum number of answers.