# Class: Play

## Play(url, playBehavior)

Play 音频播放指令

## Constructor

#### new Play(url, playBehavior)

##### Parameters:

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

Source:
  - directive/AudioPlayer/Play.js, line 26

### Extends

- BaseDirective

### Methods

#### getToken() → {string}

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

Source:
  - directive/AudioPlayer/Play.js, line 64

##### Returns:

Type
  string

#### setOffsetInMilliSeconds(milliSeconds)

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

##### Parameters:

Name | Type | Description
--- | --- | ---
`milliSeconds` | integer | 毫秒数。比如5分钟的歌曲，播放的长度是5*60*1000毫秒，选择起始的播放位置

Source:
  - directive/AudioPlayer/Play.js, line 84

#### setStreamFormat($streamFormat)

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

##### Parameters:

Name | Type | Description
--- | --- | ---
`$streamFormat` | string | 取值: STREAM_FORMAT_MP3、STREAM_FORMAT_M3U8、STREAM_FORMAT_M4A

Source:
  - directive/AudioPlayer/Play.js, line 96

#### setToken(token)

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

##### Parameters:

Name | Type | Description
--- | --- | ---
`token` | string | 音频的token

Source:
  - directive/AudioPlayer/Play.js, line 53

#### setUrl(url)

设置directive的音频地址url

##### Parameters:

Name | Type | Description
--- | --- | ---
`url` | string | 音频地址

Source:
  - directive/AudioPlayer/Play.js, line 73