首页 > 其他分享 >4.20

4.20

时间:2024-06-05 22:23:00浏览次数:8  
标签:index play height current width video 4.20

开始制作有关视频播放的内容

<template>
<view>

<swiper class="swiper" autoplay="false" vertical="true" interval="990000" @change="changeVideo">
<swiper-item v-for="(item,index) in video_list">

<video
:src="item.video_url"
preload
show-play-btn="true"
controls="false"
v
loop="true"
:id="`video_${item.video_id}`"
objectFit="fill"
:enable-progress-gesture="false"
@click="clickVideo"
ref="video_url"
play-btn-position="center"
class="video"
:poster="item.cover_url"
@timeupdate="timeupdate">
</video>

<cover-image
class="play" v-if="show_play"
@tap="videoPlay"
src="/static/video/play_1.png"></cover-image>

<cover-view class="cover-view-left">
<text class="view-left-text">@{{ item.nickname }}</text>
<view class="view-left-text-content">
<text class="text-content-text">{{ item.video_describe }}</text>
</view>
</cover-view>

<cover-view class="cover-view-right">
<cover-image :src="item.cover_url"
class="avater img"
@click.stop="tapAvater"></cover-image>

<text class="right-follow">+</text>
<cover-image
style="position:relative;top:-20upx;"
:src="item.is_dianzan ? '/static/video/axc.png' : '/static/video/bed.png'"
class="img-left" @click.stop="tapLove"></cover-image>

<text class="right-text">{{ item.dianzan }}</text>
<cover-image src="/static/video/ay2.png"
style="height: 80upx;" class="img-left" @click.stop="tapMsg"></cover-image>

<text class="right-text">{{ item.pinglun }}</text>
<cover-image src="/static/video/b6p.png"
style="height: 76upx;" class="img-left" @click.stop="tapShare"></cover-image>

<text class="right-text">{{ item.zhuanfa }}</text>
<cover-image src="/static/video/changpian.png" class="musicIcon img">
</cover-image>

<cover-view class="progressBar" :animation="animationData" ></cover-view>


</cover-view>

 

 

</swiper-item>
</swiper>

</view>
</template>
<script>
let play = false;
export default {
props: {
video_list: {
type: Array,
default: {}
}
},
data() {
return {
time: 0,
barWidth:0,
animationData: {},
times:null,
play: false,
show_play:false,
current_index: 0
};
},
created() {
setTimeout(()=>{
play = true;
this.videoPlay();
},1000)
},
methods: {
timeupdate(event) {
let t_w = parseInt(this.width);
this.duration = event.detail.duration;
this.time = event.detail.currentTime;
let width = (this.time / this.duration) * t_w;
let w = 0;
},
clickVideo() {
// console.log('单视频点击事件');
this.videoPlay();
},
videoPlay() {
let video_id = this.video_list[this.current_index].video_id;

if (play) {
console.log('播放视频',`video_${video_id}`);
this.videoCtx = uni.createVideoContext(`video_${video_id}`, this);
this.videoCtx.play();
this.show_play = false;
play = false;
} else {
console.log('暂停视频',`video_${video_id}`);
this.videoCtx = uni.createVideoContext(`video_${video_id}`, this);
this.videoCtx.pause();
this.show_play = true;
play = true;
}
},
videoPause() {
let video_id = this.video_list[this.current_index].video_id;
this.videoCtx = uni.createVideoContext(`video_${video_id}`, this);
this.videoCtx.pause();
this.show_play = true;
play = true;
},
changeVideo(e){

// 暂停之前的视频
this.videoPause();
this.current_index = e.detail.current;
console.log(e.detail.current);
// 播放现在的视频
this.videoPlay();

// 判断是否第一条
if( e.detail.current == 0 ){
console.log('到顶了');
return false;
}

// 判断是否最后一条
if( e.detail.current == this.video_list.length-1 ){
console.log('到底了');
return false;
}

},
tapMsg(e) {
console.log(5, e);
},
tapShare(e) {
console.log(6, e);
},
tapLove(e) {
// item.is_dianzan
this.video_list[this.current_index].is_dianzan = !this.video_list[this.current_index].is_dianzan;
console.log(7, e);
}

},
watch: {
play(newVal, oldVal) {
this.videoPlay();
}
}
};
</script>

<style>
.swiper{
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
}
.video {
width: 100%;
height: 100%;
position: relative;
}
.play{
position: absolute;
width: 20vw;
height: 20vw;
left: 40vw;
top: 40vh;
opacity: 0.5;
}
.progressBar {
border-radius: 2upx;
height: 4upx;
background-color: #FF4500;
z-index: 999999;
position: absolute;
bottom: 68rpx;
}

.cover-view-left {
position: absolute;
margin-left: 20upx;
width: 580upx;
bottom: 110upx;
z-index: 9999;
font-size: 14px;
color: #ffffff;
}
.left-text {
font-size: 14px;
color: #ffffff;
}

.cover-view-right {
position: absolute;
bottom: 40px;
right: 30upx;
z-index: 9999;
text-align: center;
}

.avater {
border-radius: 50%;
border-width: 2px;
border-style: solid;
border-color: #ffffff;
}

.img {
height: 90upx;
width: 90upx;
margin-bottom: 110upx;
}

