# uni.createVideoContext(videoId, component?)

创建并返回 video 上下文 videoContext 对象

# 参数

名称 类型 必填 默认值 描述
videoId string.VideoIdString - -
component ComponentPublicInstance | null -

# 返回值

类型 必备
VideoContext | null

# VideoContext 的方法

# play()

播放

# play 兼容性
Android iOS web
3.9.0 4.11 4.0

# pause()

暂停

# pause 兼容性
Android iOS web
3.9.0 4.11 4.0

# seek(position)

跳转到指定位置

# 参数
名称 类型 必填 默认值 描述
position number - 跳转到指定位置(秒)
# seek 兼容性
Android iOS web
3.9.0 4.11 4.0

# stop()

停止视频

# stop 兼容性
Android iOS web
3.9.0 4.11 4.0

# sendDanmu(danmu)

发送弹幕

# 参数
名称 类型 必填 默认值 描述
danmu Danmu - text, color
名称 类型 必备 默认值 描述
text string | null - 弹幕文字
color string | null - 弹幕颜色
time number | null - 显示时刻
# sendDanmu 兼容性
Android iOS web
3.9.0 4.11 4.0

# playbackRate(rate)

设置倍速播放

# 参数
名称 类型 必填 默认值 描述
rate number - , 支持倍率 0.5/0.8/1.0/1.25/1.5
# playbackRate 兼容性
Android iOS web
3.9.0 4.11 4.0

# requestFullScreen(direction?)

进入全屏

# 参数
名称 类型 必填 默认值 描述
direction RequestFullScreenOptions - , 0|正常竖向, 90|屏幕逆时针90度, -90|屏幕顺时针90度
名称 类型 必备 默认值 描述
direction number | null - direction
- 0: 正常竖向
- 90: 屏幕逆时针90度
- -90: 屏幕顺时针90度
# RequestFullScreenOptions 兼容性
Android iOS web
direction 3.9.0 4.11 x
# requestFullScreen 兼容性
Android iOS web
3.9.0 4.11 4.0

# exitFullScreen()

退出全屏

# exitFullScreen 兼容性
Android iOS web
3.9.0 4.11 4.0

# createVideoContext 兼容性

Android iOS web
4.11 4.0

# 参见

相关 Bug

# 通用类型

# GeneralCallbackResult

名称 类型 必备 默认值 描述
errMsg string - 错误信息

示例代码另见video组件