fregante / iphone-inline-video

📱 Make videos playable inline on the iPhone (prevents automatic fullscreen)
https://npm.im/iphone-inline-video
MIT License
2.06k stars 298 forks source link

On autoplay iPad iOS9 does not dispatch initial 'play' or 'playing' event (does do this on iPhone iOS9) #75

Closed fox94610 closed 7 years ago

fox94610 commented 7 years ago

Used below method to kick off autoplay on iPad: makeVideoPlayableInline(videoElement, false/* hasAudio /, false/ false = run everywhere */); Works great but I would like to detect 'play' or 'playing' event. Is there a way to do this? If not is it possible to patch?

iPhone logging... http://foxflare.com/mobileEvent/ss1.png

Same page on iPad... http://foxflare.com/mobileEvent/ss2.png

fregante commented 7 years ago

That's strange, they shouldn't behave differently. I'll look into this

fregante commented 7 years ago

I can't test on the iPad right now, but can you open this URL there to see if the events are fired? It has the same logging http://bfred-it.github.io/iphone-inline-video/?enabled=true

fox94610 commented 7 years ago

I checked it out, you definitely have the play and playing event firing on your page. I guess it's not a bug. Something is weird with my JS writing everything to the page implementation. Maybe some race condition in there somehow messing up the initial play and playing events.

fregante commented 7 years ago

Thanks for reporting!

fregante commented 7 years ago

In the v2 beta I simplified the usage on iPad. Can you try it and let me know how it goes?

fregante commented 7 years ago

v2.0.0 has been published :)

Now you can use the iPad option:

enableInlineVideo(video, {
    iPad: true
});