.img-left {
width: 80upx;
height: 66upx;
padding-left: 4px;
}
.right-follow {
position: absolute;
z-index: 100;
top: 75upx;
left: 28upx;
color: #ffffff;
font-size: 16px;
width: 34upx;
height: 34upx;
background-color: #f12f5b;
text-align: center;
line-height: 34upx;
border-radius: 17upx;
}

.right-text {
color: #ffffff;
font-size: 11px;
text-align: center;
margin-bottom: 40upx;
}
.musicIcon {
margin-top: 40upx;
}
@keyframes rotating {
from {
transform: rotate(0);
}
to {
transform: rotate(360deg);
}
}
.view-left-text-content {
flex: 1;
}
.view-left-text {
color: #ffffff;
font-size: 18px;
margin-bottom: 10upx;
font-weight: bold;
}
.text-content-text {
color: #ffffff;
font-size: 16px;
line-height: 50upx;
height: 100upx;
overflow: hidden;
}
</style>

 

标签:index,play,height,current,width,video,4.20
From: https://www.cnblogs.com/Christmas77/p/18234027

相关文章

  • GJOI 2024.4.20 总结
    Morning:T1小鸟Statement:在一个\(n\)的二维平面里,\(X\)轴的正方向是向右的,\(Y\)轴的正方向是向上的。在坐标系第一象限里,左下角的点的坐标是\((0,0)\),右上角的点的坐标是\((n-1,n-1)\)。所以本题我们考虑的整个平面总共有\(n\timesn\)个整点,每个整点都有一只小......
  • 2024.4.20 笔记
    2024.4.20笔记SP4354Snowflakes记录所有的雪花,判断是否存在两个雪花是相同的。由于数据量较大,需要\(O(n)\)的复杂度来查询雪花,考虑哈希表定义一个哈希值的转换方式,让不同的雪花哈希值不相同,相同的雪花的六个角一定是相同的\(6\)个值且相同的顺序排列,只不过起点在不同的角......
  • 算法模板 v1.10.4.20240325
    算法模板v1.1.1.20240115:之前历史版本已不可寻,创建第一份算法模板。v1.2.1.20240116:删除“编译”-“手动开栈”;删除“编译”-“手动开O优化”;修改“编译”-“CF模板”;删除“读写”;删除“图论”-“欧拉图”-“混合图”;删除“图论”-“可达性统计”;删除“数据类型”-“高精类”。......
  • [Mac软件]Boxy SVG 4.20.0 矢量图形编辑器
    BoxySVG是一款入门级矢量图形编辑器,具有全套基本功能、易于学习的选项卡式界面和可自定义的键盘快捷键。有了它,您可以轻松创建横幅、图标、按钮、图形、界面草图,甚至有趣的表情包。编辑器支持使用多种工具创建和编辑矢量对象,用颜色渐变装饰它们,用文本元素补充它们。元数据编辑功......
  • DNGuard 4.11 4.12 4.20等企业旗舰版 安装包下载
    dnguard4.504.404.304.204.124.11企业旗舰版安装包dng加密.net代码混淆代码保护软件加壳企业版很强大,推荐官网购买 DNGuardHVM-.Netobfuscatorandcodeprotectiontool服务过期,忘记版本更新的可以下载,另外也可以尝试使用demo版本加密体验一下dng,dng从4.X版......
  • lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /home/liuj
     glibc是GNU发布的libc库,即c运行库。glibc是linux系统中最底层的api,几乎其它任何运行库都会依赖于glibc。glibc除了封装linux操作系统所提供的系统服务外,它本身也提供了许多其它一些必要功能服务的实现。由于glibc囊括了几乎所有的 UNIX 通行的标准,可以想见其内容包罗万象。而......
  • nvm安装node报错Get "https://nodejs.org/dist/latest/SHASUMS256.txt": dial tcp 104
    windows上通过nvm管理node版本,在本地安装了nvm后,通过nvm安装node,报错了,信息:Couldnotretrievehttps://nodejs.org/dist/latest/SHASUMS256.txt.Gethttps://nodejs.org/dist/latest/SHASUMS256.txt:dialtcp104.20.23.46:443:i/otimeout 有了这样的信息,我......
  • 4.20今日总结
    Pyqt5信号与槽#-*-coding:utf-8-*-#Formimplementationgeneratedfromreadinguifile'signal.ui'##Createdby:PyQt5UIcodegenerator5.11.3##WARNING!Allchangesmadeinthisfilewillbelost!importsysfromPyQt5importQtCore,QtGui,QtW......
  • GLIBCXX_3.4.20 not found 问题解决【Unable to load shared library 'lib**.so'】
    前因:问题:在调用别人的so时,出现了如下问题【GLIBCXX_3.4.20notfound】Unabletoloadsharedlibrary'libdbc.so'oroneofitsdependencies.Inordertohelpdiagnoseloadingproblems,considersettingtheLD_DEBUGenvironmentvariable:/lib64/libstdc++.so.6:v......
  • HomeWork4.20
    负载均衡负载均衡(LoadBalance,简称LB)是高并发、高可用系统必不可少的关键组件,目标是尽力将网络流量平均分发到多个服务器上,以提高系统整体的响应速度和可用性。负载均衡的主要作用如下:高并发:负载均衡通过算法调整负载,尽力均匀的分配应用集群中各节点的工作量,以此提高应用集......