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

Onended triggers infinitely #61

Closed kwadhera closed 7 years ago

kwadhera commented 8 years ago

Using NPM iphone-inline-video@1.9.3

    document.getElementById("ele").onended = function() {
        console.log("kk");
        document.getElementById("ele").currentTime = 10; 
        document.getElementById("ele").play();
    };

It seems to loop sometimes but eventually it will stop playing and infinitely trigger ended

https://puu.sh/qraVx/1d3287f093.png

fregante commented 7 years ago

What is the duration of the video? It seems to me that .play() is again near the end when you set currentTime = 10 so it will just loop.

I added those two lines because the ended event wasn't being fired reliably for me, so I added a fake one and hid the native event.

Does that "fix" work for you now on iOS 9?

Edit: closing due to inactivity