Video stop fails in new chrome (Update 2019)


(Diana) #1

Since the new update from the chrome browser earlier this year, we have the problem that our Videos in our Hypefile don’t stop playing after changing the scene. We tried out various things as reset videos and stop videos.

This is the structure of the document:
On a scene (overview) we have 6 Images which are linked to each new slide with a video on it. The Video needs to be played automatically. On the swipe left and swipe right we have a function wich brings you either back to the overview or to an other slides which leads you also to one of the videos depending on where you came from. All of this works. But due to this new chrome-videoplayer the “video_stop” functions seem to be not working anymore after swiping. When loading the new scene after swiping, the video starts playing again in the background. The reset-function works well. But in any case the video doesn’t stop.

This is the stop function:

var video_01 = hypeDocument.getElementById('myvideo_01');
var video_02 = hypeDocument.getElementById('myvideo_02');

if (video_01.currentTime > 0) {
	video_01.pause();
	}		
	
else if (video_02.currentTime > 0) {
	video_02.pause();
	}

If you click again on the image to go back to the video, the video gets reset with a function (on load scene):

var video_01 = hypeDocument.getElementById('myvideo_01');
var video_02 = hypeDocument.getElementById('myvideo_02');

if (video_01.currentTime > 0) {
	video_01.currentTime = 0;
	}		
	
else if (video_02.currentTime > 0) {
	video_02.currentTime = 0;
	} 

We tried all combinations and variations, but the video always starts or continues in the background. Does anyone have an idea to solve our problem? :frowning:

Thank you.


(Jonathan Deutsch) #2

Have you looked in the web developer console to see if there are any errors? A random guess I’d have is that .currentTime or .pause() may be failing because the video hasn’t been set up due to chrome’s newer autoplay restrictions.

I would speculate you may be able to solve this using a persistent symbol, but I wouldn’t know without having more insight into the problem and seeing how you have the animation setup.

Is it possible to post a zip of the .hype document? I think we’d need further context to figure out what is happening.