Skip to content

Latest commit

 

History

History
88 lines (59 loc) · 2.81 KB

File metadata and controls

88 lines (59 loc) · 2.81 KB

Play ⇐ BaseDirective

Play 音频播放指令

Kind: global class
Extends: BaseDirective

new Play(url, playBehavior)

Param Type Description
url string 音频地址
playBehavior string 默认替换所有 REPLACE_ALL: 立即停止当前播放并清除播放队列,立即播放指令中的audio item ENQUEUE: 将audio item添加到当前队列的尾部 REPLACE_ENQUEUED: 替换播放队列中的所有audio item,但不影响当前正在播放的audio item

play.setToken(token)

设置directive的token. 默认在构造时自动生成了token,可以覆盖

Kind: instance method of Play

Param Type Description
token string 音频的token

play.getToken() ⇒ string

获取directive的token. 默认在构造时自动生成了token

Kind: instance method of Play

play.setUrl(url)

设置directive的音频地址url

Kind: instance method of Play

Param Type Description
url string 音频地址

play.setOffsetInMilliSeconds(milliSeconds)

设置directive的属性。从指定的offset开始进行播放

Kind: instance method of Play

Param Type Description
milliSeconds number 毫秒数。比如5分钟的歌曲,播放的长度是5601000毫秒,选择起始的播放位置

play.setStreamFormat(streamFormat)

设置directive的属性。音频流格式,streamFormat 默认STREAM_FORMAT_MP3

Kind: instance method of Play

Param Type Description
streamFormat string 取值: STREAM_FORMAT_MP3、STREAM_FORMAT_M3U8、STREAM_FORMAT_M4A

play.setPlayerInfo(playerInfo)

设置PlayerInfo信息

Kind: instance method of Play
Access: public

Param Type
playerInfo PlayerInfo