"ended" Event not firing in Safari

3,428 views
Skip to first unread message

medianueva

unread,
Feb 10, 2011, 2:47:25 PM2/10/11
to jPlayer: HTML5 Audio & Video for jQuery
I'm having a weird issue with the "ended" event not firing in safari,
but only when there are tabs:

* If you have two tabs open and are focused on another tab, the
"ended" event doesn't fire.
* However, if you have two windows open in Safari and the site is by
itself in one window and the other window has one or more tabs, it
DOES fire.
* It still fires if you're in another app as long as the site is the
active tab in safari or in its own stand alone window.

I thought this might be a Webkit issue, but it works fine in Chrome.
Does anyone know if there is some weird issue with Safari and events
not firing when you're focused in another tab?

You can view the site here:
http://losinghasneverbeenthisfun.com

Maboa

unread,
Feb 11, 2011, 8:51:10 AM2/11/11
to jpl...@googlegroups.com
medianueva,

Yup - I confirmed this using this demo : http://www.jplayer.org/latest/demo-02/

In Safari if you press play on the Big Buck Bunny trailer and then navigate to another open tab it seems the end event isn't triggered until you navigate back to the original tab (at which point it plays the next item in the playlist).

This looks very much like an issue with Safari but whether it is a bug or by design I'm not sure, we'll try and find out though.

Nice site BTW - can I tweet it ? :)

Cheers

Mark B

Dennis Wallace

unread,
Feb 11, 2011, 9:37:53 AM2/11/11
to jpl...@googlegroups.com
I would guess this is by design, due to the fact that Safari is the same code used in both iOS and the desktop version.  On iOS you (arguably) don't want unending playlist behavior as it would be a battery drain. Desktop it wouldnt matter as much.

= dw =

--
You received this message because you are subscribed to the Google Groups "jPlayer: HTML5 Audio & Video for jQuery" group.
To post to this group, send email to jpl...@googlegroups.com.
To unsubscribe from this group, send email to jplayer+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jplayer?hl=en.

Maboa

unread,
Feb 11, 2011, 10:35:05 AM2/11/11
to jpl...@googlegroups.com
I've been in contact with somebody from Apple and apparently it sounds like a bug.

medianueva if you could file a bug at https://bugs.webkit.org/ I'm sure it would be appreciated and it would contribute towards getting the issue resolved.

Cheers

Mark

Maboa

unread,
Feb 11, 2011, 10:41:46 AM2/11/11
to jpl...@googlegroups.com
This bit of code may help you distill the problem.
function load() {
    var vid = document.getElementById('vid');
    vid.addEventListener('ended', function() {
        alert('video ended');
        vid.load();
    },false);
}

The html:

<body onload="load();">
<h1>HTML5 Video Test</h1>
<input type="submit" value="Play" onclick="document.getElementById('vid').play();">
<video id="vid" src="test.mov" width="640" height="480"></video>
</body>


Cheers

Mark B

Maboa

unread,
Feb 11, 2011, 10:51:12 AM2/11/11
to jpl...@googlegroups.com
OK, the latest word is that it may be intentional. Dennis could well be right. However you should still file a bug if you think the behaviour is incorrect.

Cheers

Mark B

medianueva

unread,
Feb 11, 2011, 3:36:11 PM2/11/11
to jPlayer: HTML5 Audio & Video for jQuery
Thanks Mark!

Yes, you definitely can tweet it.

P.S. my twitter name is "medianueva"

medianueva

unread,
Feb 11, 2011, 3:38:43 PM2/11/11
to jPlayer: HTML5 Audio & Video for jQuery
Thanks Mark and Dennis for your input. Greatly appreciated

I'll give that other code you posted above over the weekend as well as
file a bug report for Webkit. What's strange is that it works fine in
Chrome, so my guess is that it is a Safari bug or Apple intentionally
did that.

Johnson Mercy

unread,
Jun 19, 2015, 2:17:01 PM6/19/15
to jpl...@googlegroups.com
Big thanks to Maboa.
your code helped me fix the bug i was having though not in safari but in Javafx WebView Node.
Worked accurately after almost pulling google server down searching for solutions.

You're a life saver mate.
I thank God for using you and may he bless thee with more inspiration.
Reply all
Reply to author
Forward
0 new messages