Md.Shohag Mia
Md.Shohag Mia

Reputation: 19

How to present video with sound "note video autoplay done but not working sound"

I'm trying to make video player with an autoplay but sound is not working.

Currently I'm using this but it doesn't work as expected:

var myaudio = document.getElementById("audioID");

function play() {
   return myaudio.play();
}

function stop() {
   return myaudio.pause();
}
<video width="260" height="180" controls muted id="audioID" autoplay volume="10">
   <source src="{{ asset('video/laberspecicebymujb.mp4') }}" type="video/mp4">
   <source src="{{ asset('video/laberspecicebymujb.ogg') }}" type="video/ogg">
   Your browser does not support the video tag.
</video>

Upvotes: 0

Views: 56

Answers (2)

AdELO
AdELO

Reputation: 9

Google has new policies regarding autoplay. you CAN'T enable both autoplay and sound on chrome browsers

Upvotes: 1

Amit Saini
Amit Saini

Reputation: 595

Regarding volume, you need to set the volume on the onloadstart event like below:

<video onloadstart="this.volume=0.2" ...>

Upvotes: 0

Related Questions