codecamp

百度智能小程序 VideoContext

VideoContext

解释: swan.createVideoContext 的返回值

属性说明

属性名 说明
VideoContext.play 播放
VideoContext.pause 暂停
VideoContext.seek 跳转到指定位置(单位:s)
VideoContext.sendDanmu 发送弹幕
VideoContext.requestFullScreen 按设置的视频全屏方向进入全屏
VideoContext.exitFullScreen 退出全屏
VideoContext.showStatusBar 显示状态栏
VideoContext.hideStatusBar 隐藏状态栏
VideoContext.stop 停止播放视频
VideoContext.playbackRate 倍速播放视频

示例 

在开发者工具中打开



图片示例

代码示例

<view class="wrap">
    <video id="myVideo" enable-danmu="true" src="https://b.bdstatic.com/swan-temp/940fe716b0eaad38f47b209d61657490.mp4"></video>
    <button type="primary" bindtap="play">play</button>
    <button type="primary" bindtap="stop">stop</button>
    <button type="primary" bindtap="pause">pause</button>
    <button type="primary" bindtap="seek">seek</button>
    <button type="primary" bindtap="sendDanmu">sendDanmu</button>
    <button type="primary" bindtap="fullScreen">requestFullScreen</button>
    <button type="primary" data-set="0.75" bindtap="playbackRate">点击0.75倍速播放</button>
    <button type="primary" data-set="1.0" bindtap="playbackRate">点击1.0倍速播放</button>
    <button type="primary" data-set="1.25" bindtap="playbackRate">点击1.25倍速播放</button>
    <button type="primary" data-set="1.5" bindtap="playbackRate">点击1.5倍速播放</button>
    <button type="primary" data-set="2.0" bindtap="playbackRate">点击2.0倍速播放</button>
</view>

错误码

Android

错误码 说明

202

解析失败,请检查参数是否正确

1001

执行失败

iOS

错误码 说明

202

解析失败,请检查参数是否正确


百度智能小程序 创建videoContext
百度智能小程序 创建animationVideo
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

百度智能小程序开发文档

百度智能小程序 组件

百度智能小程序 地图

百度智能小程序 画布

百度智能小程序 API

百度智能小程序 界面

百度智能小程序 关注小程序引导组件

百度智能小程序 自定义组件

百度智能小程序 媒体

百度智能小程序 设备

百度智能小程序 拨打电话

百度智能小程序 内存警报

百度智能小程序 手机联系人

百度智能小程序 用户截屏事件

百度智能小程序 第三方平台

百度智能小程序 开放接口

百度智能小程序 百度收银支付

百度智能小程序 分包预下载

百度智能小程序 数据分析

百度智能小程序 服务端

百度智能小程序 云开发

百度智能小程序 初始化

百度智能小程序 云函数

百度智能小程序 服务端初始化

百度智能小程序 服务器获取上下文

百度智能小程序 服务端云函数

百度智能小程序 开发教程

百度智能小程序 功能开发

百度智能小程序 基本原理

百度智能小程序 小程序自动化

百度智能小程序 视频教程

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }