audio

FLASH源码 2025-07-30

HTML5 audio包装器

例子;反应,超应用。

用法

方法 描述
重置() 重置播放器状态默认
SRC(字符串) 设置播放器SRC(文件URL)
在(状态:对象=> void) 设置将使用播放器状态调用的回调函数
玩() 播放歌曲
暂停() 暂停歌曲
停止() 停止歌曲
寻求(第二:数字) 寻求第二
卷(0〜1:数字) 设置音量
togglemute() 切换静音
audio .js" const audio = new audio () audio .on(state => console.log("new state:", state)) audio .src("MP3_URL") audio .play() ">
 >
< html >
    < head >
        < meta charset =" UTF-8 " />
        < meta name =" viewport " content =" width=device-width " />
        < title > Example  title >
     head >
    < body >
        < script type =" module " >
            import audio from "./ audio .js"

            const audio = new audio ( )
            audio . on ( state => console . log ( "new state:" , state ) )
            audio . src ( "MP3_URL" )
            audio . play ( )
         script >
     body >
 html > 

$ yarn add https://*git*hub.co*m/rafaelsq/audio

audio " const audio = new audio () audio .on(state => console.log("new state:", state)) audio .src("MP3_URL") audio .play()">
 import audio from " audio "

const audio = new audio ( )
audio . on ( state => console . log ( "new state:" , state ) )
audio . src ( "MP3_URL" )
audio . play ( )
下载源码

通过命令行克隆项目:

git clone https://github.com/rafaelsq/audio.git