AudioPlayer

AudioPlayer

new AudioPlayer(loop)

单源音频播放器

Source:
Parameters:
Name Type Description
loop boolean

设置默认播放循环

Members

audio :HTMLAudioElement

HTML音频元素

Source:
Type:
  • HTMLAudioElement

cache :Object

音频保存状态缓存

Source:
Type:

defaultLoop :boolean

音频默认循环播放

Source:
Type:
  • boolean

panTransition :Timer|null

声像过渡计时器

Source:
Type:

panner :StereoPannerNode

左右声道控制节点

Source:
Type:
  • StereoPannerNode

reverb :ConvolverNode|null

混响(卷积器)节点

Source:
Type:
  • ConvolverNode | null

source :MediaElementAudioSourceNode

媒体元素音频源节点

Source:
Type:
  • MediaElementAudioSourceNode

volumeTransition :Timer|null

音量过渡计时器

Source:
Type:

Methods

continue()

继续播放

Source:

pause()

暂停播放

Source:

play(guid, volumeopt)

播放音频文件

Source:
Parameters:
Name Type Attributes Default Description
guid string

音频文件ID

volume number <optional>
1

播放音量[0-1]

reset()

重置音频播放器

Source:

restore()

恢复保存的播放状态

Source:

save()

保存当前的播放状态

Source:

setLoop(loop)

设置循环

Source:
Parameters:
Name Type Description
loop boolean

循环播放

setPan(pan, easingIdopt, durationopt)

设置声像(左右声道音量)

Source:
Parameters:
Name Type Attributes Description
pan number

声像[-1~+1]

easingId string <optional>

过渡曲线ID

duration number <optional>

持续时间(毫秒)

setReverb(dry, wet, easingIdopt, durationopt)

设置混响

Source:
Parameters:
Name Type Attributes Description
dry number

干声增益[0-1]

wet number

湿声增益[0-1]

easingId string <optional>

过渡曲线ID

duration number <optional>

持续时间(毫秒)

setVolume(volume, easingIdopt, durationopt)

设置音量

Source:
Parameters:
Name Type Attributes Description
volume number

播放音量[0-1]

easingId string <optional>

过渡曲线ID

duration number <optional>

持续时间(毫秒)

stop()

停止播放

Source: