Problem with autoplay of videos in Chrome

Asked

Viewed 522 times

-1

I’m having trouble inserting a video with autoplay on a page of a website, when this page opens in Chrome, the video stops until you click the "play button".

I read in several "posts" that this is a "bug" and the suggestion is to insert the attribute "muted" in the video tag, but the video is muted and accurate that in addition to the video start to run automatically that it also has sound.

I tried to enable the sound via jQuery, but was not successful.

Could someone help me?

Thank you.

  • But what do you want? That it already starts spinning and with sound?

  • 1

    "It is known from this bug", which bug? What is the expected result and what is desired?

  • 2

    With a quick search you can discover that is not a bug is a measure by Google to improve the user experience. Or you activate the autoplay mute or you’ll have to dig deeper to understand how Google judges which videos can and cannot automatically play with sound.

  • Yes I would like it to start running and sound. I read several posts that treat as a bug and signal that Google intends to fix.

1 answer

1

Use $("video").prop('muted', bool) to enable or disable sound and $("video").prop('muted') to check that it is muted.

Example

$("video").prop('muted', true);

$("#mute-video").click(function() {
  if ($("video").prop('muted')) {
    $("video").prop('muted', false);
  } else {
    $("video").prop('muted', true);
  }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button id="mute-video">Mudo</button>
<video src="http://s3.amazonaws.com/servingsites-videos/firstbaptistchurchofnorfolk/sample-welcome-video-2.mp4" controls width="240"></video>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.