Can I request an autoplay feature ie so the file is played when the page loads?

Here is the UI for my D7 site which uses https://www.drupal.org/project/mediaelement

autoplay

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Juc1 created an issue. See original summary.

Daniel.Moberly’s picture

Status: Active » Needs review

Added this feature in the latest development version. Thanks for your feedback!

Daniel.Moberly’s picture

Status: Needs review » Fixed

Fixed in 8.x-1.3

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

cside’s picture

Hi,

I'm re-opening this issue as i cannot get Autoplay to work.

I'm using Drupal 8.7.5 and have used both the latest Audiofield version as well as the dev version. I have tried a number of different players and none activate the autoplay feature.

Attached is my setup.

Thanks

Daniel.Moberly’s picture

I have tested the default installation of audiofield and autoplay works with all players.

Can you confirm that your template file audioplayer.html.twig is up to date?

cside’s picture

From what i can see it is up to date. I have attached a screenshot

Daniel.Moberly’s picture

Do you have a local version in your theme? When you load the audioplayer, what does the HTML look like? Is the autoplay flag there?

cside’s picture

I get this in the JS Console on a node with audiofield and with autoplay selected in display:

Autoplay is only allowed when approved by the user, the site is activated by the user, or media is muted.

Daniel.Moberly’s picture

That's a browser issue, not an issue with the module

cside’s picture

Ok ... i have done some extensive testing here.

The test page is here: http://qleva.netnebulis.se/node/170

I can get autoplay to work with Soundwave media player on:
- Mac with Firefox
- Android with Firefox

I cannot get it to work with:
- Any other media player on any web browser on any platform
- Soundwave on Mac with Opera, Google or Safari
- Soundwave on Android with Chrome
- Soundwave on iOS Mobile with Firefox, Chrome, Opera, Safari, Edge and various other custom web browsers

I have used various devices on several different internet connections and cleared all browser caches etc

I have attached the console output from Chrome.

tamerzg’s picture

As of April 2018, Chrome's autoplay policies changed:

"Chrome's autoplay policies are simple:

Muted autoplay is always allowed.
Autoplay with sound is allowed if:

User has interacted with the domain (click, tap, etc.).
On desktop, the user's Media Engagement Index threshold has been crossed, meaning the user has previously play video with sound.
On mobile, the user has added the site to his or her home screen.

See https://developers.google.com/web/updates/2017/09/autoplay-policy-changes

As for iOS/Android mobile browser's ignore the autoplay attribute on and elements. Stupid reasons include saving mobile bandwidth on behalf of the user.

msypes’s picture

To add to @tamerzg's info, Firefox is even more strict since early 2019. In short, unless you've already given a site permission to autoplay, it won't allow it. You can see "Autoplay is only allowed when approved by the user, the site is activated by the user, or media is muted." in the console anytime a site attempts it.
I've been working on a project where autoplay is expected, and I'll have to inform my client that's a no go.