fregante / iphone-inline-video

📱 Make videos playable inline on the iPhone (prevents automatic fullscreen)

Home Page:https://npm.im/iphone-inline-video

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

video skips to end when using es6 modules on ios9

JohannesMerz opened this issue · comments

assuming we have a video like:

    <video
      id='videoId'
      muted
      playsInline
      src="vid-src"
   />

when using the library through es6 modules

import enableInlineVideo from 'iphone-inline-video';

    function refVideo(video) {
        enableInlineVideo(video, {
            iPad: true,
        });
        video.addEventListener('ended', function () {
            console.log('the video has ended', video.currentTime);
        });

        setInterval(function() {
            console.log(video.currentTime);
        }, 300);

        setTimeout(function() {
            console.log(video);
            video.play(); // works
            setTimeout(function() {
                video.pause(); // works
                setTimeout(function() {
                    video.play(); // JUMPS TO THE END
                } , 5000);
            }, 10000);
        }, 1000);
    }
    refVideo(document.getElementById('videoId'));

the video jumps to the end when hitting play again.

It works fine if i require the compiled script through the source.

<script src="http://dist/iphone-inline-video.min.js"></script>

Os is ios 9, device is an ipad, user agent:
"Mozilla/5.0 (iPad; CPU OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13G36 Safari/601.1"

I removed my node_modules and reinstalled without effect

Thank you for the report! How long is the video you're testing it with?

about 30s and mp4, unfortunately i cant share it with you in the public

to add to this, i would guess this is due to a dependency being updated. Maybe add a yarn lockfile in the future?

@bfred-it i found it. The newest release of your https://github.com/bfred-it/intervalometer breaks it. If i change the dependency to

"intervalometer": "1.0.2"

it works again.

Thank you!! I reverted the last change of intervalometer; iphone-inline-video should automatically take the new version if you run:

npm rm iphone-inline-video
npm i iphone-inline-video

Does that work?

will check tomorrow, thx for your quick response

seems this fixed everything. Thanks.

Excellent! Thanks again!