EzuikitFlv

EzuikitFlv

EzuikitFlv.js 播放flv直播流, 支持播放h264/h265的直播视频流

Constructor

new EzuikitFlv(options)

Example
```js
const flv = new EzuikitFlv({
 id: "EleId",
 url: "https://open.ys7.com/v3/openlive/E71992743_1_1.flv"
})
```
Parameters:
Name Type Description
options FlvOptions

Members

ERROR

Description:
  • ERROR

ERROR

Example
EzuikitFlv.ERROR.playError

TIMEOUT

Methods

audioResume() → {void}

Description:
  • 音频恢复

Example
flv.audioResume()
Returns:
Type
void

cancelFullScreen() → {Promise}

Description:
  • 退出全屏播放视频

Example
flv.cancelFullScreen() // 退出全屏
Returns:
Type
Promise

closeSound() → {void}

Description:
  • 关闭声音

Example
flv.closeSound()
Returns:
Type
void

destroy()

Description:
  • 销毁

Example
flv.destroy()

exitFullscreen() → {Promise}

Description:
  • 取消全屏播放视频

Example
flv.exitFullscreen() // 全屏
Returns:
Type
Promise

fullScreen() → {Promise}

Description:
  • 全屏播放视频(不支持移动端)

Example
flv.fullScreen() // 全屏
Returns:
Type
Promise

fullscreen() → {Promise}

Description:
  • 全屏播放视频(不支持移动端)

Example
flv.fullscreen() // 全屏
Returns:
Type
Promise

getOptions() → {object}

Description:
  • 获取设置

Returns:
Type
object

getState() → {PlayerState}

Description:
  • 获取播放器的状态

Example
flv.getState()
Returns:

播放器的状态

Type
PlayerState

getVersion() → {string}

Description:
  • 获取版本

Returns:
Type
string

getVolume() → {number}

Description:
  • 获取音量, 音量 0~1

Example
flv.getVolume()
Returns:
Type
number

openSound() → {void}

Description:
  • 开启声音 默认音量 0.5

Example
flv.openSound() //
Returns:
Type
void

pause() → {Promise.<unknown>}

Description:
  • 暂停

Example
flv.pause()
Returns:
Type
Promise.<unknown>

play(optionsopt) → {Promise}

Description:
  • 播放

Example
flv.play()
Parameters:
Name Type Attributes Description
options string | FlvOptions 可选
Returns:
Type
Promise

resize(widthopt, heightopt)

Description:
  • 重新调整视图大小

Example
flv.resize()
Parameters:
Name Type Attributes Description
width number 可选

height number 可选

setDebug(value) → {void}

Description:
  • 是否开启控制台调试打印

Example
flv.setDebug(false)
Parameters:
Name Type Description
value boolean

true: 开启, false: 关闭

Returns:
Type
void

setKeepScreenOn() → {void}

Description:
  • 开启屏幕常亮,在手机浏览器上

Example
flv.setKeepScreenOn()
Returns:
Type
void

setLogger(options) → {void}

Description:
  • 设置日志

Parameters:
Name Type Description
options object

日志设置 {level: 'INFO' | 'LOG' | 'WARN' | 'ERROR'}

Returns:
Type
void

setRotate(deg) → {Promise}

Description:
  • 设置旋转角度,支持,0(默认), 90, 180, 270 四个值。

Example
flv.setRotate(90) // 旋转90度
Parameters:
Name Type Description
deg number
Returns:
Type
Promise

setVolume(value) → {void}

Description:
  • 设置音量

Example
flv.setVolume(0.5)
Parameters:
Name Type Description
value number

音量 0~1

Returns:
Type
void

(static) supportType(options) → {boolean}

Description:
  • 静态方法 判断是否支持播放地址

Example
```js
EzuikitFlv.supportType({url: "https://open.ys7.com/v3/openlive/E71992743_1_1.flv",  type:'flv'})
```
Parameters:
Name Type Description
options Object
Properties
Name Type Attributes Description
url string 可选
type string 可选
Returns:
Type
boolean