1、video層級過高的問題
問題一: 我的界面由于是自定義導航欄,所以使用video時,上滑界面video會直在最上層,蓋著? 頭部導航欄
解決方法:使用cover-view,自定義頭部使用cover-view替換view
問題二:自定義導航欄上面有menu,點擊會出現(xiàn)一個彈出層,但是彈出層會被video壓到
解決方法:使用原生窗體subNVues(uni-app subNVue 原生子窗體開發(fā)指南 - DCloud問答),原生窗體在第一次打包的時候可能會顯示問題,打包的時候注意一下就行。詳細的以上鏈接有說明
2、循環(huán)使用多個video時,安卓手機同時播放的問題
使用uni.createVideoContext,具體方法:文章來源:http://www.zghlxwxcb.cn/news/detail-457998.html
<video
:src="item.src"
:data-id="item.id"
:id="item.id"
class="item-video"
:poster="item.src+'?x-oss-process=video/snapshot,t_0,f_jpg'"
show-fullscreen-btn="false"
object-fit="cover"
@play="playing">
</video>
playing(e) {
// 獲取當前視頻id
let currentId = e.currentTarget.dataset.id
console.log(currentId);
// uni.createVideoContext獲取視頻上下文對象
this.videoContent = uni.createVideoContext(currentId)
// 獲取json對象并遍歷, 停止非當前視頻
//operationList為video循環(huán)列表
let operationList = this.operationList
for (let i = 0; i < operationList.length; i++) {
let temp = operationList[i].id
if (temp !== currentId) {
uni.createVideoContext(temp).pause()
}
}
},
以上就可以解決安卓手機上,多視頻播放的問題啦文章來源地址http://www.zghlxwxcb.cn/news/detail-457998.html
到了這里,關于video層級過高,以及界面使用多個video時,在安卓APP上同時播放的問題(uniapp)的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!