I want to stream a video using Video.js and HLS.js with the autoplay option enabled but my audio is always muter, is there any way to disable muted option?
Hey Ekaterina! It’s nice to see you again in our community.
Here is the answer to your query, Google Chrome’s autoplay policy aims to enhance user experience, lessen the need for users to install ad blockers, and use less data on networks with limited capacity. To comply with Chrome’s autoplay policy, you can activate autoplay with sound for video streaming as follows:
1. Autoplay with mute is always permitted
Mute autoplay is always permitted by default. Your video will play automatically without sound if you start it with the muted attribute selected.
2. Autoplay with audio is permitted if
Secondly, a tap or click event signifies the user has engaged with the domain, and the previous video playback with sound on the desktop has been detected, which suggests that the user’s Media Engagement Index (MEI) threshold has been crossed.
Then, user need to choose one option either install the Progressive Web App (PWA) on their desktop computer or add the website to their mobile home screen.
3. Media Engagement Index
MEI is a metric that shows how likely a user is to use a website’s media content. For this function the video size must exceed 200x140 pixels, audio must be present and unmuted, media consumption must exceed seven seconds, and the tab containing the video must be active for autoplay with sound to be enabled.
In the end, when MEI reaches a certain threshold, media on desktop computers might automatically play.
Note: MEI is highest on websites where media is played frequently.
4. Developer Transitions
As a developer, you can modify the behavior of Chrome’s autoplay policy locally to test your website for varying user involvement levels. With the following command line flag, you can turn off the autoplay policy:
chrome.exe --autoplay-policy=no-user-gesture-required
By using the flags chrome.exe --disable-features=PreloadMediaEngagementData, MediaEngagementBypassAutoplayPolicies
, you can also disable MEI and stop autoplay.
Getting user input (click or tap) or satisfying the MEI standards, as mentioned above, should be your main priorities if you want to make sure that your video streaming automatically plays with sound. You can also opt to allow the user to initiate the unmuting process, which can improve the user experience.
Do let me know if you have more queries on this.
Thank you
Hi!
Google Chrome introduced an autoplay policy with Chrome 66 and almost all other browsers have also adopted the same policy regarding autoplay.
According to this policy, autoplay is only allowed when the video is muted by default. Unless the user interacts with the webpage with a click or tap autoplay with sound is not allowed.
You can read more about the policy at the below link.
Thank you so much worked for me!