Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

267
Views
playlist autoplay but has not sound

I have a playlist in javascript, when it is muted the video plays automatically, otherwise it doesn't play automatically.

How can I make autoplay and muted false?

My code HTML is:

<video  id="vid" src="main/" style="width:1360px; height:750px; visibility:visibility;"  controls playsinline     >

var separador = ";";
var video = document.currentScript.parentElement;
var sec = document.getElementById("valor").textContent;
var playlist = sec.split(separador);
video.volume = 0.1;

var lastSong = null;
var selection = null;
var video = document.getElementById("vid");

video.autoplay = true;
video.muted = true;


video.addEventListener("ended", selectRandom);
//video.muted=false;
function selectRandom() {
  while (selection == lastSong) {

    selection = Math.floor(Math.random() * playlist.length);

  }

  lastSong = selection;
  video.src = playlist[selection];

}

selectRandom();
video.play();

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You can't play a video automatically with sound. There's a thing called "Autoplay Policy", at least for Chrome, but all other browsers are trying to block it.

See more information here.

about 4 years ago · Juan Pablo Isaza Report

0

Thank you very much, it is indeed the autoplay policy. I can solve it by adding the page as a shortcut on the desktop. The objective is to reproduce the videos on screens in a store.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!