• uniapp中video播放视频上按钮没显示的问题


    video标签层级很高,尝试了添加z-index,但无效果
    通过查阅资料,得知cover-view层级比video层级高

    效果图

    01252253f5d7dc503ee78f2a9177ff8.png

    需求是为了使直播时,可选是原画/流畅

    解决方案

    首先,在pages.json中配置右上角的图标

    {
    			"path" : "pages/event/live",
    			"style" : {
    				"navigationBarTitleText": "直播详情",
    				"navigationBarTextStyle":"white",
    				"disableScroll": true,
    				"app-plus":{
    					"titleNView":{
    						"backgroundColor":"#010001",
    						"buttons":[{
    							"fontSrc": "/static/iconfontapp.ttf",
    							"text": "\ue66f",
    							"fontSize": "22px",
    							"color": "#FFFFFF"
    						},{
    							"fontSrc": "/static/iconfontapp.ttf",
    							"text": "\ue60b",
    							"fontSize": "22px",
    							"color": "#FFFFFF"
    						}]
    					}
    				}
    			}
    		},
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24

    然后在需要展示这个按钮的页面,加上操作方法

    <template>
    	<view v-if="liveUrl">
    		<video class="v-video-play"  autoplay
    			:src="liveUrl" controls
    			:show-progress="false">
    			<template v-if="speedShow && range && range.length">
    				<cover-view class="cover-box w100"></cover-view>
    					<cover-view v-for="(item, index) in range" :key="index" @click="selectitem(item.value)" class="sb-txt cf" :class="[{'cred': item.value == rangeValue},`f${index + 1}`]">{{ item.text }}</cover-view>
    			</template>
    		</video>
    	</view>
    </template>
    <script>
    export default {
    	data() {
    		return {
    			rangeValue: 'FD', // 默认流畅
    			range: [], // 画质选项的列表
    			speedShow: false // 是否点击了切换的按钮
    		}
    	},
    	onNavigationBarButtonTap(button) {
    		let _event = this.event
    		if(button.index === 0) {//如果点击的是分享按钮
    			shareWx({
    				title: _event.title,
    				summary: '活动直播 - 墨天轮',
    				href: domain + `/event/live/${_event.id}`,
    				imageUrl: _event.shareImageUrl
    			})
    		} else if (button.index === 1) {//如果点击的是清晰度切换按钮
    			this.speedShow = !this.speedShow
    		}
    	},
    }
    </script>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
  • 相关阅读:
    蓝牙技术|蓝牙在物联网产品上的功能,特别是苹果Find My中的应用
    无心剑英译王建《十五夜望月》
    HTML+CSS大作业 (水果之家10个网页)
    LeetCode每日一题(321. Create Maximum Number)
    使用rust学习基本算法(三)
    networkx学习记录
    RK3568平台开发系列讲解(驱动篇)Linux自带LED子系统驱动实验
    Terraform Chef Puppet
    1.4.23 实验23:小型局域网
    mysql存储过程
  • 原文地址:https://blog.csdn.net/weixin_45658814/article/details/132880547