uni.createVideoContext(videoId, component?)
创建并返回 video 上下文 videoContext 对象
Parameters
| name | type | required | default | description |
| videoId | string | YES | - | - |
| component | ComponentPublicInstance | NO | - | - |
Return value
VideoContext Values
| name | type | optinal | default | description |
| play | () => void | YES | - | 播放 |
| pause | () => void | YES | - | 暂停 |
| seek | (position: number) => void | YES | - | 跳转到指定位置 |
| stop | () => void | YES | - | 停止视频 |
| sendDanmu | (danmu: Danmu) => void | YES | - | 发送弹幕 |
| playbackRate | (rate: number) => void | YES | - | 设置倍速播放 |
| requestFullScreen | (direction: RequestFullScreenOptions) => void | YES | - | 进入全屏 |
| exitFullScreen | () => void | YES | - | 退出全屏 |
Danmu Values
| name | type | optinal | default | description |
| text | string | NO | - | 弹幕文字 |
| color | string | NO | - | 弹幕颜色 |
| time | number | NO | - | 显示时刻 |
RequestFullScreenOptions Values
| name | type | optinal | default | description |
| direction | number | NO | - | direction - 0: 正常竖向 - 90: 屏幕逆时针90度 - -90: 屏幕顺时针90度 |
VideoContext Compatibility
| Android version | Android uni-app | Android uni-app-x | iOS version | iOS uni-app | iOS uni-app-x |
| play | 4.4 | √ | 3.9.0 | - | - | - |
| pause | 4.4 | √ | 3.9.0 | - | - | - |
| seek | 4.4 | √ | 3.9.0 | - | - | - |
| stop | 4.4 | √ | 3.9.0 | - | - | - |
| sendDanmu | 4.4 | √ | 3.9.0 | - | - | - |
| playbackRate | 4.4 | √ | 3.9.0 | - | - | - |
| requestFullScreen | 4.4 | √ | 3.9.0 | - | - | - |
| exitFullScreen | 4.4 | √ | 3.9.0 | - | - | - |
createVideoContext Compatibility
| Android version | Android uni-app | Android uni-app-x | iOS version | iOS uni-app | iOS uni-app-x |
| 4.4 | √ | √ | - | - | - |
See also
createVideoContext
Related Bug
General type
GeneralCallbackResult
| name | type | optinal | default | description |
| errMsg | string | YES | - | 错误信息 |