VideoContext

解释: swan.createVideoContext 的返回值

示例

在开发者工具中预览效果

扫码体验

请使用百度APP扫码

图片示例

代码示例

-

  1. <view class="wrap"> <video id="myVideo" enable-danmu="true" src="https://b.bdstatic.com/swan-temp/940fe716b0eaad38f47b209d61657490.mp4"></video></view>

-

  1. Page({ data: { }, onLoad() { const videoContext = swan.createVideoContext('myVideo'); console.log(videoContext); this.videoContext = videoContext; }, play() { this.videoContext.play(); }, pause() { this.videoContext.pause(); }, seek() { this.videoContext.seek(180); }, sendDanmu() { this.videoContext.sendDanmu({ text: '这是一条弹幕', color: '#f60' }); }, requestFullScreen() { this.videoContext.requestFullScreen({direction: 90}); }, exitFullScreen() { this.videoContext.exitFullScreen(); }, showStatusBar() { this.videoContext.showStatusBar(); }, hideStatusBar() { this.videoContext.hideStatusBar(); }});

错误码

Android

iOS