play() request was interrupted? #1169
Replies: 1 comment 1 reply
-
This page explains the problem. It sounds like in some cases there are delays in your audio and/or video loading/playing, and then the plugin calls the .pause() function before the audio/video has started playing, which interrupts the loading that was initiated by .play(). The suggested fix for this is to use the Promise returned by the .play() function to see if playback was successful, and use that to trigger everything that should happen after that, including .pause(). One potential problem with that fix is that it may not work in all browsers, for instance it looks like the .play() function doesn't return a promise in Edge (see here). If you don't want to use promises, then another way to do this is create an event handler that fires when the media starts playing, and use that function to trigger the rest of the trial. But keep in mind that you'll also need to handle the case where that event never fires (because the media doesn't load/play for some reason), for instance by ending the trial if loading problems are detected or after some fixed duration. The media element properties, events and methods listed here might be helpful if you want to go that route. I was also going to suggest that you make sure you've done everything you can to prevent loading audio/video delays during the experiment, but I see that I've already told you everything I know about preloading etc. in this thread 😄 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
I was stress-testing a new experiment and I seemed to run into some minor issues. The audio and video playback is perfect for the most part, but on rare occasions, the audio and/or video does not play at all. I checked and either one of the two errors show up in the console when this occurs:
I was wondering what causes this issue and if there was a work-around to this?
Thanks for any insight!
Beta Was this translation helpful? Give feedback.
All reactions