English 中文(简体)
用户互动之后的超声传声
原标题:HTML audio autoplay after user interaction
问题回答

<编码> 在缺席的情况下,-(至少至最新版本)(截至今天:>117.0.1),自动演播音被封,因此,如果在同一页上出现人的互动,则必须启动(例如,点击子)。

So, apart from the built-in "play" button in the audio element, you may use JS (say associated with the click of a button) to trigger the audio play, you may (as a demonstration):

  1. Assign the audio an ID (e.g. audio1)
  2. Trigger play(), such as document.getElementById( audio1 ).play();

因此,该法典是:

<!DOCTYPE html>
<html>
<body>

<h1>The audio autoplay attribute</h1>

<p>Click on the play button to play a sound:</p>

<audio controls autoplay id=audio1>
  <source src="https://www.w3schools.com/tags/horse.ogg" type="audio/ogg">
  <source src="https://www.w3schools.com/tags/horse.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>

<input type=button onclick="javascript:play1();" value="Play">
</body>
</html>

<script>
function play1(){
document.getElementById( audio1 ).play();
}
</script>   

http://www.createchhk.com/SOanswers/subw/d1.html

www.un.org/Depts/DGACM/index_russian.htm

  1. click settings in Firefox,
  2. click privacy & security,
  3. scroll to "Autoplay" and click "Settigs"
  4. choose choose "Allow Audio and Video"

如果你做上述工作,那么如果该网页装上了火ox,就会允许自动播放录音。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签