Howler.js为什么有时候播放没声音

JavaScript05

Howler.js为什么有时候播放没声音,第1张

Howler.js默认使用Web Audio,但在IE上可以自动转为HTML 5 Audio。这点很是贴心。

移动端的Safari和Chrome都禁止网页自动播放声音,必须通过用户的操作,touch, click等触发。Howler.js可以设置成自动捕捉用户操作激活(解禁)声音播放。

Howler.js支持很多声音格式以兼容各种浏览器。MP3, MPEG, OPUS, OGG, OGA, WAV, AAC, CAF, M4A, MP4, WEBA, WEBM, DOLBY, FLAC.几乎涵盖了所有格式

支持3D游戏

自动缓存

Type: String[] - Required

An array of audio file urls

Type: Boolean - Default: false

Whether to force HTML5 Audio

Type: Boolean - Default: false

Whether to start the playback again

automatically after it is done playing

Type: Boolean - Default: true

Whether to start downloading the audio

file when the component is mounted

Type: Boolean - Default: false

Whether to start the playback

when the component is mounted

Type: String[] - Default: []

Howler.js automatically detects your file format from the extension,

but you may also specify a format in situations where extraction won't work

(such as with a SoundCloud stream)

Type: Boolean - Default: false

Whether to enable the withCredentials flag on XHR requests

used to fetch audio files when using Web Audio API ( see reference )

Bundle the js to the dist folder:

howler.js

vue-howler

MIT