HTML audio Element how to replay?

前端 未结 8 1743
自闭症患者
自闭症患者 2020-12-16 22:52

I setup a HTML5 page, that include a node. The page will to playing a music(mp3 format),but it just play sound to end, and I use javascript to control audio element,even so

8条回答
  •  不思量自难忘°
    2020-12-16 23:05

    don't use node.load() this is way too slow for slow devices.

    To stop, you should just use:

    node.currentTime = 0
    

    To replay you can do:

    node.currentTime = 0
    node.play()
    

提交回复
热议问题