- nvue界面:
<video id="myVideo" ref="myVideo" class="video" :poster="mainImg" :src="videoUrl"
:controls="false" :show-fullscreen-btn="false" :show-center-play-btn="false" :show-progress="false"
@ended="nextPlay" @timeupdate="processUpdate">
<cover-view class="controls-top row" v-if="showControls">
<text class="iconfont" @click.stop="backHandle"></text>
<text class="title">{{title}}</text>
</cover-view>
<cover-view class="controls-center center" @click="showHideConterols">
<text v-if="showControls && !play" class="iconfont stop" @click.stop="playVideo"></text>
<text v-if="showControls && play" class="iconfont stop" @click.stop="playVideo"></text>
</cover-view>
</video>
<script>
onReady() {
this.videoContext = uni.createVideoContext('myVideo', this)
},
playVideo() {
if (!this.videoContext) return
if (this.play) { //暂停
this.videoContext.pause()
} else { //播放
this.videoContext.play()
//隐藏控制按钮
this.showHideConterols()
}
this.play = !this.play
},
</script>
page.json配置界面
"path": "pages/course/course-play",
"style": {
"navigationBarTitleText": "",
"navigationBarTextStyle": "black",
"app-plus": {
"titleNView": false,
"subNVues": [
{
"id": "topVideo",
"path": "pages/course/subNVue/app-video",
"style": {
"position": "dock",
"dock": "top",
"width": "100%",
"height": "420px"
}
}
]
}
}
1 个回复
1***@qq.com
解决了吗