autoPlay for pgSoundLoader or htmlVideoLoader

Workarounds and usability notes.

Re: autoPlay for pgSoundLoader or htmlVideoLoader

Postby John Robin Dove » Fri Mar 02, 2018 9:34 am

Hi Clifton,
I have just updated to the latest Powerpac but I managed to get the result I wanted on Chrome for Android before updating. I made a small test app. that imitates what I am trying to do with in my current project i.e. play a video file and use it to play separate audio files which can be questions or commentaries etc. I made 2 versions. One uses a hidden html file containing an audio element via pgGotoURL and the other just uses pgSoundLoader. Because the pgSoundLoader object was hidden I thought it might be a problem but in fact both versions work equally well. I think the rule is that if a user has activated an audio element (by clicking) once, the same element can be used again without restrictions. I think if I had used different audio elements to play each commentary there wouild have been a problem but using the same element and reloading it with different source files seems to be OK. When user clicks on the 'Play video' button it also starts the audio which is from a separate mp3 file. Thereafter timeMarkers load other files and send play() to the same audio element. I hope this is useful to you. The apps are here https://www.mediacours.com/startaudio1 and https://www.mediacours.com/startaudio2
John Robin Dove
 
Posts: 486
Joined: Thu Jan 23, 2014 4:35 am

Re: autoPlay for pgSoundLoader or htmlVideoLoader

Postby Clifton » Fri Mar 02, 2018 11:44 am

Thanks for posting your results.

There is a possibility that the latest PowerPac may resolve some of these issues too. (v14.054.1)

Even if you used different elements to load auto/video files they would work in Chrome once the user has activated any control on the page. Even clicking any object is sufficient to enable the autoplay mechanism. Therefore, once a user has interaction with the first page of a course, thereafter all the rest of the pages will allow "autoplay" to work as Google's policy has been satisfied.

In addition, setting the iframe properties of the parent document which holds the content helps in these situations. The latest PowerPac version handles the iframe properties. You can see the dynamic setting using Firefox's debugger (F12) and looking at the HTML of the page.

Hopefully these posts will help other developers out there who are having media "autoplay" issues with Chrome. I suspect that other browser manufacturers "may" adopt these policies. Better safe than sorry. Rule here is don't just code around Chrome or any other browser. Instead assume they will all follow suit.
 
Clifton
Site Admin
 
Posts: 732
Joined: Tue Jan 14, 2014 1:04 am

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron