h5p-course-presentation icon indicating copy to clipboard operation
h5p-course-presentation copied to clipboard

Video autoplay not working if video is on first slide

Open fkohrt opened this issue 4 years ago • 6 comments
trafficstars

Summary

If I enable autoplay for a video that is on the first slide, it does not play automatically when the presentation is viewed. Only if one goes to the next slide and back again the video starts to play.

Steps to reproduce

  1. Put video on first slide
  2. Enable autoplay
  3. View presentation
  4. Notice that video doesn't play

Expected behaviour

Video should start to play.

fkohrt avatar Dec 30 '20 02:12 fkohrt

@fkohrt This is not a bug, but browser policies kicking in. They decide whether a video will autoplay or not before the user has interacted with the web page.

Please compare https://developers.google.com/web/updates/2017/09/autoplay-policy-changes for instance.

otacke avatar Dec 30 '20 06:12 otacke

I see, I didn't think about that. However, in my case the video is muted (has no audio track) and it plays fine if I manually add the attribute autoplay. So shouldn't it play fine in H5P as well?

fkohrt avatar Dec 30 '20 10:12 fkohrt

@fkohrt Muted videos are a special case of its own (see the link above). There's still just a general ruleset (not a guarantee) for autoplaying even if the autoplay attribute is set, cmp. https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide#Autoplay_availability

otacke avatar Dec 30 '20 11:12 otacke

Alright, I understand this is a web browser issue.

fkohrt avatar Dec 30 '20 13:12 fkohrt

However, even with...

  • the chromium switch --autoplay-policy=no-user-gesture-required and with
  • the policy AutoplayAllowed set to true

...I can't get the video to play, so it seems to me this is not a browser policy issue.

How to change Chromium's policy on GNU/Linux

Write the following to /etc/chromium/policies/managed/test_policy.json:

{
  "AutoplayAllowed": true
}

Verify that it works at chrome://policy/.

Source: Chromium Documentation for Administrators > Linux Quick Start

fkohrt avatar Dec 30 '20 13:12 fkohrt

@fkohrt Interesting find!

It seems that Course Presentation takes control over autoplaying and media instances are only autoplayed when switching the slide. Not sure it that's a bug or in fact intended behavior. I guess the H5P core team will have to answer that question.

otacke avatar Dec 30 '20 14:12 otacke