This commit is contained in:
2024-09-09 11:21:05 +08:00
parent 85c2782b8a
commit cebe7d7021
7 changed files with 5686 additions and 5503 deletions

View File

@@ -3,24 +3,24 @@
<view style="width: 100%; height: 200px">
<view v-if="showCountDown" class="showCountDownd" style="">
<view class="">
<text class="nextText">{{secondCountDown}} 秒后播放下一个视频</text><br/>
<view >
<text class="cancelNext" @click="hideNextVideo">取消下一个</text>
<!-- <text class="cancelNext" @click="replayVideo">重新播放</text> -->
<text class="nextText">{{secondCountDown}} 秒后播放下一个视频</text><br />
<view>
<text class="cancelNext" @click="hideNextVideo">取消下一个</text>
<!-- <text class="cancelNext" @click="replayVideo">重新播放</text> -->
</view>
<!-- <view class="cancelNext" @click="hideNextVideo">重新播放</view> -->
</view>
</view>
<view v-if="show"
style="height: 100%;display: flex;align-items:center;justify-content:center;color: #fff;font-size: 38rpx;text-align: center;">
{{errorTxt}}</view>
{{errorTxt}}
</view>
<div class="" v-else style="background-color: #000" ref="videoContent" @tap="renderScript.handleClick"
id="url-player-test" :videoData="videoData" :winWidth="winWidth" :winHeight="winHeight"
:currentVideoList="currentVideoList" :firstTime="firstTime" :isfresh="isfresh" :platform="platform"
:isSetFirstTime="isSetFirstTime" :isChange="isChange" :change:videoData="renderScript.receiveMsg"
:replayVideoFlag="replayVideoFlag"
:change:winWidth="renderScript.receiveWinWidth" :change:winHeight="renderScript.receiveWinHeight"
:change:firstTime="renderScript.receiveFirstTime"
:replayVideoFlag="replayVideoFlag" :change:winWidth="renderScript.receiveWinWidth"
:change:winHeight="renderScript.receiveWinHeight" :change:firstTime="renderScript.receiveFirstTime"
:change:replayVideoFlag="renderScript.receiveReplayVideoFlag"
:change:isSetFirstTime="renderScript.receiveisSetFirstTime"
:change:isfresh="renderScript.receiveIsfresh" :change:platform="renderScript.receiveplatform"
@@ -71,7 +71,7 @@
} from "vuex";
export default {
props: ["currentVideo", "currentVideoList", "videoTitle",'secondCountDown'],
props: ["currentVideo", "currentVideoList", "videoTitle", 'secondCountDown'],
data() {
return {
reaquestFlag: false,
@@ -83,13 +83,13 @@
isChange: false,
isControl: true,
timer: null,
replayVideoFlag:false,
replayVideoFlag: false,
// secondCountDown: 5,
showCountDown: false,
playEndBlank:false,
playEndBlank: false,
// videoTitle: "",
videoList: [],
replayVideoLock:false,// 重播操作锁
replayVideoLock: false, // 重播操作锁
firstTime: 0,
options: {},
playAuth: "",
@@ -142,40 +142,42 @@
},
methods: {
replayVideo(){
if(!this.replayVideoFlag){
replayVideo() {
if (!this.replayVideoFlag) {
this.getLive(true, this.currentVideo)
console.log('this.currentVideo',this.currentVideo.id);
this.hideNextVideo()
console.log('this.currentVideo', this.currentVideo.id);
this.hideNextVideo()
this.replayVideoFlag = true
}
},
replayVideoFlagFalse(){
console.log('复原replayVideoFlag',this.replayVideoFlag);
replayVideoFlagFalse() {
console.log('复原replayVideoFlag', this.replayVideoFlag);
this.replayVideoFlag = false
},
UnlockChangeVideo(){
UnlockChangeVideo() {
this.$emit('unlockChangeVideo')
},
hideNextVideo(){
hideNextVideo() {
this.showCountDown = false
this.playEndBlank = false
this.$emit('hideNextVideo')
},
loadNextVideo() {
loadNextVideo() {
this.playEndBlank = true
var _list = [...this.currentVideoList]
_list = _list.map(item => { return item.id})
var thisIndex = _list.findIndex(item=>{
_list = _list.map(item => {
return item.id
})
var thisIndex = _list.findIndex(item => {
return item == this.currentVideo.id
})
console.log('播放列表',_list,this.currentVideo.id, thisIndex);
if(thisIndex < this.currentVideoList.length-1){
console.log('播放列表', _list, this.currentVideo.id, thisIndex);
if (thisIndex < this.currentVideoList.length - 1) {
this.showCountDown = true
this.$emit('startNextVideoCountDown')
}
},
openShow(data) {
@@ -233,7 +235,7 @@
this.videoId = this.options.video;
console.log("这是苹果视屏id", this.videoId);
await this.getLive(isChange,this.options);
await this.getLive(isChange, this.options);
},
// 配置播放项
async getData(data, isChange) {
@@ -303,7 +305,7 @@
},
// 获取播放凭证
async getLive(isChange, newVideoData) {
console.log('获取播放凭证',newVideoData.id);
console.log('获取播放凭证11111111111111', newVideoData);
if (this.reaquestFlag) {
uni.showToast({
title: '操作太快了,歇一下吧',
@@ -332,7 +334,7 @@
},
})
.then(async (res) => {
this.reaquestFlag = false
if (this.$platform == 'ios') {
if (this.currentVideo.type == 1 && res.video.m3u8Url == null || this.currentVideo
@@ -451,7 +453,7 @@
var curStatus = null
var diff = 0
var pauseTime = 0
var myplayer = undefined
var myplayer = undefined
import $ from 'jquery'
export default {
components: {
@@ -481,7 +483,7 @@
},
methods: {
handleClick(event, ownerInstance) {
console.log('是否了走了点击video事件', event)
console.log('是否了走了点击video事件', event)
},
emitData(event, ownerInstance) {
var that = this;
@@ -492,24 +494,24 @@
},
receiveReplayVideoFlag(newValue, oldValue, ownerVm, vm) {
console.log('newValue重新播放',newValue,myplayer);
console.log('newValue重新播放', newValue, myplayer);
ReplayVideoFlag = newValue
if(newValue){
if (newValue) {
$('.videoContent8').click()
// ReplayVideoFlag = newValue
// // myplayer.replay()
// $('.videoContent7').click()
// myplayer.seek(0)
// // myplayer.replay()
// $('.videoContent7').click()
// myplayer.seek(0)
// myplayer.play()
}
},
emitReplayVideoFlagFalse(event, ownerInstance) {
ownerInstance.callMethod('replayVideoFlagFalse')
ownerInstance.callMethod('replayVideoFlagFalse')
},
emitUnlockChangeVideo(event, ownerInstance) {
ownerInstance.callMethod('UnlockChangeVideo')
ownerInstance.callMethod('UnlockChangeVideo')
},
async receiveFirstTime(newValue, oldValue, ownerVm, vm) {
@@ -576,10 +578,10 @@
},
// renderjs阿里云播放器引入与配置
getLive() {
console.log('这是这只只是666666:', this.firstTime, this.videoData)
$('#url-player-test').empty();
console.log('这是这只只是666666:', this.firstTime, this.videoData)
$('#url-player-test').empty();
pauseTime = 0
var fullScreenButtonComponent = Aliplayer.Component({
/**
@@ -614,7 +616,7 @@
this.$html.show();
// this.$html.hide();
},
});
// console.log('这是查看是否获取到hlstoken', this.videoData)
var playerOptions = {
@@ -760,9 +762,9 @@
$('.videoContent9').click()
})
player.on('play', function() {
console.log('开始播放------');
console.log('开始播放------');
$('.videoContent7').click()
if(pauseTime > 0){
if (pauseTime > 0) {
player.seek(pauseTime);
}
})
@@ -772,21 +774,21 @@
// if(ReplayVideoFlag){
// player.seek(0);
// }else{
var videoDurationTimes = parseInt(player.getDuration())
// var firstTime = parseInt(player.getCurrentTime())
console.log('视频总长度',parseInt(player.getDuration()),parseInt(player.getCurrentTime()));
if(videoData.firstTime < videoDurationTimes){
var videoDurationTimes = parseInt(player.getDuration())
// var firstTime = parseInt(player.getCurrentTime())
console.log('视频总长度', parseInt(player.getDuration()), parseInt(player.getCurrentTime()));
if (videoData.firstTime < videoDurationTimes) {
player.seek(videoData.firstTime);
}else{
player.seek(0);
}
} else {
player.seek(0);
}
//}
})
myplayer.on('playing', function() {
console.log('正在播放...')
})
myplayer.on('timeupdate', function() {
let that = this
var _time = parseInt(player.getCurrentTime())
@@ -808,12 +810,12 @@
$('.videoContent2').click()
$('.videoContent6').click()
})
player.on('pause', function() {
player.on('pause', function() {
pauseTime = parseInt(player.getCurrentTime())
player.pause(true)
console.log('触发暂停', pauseTime)
console.log('触发暂停', pauseTime)
})
myplayer.on('error', function() {
console.log('播放出错')
$('.videoContent5').click()
@@ -873,8 +875,8 @@
//数据变化
videoData = newValue
if (videoData) {
return
console.log('切换后的播放数据videoData',videoData.type);
return
console.log('切换后的播放数据videoData', videoData.type);
if (videoData.type == 1) {
if (videoData.m3u8Url != '' && videoData.m3u8Url != null) {
// myplayer.source(videoData.m3u8Url)
@@ -942,29 +944,40 @@
}
</script>
<style>
.cancelNext{display: inline-block; margin-right: 20rpx;
border-radius: 10rpx; margin-top: 10rpx;
padding: 10rpx 20rpx !important; background-color: #fff !important;
color: #000; text-align: center; line-height: 50rpx;}
.cancelNext {
display: inline-block;
margin-right: 20rpx;
border-radius: 10rpx;
margin-top: 10rpx;
padding: 10rpx 20rpx !important;
background-color: #fff !important;
color: #000;
text-align: center;
line-height: 50rpx;
}
/* .cancelNext:last-child{margin-left: 10rpx;} */
.nextText{}
.showCountDownd {
box-sizing: border-box;
height: 100%; width: 100%; background-color: rgba(0, 0, 0, 0.6);
.nextText {}
.showCountDownd {
box-sizing: border-box;
height: 100%;
width: 100%;
background-color: rgba(0, 0, 0, 0.6);
display: flex;
align-items: center;
justify-content:flex-end;
justify-content: flex-end;
color: #fff;
font-size: 38rpx;
text-align: center;
position: absolute;
top: 0; right: 10rpx;
top: 0;
right: 10rpx;
z-index: 4;
text{
}
text {}
}
.container {