Closed ivanschwarz closed 8 years ago
I'm not sure I understand what the issue was, what do you mean by "the audio element is not user-initiated"?
On iPhone play
event is not dispatched until user interaction occurs (see demo). With the current version, the play function always dispatches a play
event. Even if the video is not yet playable.
The spec defines the play
event to be fired when .play()
is called on a paused
media.
iphone-inline-video already works like that.
I think you're referring to the playing
event, which should fire when the playhead actually starts moving. That is indeed broken but I'd need to make it work properly also when there's no audio.
I hope I'm understanding you correctly.
The spec defines the play event to be fired when .play() is called and the media was paused. iphone-inline-video already works like that.
iPhone doesn't behave that way, please check the demo on iPhone. Even though you follow the spec correctly, iPhone doesn't.
I did and 9.3 does follow the spec:
play
is fired when the play button is pressed, even if it's not yet playableplaying
is fired a bit later.What version are you testing on?
Well, but look at the last line of the javascript source code. On desktop you immediately see a play
event, whereas on iPhone, line 6 doesn't result in a play
event. iPhone doesn't dispatch a play
event until user interacts. With iphone-inline-video
the media element wont play, but it will still dispatch a play
event.
Ohhhh I see what you mean, .play()
fires the event but it will never actually play unless the user touches it.
Yes. I'll look into this when I can.
Ideally I'd fix it by finding out whether it can play, because even with your PR the update code still runs at every frame waiting for the audio to play. This probably uncovers some other unwanted behavior too.
Currently
play
event is dispatched also in cases, where the audio element is not user-initiated. I propose proxying playback events from the audio element to the video element.