Proper onload for <audio>

前端 未结 2 689
暗喜
暗喜 2021-01-19 10:02

I\'ve been looking around and I\'m starting to worry that this isn\'t possible.
Is there any way to make a standard tag with fallbacks...

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-19 10:56

    I did a small PONG-game with WebGL and some audio-tags for the sounds. I borrowed the audio-implementation from Opera's Emberwind HTML5 implementation: https://github.com/operasoftware/Emberwind/blob/master/src/Audio.js

    Their solution worked fine for me (Chrome, Opera and Firefox). Maybe it could be of interest to you? They have some code that will try to find a playable format from line 22 and below.

提交回复
热议问题