提交 70862a3d 编写于 作者: 陈晨

fix:修复video的文档

上级 a37d310b
......@@ -147,11 +147,22 @@ export default {
- App平台:使用 `<video/>` 组件,打包 App 时必须勾选 manifest.json->App 模块权限配置->VideoPlayer 模块。
- App平台:如果使用的视频路径为本地路径,需要配置资源为释放模式:在 manifest.json 文件内 app-plus 节点下新增 runmode 配置,设置值为liberate。
- App平台:如果想使用非原生的video,即原来普通的html5自带video,可使用web-view组件load html页面,在其中使用普通h5 video。
- App平台:`ios``<video/>`组件使用`autoplay`时,视频加载的`loading`会偏移到左上角。解决方法是先去掉`<video/>`中的`autoplay`属性,然后在`onReady`里,调用一下`uni.createVideoContext``paly()`方法,就可以解决了。示例如下:
- App平台:`iOS``<video/>`组件使用`autoplay`属性时,视频加载的`loading`会偏移到左上角。解决方法:去掉`<video/>`组件中的`autoplay`属性,在页面的`onReady`里,调用一下`uni.createVideoContext().play()`,就可以解决了。示例如下:
```html
<!-- #ifdef MP-ALIPAY -->
<video id="myVideo" src="test.mp4" autoplay />
<!-- #endif -->
<!-- #ifndef MP-ALIPAY -->
<video id="myVideo" src="test.mp4" />
<!-- #endif -->
<!-- tip:因为在支付宝小程序不支持uni.createVideoContext()方法,所以在支付宝小程序中使用条件编译,在`<video/>`组件中加上`autoplay`属性。 -->
```
```javascript
onReady: function() {
this.videoContext = uni.createVideoContext('video的id')
this.videoContext.play(); // 删掉video中的autoplay属性,调用play可以解决autoplay的loading跑到左上角
onReady: function() {
// #ifndef MP-ALIPAY
uni.createVideoContext('video的id').play()// 这里就相当于autoplay
// #endif
}
```
- H5平台: 在部分浏览器中会强制调用原生播放器播放(如:微信内置浏览器、UC浏览器等),在 x5 内核的浏览器中支持配置[同层播放器](https://x5.tencent.com/tbs/guide/video.html)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册