seek生效
This commit is contained in:
@@ -52,21 +52,6 @@
|
|||||||
@tap="renderScript.changeVideoScreen"></div>
|
@tap="renderScript.changeVideoScreen"></div>
|
||||||
</div>
|
</div>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view style="width: 100%; height: 200px; position: relative" v-else>
|
|
||||||
<video
|
|
||||||
@timeupdate="videoTimeUpdateEvent($event)"
|
|
||||||
ref="videos"
|
|
||||||
style="width: 100%; height: 100%"
|
|
||||||
autoplay
|
|
||||||
id="videoId"
|
|
||||||
object-fit="contain"
|
|
||||||
class="video-box"
|
|
||||||
:src="videoUrl"
|
|
||||||
:poster="`${videoUrl}?x-oss-process=video/snapshot,t_${1},f_jpg`"
|
|
||||||
@play="playVideo"
|
|
||||||
>
|
|
||||||
</video>
|
|
||||||
</view> -->
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@@ -77,7 +62,6 @@
|
|||||||
mapMutations
|
mapMutations
|
||||||
} from "vuex";
|
} from "vuex";
|
||||||
|
|
||||||
// importScripts('@/static/aliplayer/aliplayer-min.js')
|
|
||||||
export default {
|
export default {
|
||||||
props: ["currentVideo", "currentVideoList","videoTitle"],
|
props: ["currentVideo", "currentVideoList","videoTitle"],
|
||||||
data() {
|
data() {
|
||||||
@@ -124,8 +108,6 @@
|
|||||||
this.handleEnd();
|
this.handleEnd();
|
||||||
console.log("是否走啦习销毁");
|
console.log("是否走啦习销毁");
|
||||||
clearInterval(this.$store.state.videoTimer);
|
clearInterval(this.$store.state.videoTimer);
|
||||||
// this.timer = null;
|
|
||||||
// store.commit("setLoadingShow", null);
|
|
||||||
plus.screen.lockOrientation("portrait-primary");
|
plus.screen.lockOrientation("portrait-primary");
|
||||||
|
|
||||||
console.log("是否走啦习销毁定时器", this.timer);
|
console.log("是否走啦习销毁定时器", this.timer);
|
||||||
@@ -136,42 +118,14 @@
|
|||||||
});
|
});
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
plus.screen.lockOrientation("portrait-primary"); //锁死屏幕方向为竖屏
|
plus.screen.lockOrientation("portrait-primary"); //锁死屏幕方向为竖屏
|
||||||
|
|
||||||
// plus.screen.lockOrientation("portrait-primary");
|
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
await this.setVideoTime();
|
await this.setVideoTime();
|
||||||
// this.player.dispose();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//第一次加载
|
//第一次加载
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
// console.log(options, "这是传参");
|
|
||||||
// // #ifdef APP-PLUS
|
|
||||||
// setTimeout(() => {
|
|
||||||
// plus.screen.unlockOrientation();
|
|
||||||
// plus.screen.lockOrientation("landscape-primary");
|
|
||||||
// }, 10);
|
|
||||||
// // #endif
|
|
||||||
// // #ifdef APP-PLUS
|
|
||||||
// // plus.screen.lockOrientation("portrait-primary");
|
|
||||||
// // #endif
|
|
||||||
// if (uni.getStorageSync("videoOssList")) {
|
|
||||||
// this.videoList = JSON.parse(uni.getStorageSync("videoOssList"));
|
|
||||||
// }
|
|
||||||
// console.log("this.videoList at line 53:", this.videoList);
|
|
||||||
// this.options = JSON.parse(options.data);
|
|
||||||
// this.videoId = this.options.video;
|
|
||||||
// this.timer = setInterval(() => {
|
|
||||||
// var that = this;
|
|
||||||
// if (this.currentTime) {
|
|
||||||
// that.setVideoTime();
|
|
||||||
// }
|
|
||||||
// }, 2000);
|
|
||||||
// this.$emit("child-event", this.timer);
|
|
||||||
// // this.$once("hook:beforeDestroy", () => {
|
|
||||||
// // clearInterval(this.timer);
|
|
||||||
// // });
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
@@ -179,7 +133,6 @@
|
|||||||
this.show = true;
|
this.show = true;
|
||||||
},
|
},
|
||||||
start() {
|
start() {
|
||||||
// var playerView = this.$refs.playerView;
|
|
||||||
this.$refs.playerView.start();
|
this.$refs.playerView.start();
|
||||||
},
|
},
|
||||||
pause() {
|
pause() {
|
||||||
@@ -205,13 +158,6 @@
|
|||||||
);
|
);
|
||||||
this.isFullScreen = !data.status;
|
this.isFullScreen = !data.status;
|
||||||
this.$emit("changeScreen", this.isFullScreen);
|
this.$emit("changeScreen", this.isFullScreen);
|
||||||
// let fullScreen = e.detail.fullScreen; // 值true为进入全屏,false为退出全屏
|
|
||||||
// if (!fullScreen) {
|
|
||||||
// //退出全屏
|
|
||||||
// this.isFullScreen = false;
|
|
||||||
// } else {
|
|
||||||
// this.isFullScreen = true;
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
// 控制器的显示隐藏
|
// 控制器的显示隐藏
|
||||||
controlChange(e) {
|
controlChange(e) {
|
||||||
@@ -223,16 +169,16 @@
|
|||||||
ctx.exitFullScreen();
|
ctx.exitFullScreen();
|
||||||
},
|
},
|
||||||
// 播放进度改变
|
// 播放进度改变
|
||||||
videoTimeUpdateEvent(e) {
|
// videoTimeUpdateEvent(e) {
|
||||||
this.playTime = parseInt(e.detail.currentTime);
|
// this.playTime = parseInt(e.detail.currentTime);
|
||||||
this.currentTime = parseInt(e.detail.currentTime);
|
// this.currentTime = parseInt(e.detail.currentTime);
|
||||||
|
|
||||||
this.allTime = parseInt(e.detail.duration);
|
// this.allTime = parseInt(e.detail.duration);
|
||||||
|
|
||||||
this.recordTime({
|
// this.recordTime({
|
||||||
time: this.playTime,
|
// time: this.playTime,
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
async init(data, isChange) {
|
async init(data, isChange) {
|
||||||
this.show = false;
|
this.show = false;
|
||||||
this.platform = this.$platform;
|
this.platform = this.$platform;
|
||||||
@@ -246,8 +192,6 @@
|
|||||||
this.videoId = this.options.video;
|
this.videoId = this.options.video;
|
||||||
console.log("这是苹果视屏id", this.videoId);
|
console.log("这是苹果视屏id", this.videoId);
|
||||||
await this.getLive(isChange);
|
await this.getLive(isChange);
|
||||||
// await this.getVideo(isChange);
|
|
||||||
// this.$emit("child-event", this.timer);
|
|
||||||
},
|
},
|
||||||
async getVideo() {
|
async getVideo() {
|
||||||
var data = {};
|
var data = {};
|
||||||
@@ -266,12 +210,6 @@
|
|||||||
console.log(" 视频播放11111111111:", res);
|
console.log(" 视频播放11111111111:", res);
|
||||||
|
|
||||||
var credentials = res.result.credentials;
|
var credentials = res.result.credentials;
|
||||||
// var playerView = this.$refs.playerView;
|
|
||||||
// console.log('playerView at line 273:', playerView)
|
|
||||||
/*
|
|
||||||
STS加密播放
|
|
||||||
|
|
||||||
*/
|
|
||||||
that.$refs.playerView.setVidSts({
|
that.$refs.playerView.setVidSts({
|
||||||
vid: this.videoData.video,
|
vid: this.videoData.video,
|
||||||
accessKeyId: credentials.accessKeyId,
|
accessKeyId: credentials.accessKeyId,
|
||||||
@@ -280,10 +218,6 @@
|
|||||||
expireTime: credentials.expireTime,
|
expireTime: credentials.expireTime,
|
||||||
Region: "cn-shanghai",
|
Region: "cn-shanghai",
|
||||||
});
|
});
|
||||||
// playerView.setLocalSource({
|
|
||||||
// uri: "http://duoduovideo.oss-cn-beijing.aliyuncs.com/5f093c6fb6e90.mp4",
|
|
||||||
// });
|
|
||||||
|
|
||||||
let isFullScreen = true;
|
let isFullScreen = true;
|
||||||
// fixed fullscreen play on android
|
// fixed fullscreen play on android
|
||||||
if (plus.os.name.toLowerCase() === "android") {
|
if (plus.os.name.toLowerCase() === "android") {
|
||||||
@@ -323,8 +257,9 @@
|
|||||||
var list = [];
|
var list = [];
|
||||||
if (uni.getStorageSync("videoOssList")) {
|
if (uni.getStorageSync("videoOssList")) {
|
||||||
list = JSON.parse(uni.getStorageSync("videoOssList"));
|
list = JSON.parse(uni.getStorageSync("videoOssList"));
|
||||||
var index = list.findIndex((e) => e.id == data.id);
|
|
||||||
|
|
||||||
|
var index = list.findIndex((e) => e.id == data.id);
|
||||||
|
console.log('data.id',data.id);
|
||||||
if (netWork) {
|
if (netWork) {
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
this.firstTime =
|
this.firstTime =
|
||||||
@@ -345,28 +280,21 @@
|
|||||||
|
|
||||||
this.videoData = {
|
this.videoData = {
|
||||||
...data,
|
...data,
|
||||||
|
firstTime : this.firstTime
|
||||||
};
|
};
|
||||||
this.isChange = isChange ? isChange : false;
|
this.isChange = isChange ? isChange : false;
|
||||||
// this.currentTime = this.firstTime;
|
|
||||||
console.log(this.firstTime, "这是第一次播放时长222");
|
console.log(this.firstTime, "这是第一次播放时长222");
|
||||||
// await this.setVideoTime();
|
|
||||||
uni.setStorageSync("videoOssList", JSON.stringify(list));
|
uni.setStorageSync("videoOssList", JSON.stringify(list));
|
||||||
|
|
||||||
// if (this.currentVideo.type == 0 || this.currentVideo.type == 2) {
|
|
||||||
// await this.playVideo();
|
|
||||||
// }
|
|
||||||
console.log(this.firstTime, "这是第一次播放时长");
|
console.log(this.firstTime, "这是第一次播放时长");
|
||||||
// await that.getVideo();
|
|
||||||
}
|
}
|
||||||
this.isSetFirstTime = true;
|
this.isSetFirstTime = true;
|
||||||
},
|
},
|
||||||
async playVideo(e) {
|
async playVideo(e) {
|
||||||
this.videoContext = uni.createVideoContext("videoId", this);
|
this.videoContext = uni.createVideoContext("videoId", this);
|
||||||
this.videoContext.seek(this.firstTime);
|
this.videoContext.seek(this.firstTime);
|
||||||
|
|
||||||
// this.videoContext.requestFullScreen();
|
|
||||||
},
|
},
|
||||||
recordTime(data) {
|
recordTime(data) {
|
||||||
|
// console.log('recordTime',data.time);
|
||||||
this.currentTime = data.time;
|
this.currentTime = data.time;
|
||||||
|
|
||||||
var list = [];
|
var list = [];
|
||||||
@@ -375,10 +303,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var index = list.findIndex((e) => e.id == this.videoData.id);
|
var index = list.findIndex((e) => e.id == this.videoData.id);
|
||||||
|
// console.log('recordTime------',index,list );
|
||||||
|
|
||||||
if (list.length > 0 && index >= 0) {
|
if (list.length > 0 && index >= 0) {
|
||||||
list[index] = {
|
list[index] = {
|
||||||
...this.videoData,
|
...this.videoData,
|
||||||
|
|
||||||
time: data.time,
|
time: data.time,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
@@ -430,11 +359,11 @@
|
|||||||
var data = {
|
var data = {
|
||||||
...res.video,
|
...res.video,
|
||||||
};
|
};
|
||||||
console.log("/checkjieguo", data);
|
// console.log("/checkjieguo", data);
|
||||||
// return
|
// return
|
||||||
if (this.currentVideo.type == 1) {
|
if (this.currentVideo.type == 1) {
|
||||||
var playAuth = res.video.playAuth.replace(/=/g, "");
|
var playAuth = res.video.playAuth.replace(/=/g, "");
|
||||||
console.log("这是接口获取的视屏凭证111", playAuth);
|
// console.log("这是接口获取的视屏凭证111", playAuth);
|
||||||
data = {
|
data = {
|
||||||
...data,
|
...data,
|
||||||
videoId: res.video.video,
|
videoId: res.video.video,
|
||||||
@@ -457,13 +386,12 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
async handleEnd() {
|
async handleEnd() {
|
||||||
console.log('进来了吗,handleEnd')
|
// console.log('进来了吗,handleEnd')
|
||||||
console.log("找到了吗????",this.videoData.id);
|
console.log("找到了吗????",this.videoData.id);
|
||||||
// console.log('uni.getStorageSync("videoOssList")',uni.getStorageSync("videoOssList"));
|
var list = JSON.parse(uni.getStorageSync("videoOssList"));
|
||||||
var list = JSON.parse(JSON.stringify(uni.getStorageSync("videoOssList")));
|
|
||||||
|
|
||||||
var data = list.find((e) => e.id == this.videoData.id);
|
var data = list.find((e) => e.id == this.videoData.id);
|
||||||
console.log("找到了吗????");
|
console.log("找到了吗????");
|
||||||
|
// data.time ? this.currentTime = data.time : this.currentTime = 0;
|
||||||
this.currentTime = data.time;
|
this.currentTime = data.time;
|
||||||
console.log(
|
console.log(
|
||||||
"this.currentTime at line 这是结束的时候掉的存储视频:",
|
"this.currentTime at line 这是结束的时候掉的存储视频:",
|
||||||
@@ -472,15 +400,9 @@
|
|||||||
await this.setVideoTime();
|
await this.setVideoTime();
|
||||||
clearInterval(this.$store.state.videoTimer);
|
clearInterval(this.$store.state.videoTimer);
|
||||||
this.timer = null;
|
this.timer = null;
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
setVideoTime(time) {
|
setVideoTime(time) {
|
||||||
var data = {};
|
var data = {};
|
||||||
// var list = uni.getStorageSync("videoOssList");
|
|
||||||
|
|
||||||
// data = list.find((e) => e.id == this.videoData.id);
|
|
||||||
// console.log("这是再走生命周期哦", this.currentTime);
|
|
||||||
console.log("是否走了存储视屏," + this.videoData.id, this.currentTime);
|
console.log("是否走了存储视屏," + this.videoData.id, this.currentTime);
|
||||||
var data = {
|
var data = {
|
||||||
videoId: this.videoData.id,
|
videoId: this.videoData.id,
|
||||||
@@ -502,10 +424,10 @@
|
|||||||
this.$forceUpdate();
|
this.$forceUpdate();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
changePlayerTime(player) {
|
// changePlayerTime(player) {
|
||||||
console.log("this.firstTime at line 106:", this.firstTime);
|
// console.log("this.firstTime at line 106:", this.firstTime);
|
||||||
player.seek(this.firstTime);
|
// player.seek(this.firstTime);
|
||||||
},
|
// },
|
||||||
goBack() {
|
goBack() {
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
delta: 1,
|
delta: 1,
|
||||||
@@ -515,10 +437,6 @@
|
|||||||
async setVideoFirtsetTime(time) {
|
async setVideoFirtsetTime(time) {
|
||||||
this.currentTime = this.firstTime;
|
this.currentTime = this.firstTime;
|
||||||
console.log("这里准备开始设置播放时间:", this.currentTime);
|
console.log("这里准备开始设置播放时间:", this.currentTime);
|
||||||
// await this.setVideoTime();
|
|
||||||
// setTimeout(() => {
|
|
||||||
// clearInterval(this.$store.state.videoTimer);
|
|
||||||
|
|
||||||
store.commit(
|
store.commit(
|
||||||
"setVideoTimer",
|
"setVideoTimer",
|
||||||
setInterval(async () => {
|
setInterval(async () => {
|
||||||
@@ -536,18 +454,9 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script module="renderScript" lang="renderjs">
|
<script module="renderScript" lang="renderjs">
|
||||||
|
var videoData = null
|
||||||
import $ from 'jquery'
|
import $ from 'jquery'
|
||||||
// import StaticADComponent from './staticadcomponent/index.js';
|
|
||||||
/**
|
|
||||||
* 静态广告组件
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
/**
|
|
||||||
* 静态广告组件
|
|
||||||
*/
|
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
// MyComponent
|
// MyComponent
|
||||||
},
|
},
|
||||||
@@ -555,7 +464,6 @@
|
|||||||
// 在适合的生命周期,通过script和link标签引入播放器sdk、css
|
// 在适合的生命周期,通过script和link标签引入播放器sdk、css
|
||||||
console.log(this.options, '这是monted')
|
console.log(this.options, '这是monted')
|
||||||
this.loadWebPlayerSDK()
|
this.loadWebPlayerSDK()
|
||||||
// this.loadComponent()
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -567,11 +475,7 @@
|
|||||||
// currentTime:null,
|
// currentTime:null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
|
|
||||||
|
|
||||||
curTime(val) {
|
curTime(val) {
|
||||||
|
|
||||||
if (this.curTime !== null && this.curStatus !== null) {
|
if (this.curTime !== null && this.curStatus !== null) {
|
||||||
@@ -579,19 +483,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
handleClick(event, ownerInstance) {
|
handleClick(event, ownerInstance) {
|
||||||
console.log('是否了走了点击video事件', event)
|
console.log('是否了走了点击video事件', event)
|
||||||
// this.player.on('ready',function(){
|
|
||||||
// var status= this.player.fullscreenService.getIsFullScreen()
|
|
||||||
// console.log('status at line 403:', status)
|
|
||||||
// console.log('触发点击事件',status))
|
|
||||||
// })
|
|
||||||
|
|
||||||
// ownerInstance.callMethod('getData')
|
|
||||||
|
|
||||||
},
|
},
|
||||||
emitData(event, ownerInstance) {
|
emitData(event, ownerInstance) {
|
||||||
var that = this;
|
var that = this;
|
||||||
@@ -602,42 +496,15 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
async receiveFirstTime(newValue, oldValue, ownerVm, vm) {
|
async receiveFirstTime(newValue, oldValue, ownerVm, vm) {
|
||||||
|
|
||||||
// if (this.player) {
|
|
||||||
// // this.firstTime=newValue;
|
|
||||||
// // console.log('这是初始播放时间111', this.firstTime,this.player)
|
|
||||||
// // await this.player.seek(newValue);
|
|
||||||
// await this.$refs.videoContent4.click()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
async receiveisSetFirstTime(newValue, oldValue, ownerVm, vm) {
|
async receiveisSetFirstTime(newValue, oldValue, ownerVm, vm) {
|
||||||
console.log('是否刚开始设置播放时间', newValue, this.firstTime, this.player);
|
console.log('是否刚开始设置播放时间', newValue, this.firstTime, this.player);
|
||||||
// if (this.player) {
|
|
||||||
// // this.firstTime=newValue;
|
|
||||||
// // await this.player.seek(this.firstTime);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
emitSetData(event, ownerInstance) {
|
emitSetData(event, ownerInstance) {
|
||||||
var that = this;
|
var that = this;
|
||||||
// this.player.seek(this.firstTime)
|
// this.player.seek(this.firstTime)
|
||||||
console.log('是否设置的第一次初始播放', this.firstTime, this.videoData.id);
|
console.log('是否设置的第一次初始播放', this.firstTime, this.videoData.id);
|
||||||
|
|
||||||
|
|
||||||
ownerInstance.callMethod('setVideoFirtsetTime')
|
ownerInstance.callMethod('setVideoFirtsetTime')
|
||||||
|
|
||||||
},
|
},
|
||||||
@@ -648,77 +515,38 @@
|
|||||||
var that = this;
|
var that = this;
|
||||||
// this.$emit('changeScreenLoading',true)
|
// this.$emit('changeScreenLoading',true)
|
||||||
var status = this.player.fullscreenService.getIsFullScreen();
|
var status = this.player.fullscreenService.getIsFullScreen();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ownerInstance.callMethod('screenChange', {
|
ownerInstance.callMethod('screenChange', {
|
||||||
status: status,
|
status: status,
|
||||||
primary: status ? 'portrait' : 'landscape'
|
primary: status ? 'portrait' : 'landscape'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
if (status) {
|
if (status) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
plus.screen.lockOrientation("portrait-primary"); //锁死屏幕方向为竖屏
|
plus.screen.lockOrientation("portrait-primary"); //锁死屏幕方向为竖屏
|
||||||
this.player.fullscreenService.cancelFullScreen();
|
this.player.fullscreenService.cancelFullScreen();
|
||||||
// this.$emit('changeScreenLoading',false);
|
|
||||||
|
|
||||||
|
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
|
|
||||||
// this.player.setPlayerSize('100%','200px');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// this.player.setPlayerSize({
|
|
||||||
// w:"400px",
|
|
||||||
// height:'60%'
|
|
||||||
// });
|
|
||||||
// plus.screen.unlockOrientation();
|
|
||||||
this.player.fullscreenService.requestFullScreen();
|
this.player.fullscreenService.requestFullScreen();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// this.$emit('changeScreenLoading',false);
|
|
||||||
plus.screen.lockOrientation("landscape-primary");
|
plus.screen.lockOrientation("landscape-primary");
|
||||||
|
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeVideoData(event, ownerInstance) {
|
changeVideoData(event, ownerInstance) {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
ownerInstance.callMethod('changeVideoData', )
|
ownerInstance.callMethod('changeVideoData', )
|
||||||
},
|
},
|
||||||
endEmitData(event, ownerInstance) {
|
endEmitData(event, ownerInstance) {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
ownerInstance.callMethod('handleEnd', )
|
ownerInstance.callMethod('handleEnd', )
|
||||||
},
|
},
|
||||||
getLive() {
|
getLive() {
|
||||||
console.log('这是这只只是666666:', this.firstTime, this.videoData)
|
console.log('这是这只只是666666:', this.firstTime, this.videoData)
|
||||||
|
|
||||||
if (this.player) {
|
if (this.player) {
|
||||||
|
|
||||||
this.player.dispose();
|
this.player.dispose();
|
||||||
$('#url-player-test').empty();
|
$('#url-player-test').empty();
|
||||||
this.player = null;
|
this.player = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var fullScreenButtonComponent = Aliplayer.Component({
|
var fullScreenButtonComponent = Aliplayer.Component({
|
||||||
/**
|
/**
|
||||||
* 初始函数,在new对象时调用
|
* 初始函数,在new对象时调用
|
||||||
@@ -729,9 +557,6 @@
|
|||||||
init: function(status, toAddress) {
|
init: function(status, toAddress) {
|
||||||
|
|
||||||
this.fullScreenStatus = status
|
this.fullScreenStatus = status
|
||||||
// this.adAddress = adAddress;
|
|
||||||
// this.toAddress = toAddress;
|
|
||||||
|
|
||||||
this.$html = $('.fullScreenButton-container');
|
this.$html = $('.fullScreenButton-container');
|
||||||
// this.$html.hide();
|
// this.$html.hide();
|
||||||
},
|
},
|
||||||
@@ -740,18 +565,12 @@
|
|||||||
* 创建广告Dom元素
|
* 创建广告Dom元素
|
||||||
*/
|
*/
|
||||||
createEl: function(el) {
|
createEl: function(el) {
|
||||||
|
|
||||||
|
|
||||||
this.$html.find('.ad').attr('src', this.adAddress);
|
this.$html.find('.ad').attr('src', this.adAddress);
|
||||||
var $adWrapper = this.$html.find('.ad-wrapper');
|
var $adWrapper = this.$html.find('.ad-wrapper');
|
||||||
$adWrapper.attr('href', this.toAddress);
|
$adWrapper.attr('href', this.toAddress);
|
||||||
$adWrapper.click(function() {
|
$adWrapper.click(function() {
|
||||||
// Aliplayer.util.stopPropagation();
|
|
||||||
});
|
});
|
||||||
// this.$html.find('.close').click(function () {
|
|
||||||
// this.$html.hide();
|
|
||||||
// });
|
|
||||||
// $(el).find('.prism-controlbar').append(this.$html);
|
|
||||||
$(el).find('.prism-time-display').after(this.$html);
|
$(el).find('.prism-time-display').after(this.$html);
|
||||||
},
|
},
|
||||||
ready: function(player, e) {
|
ready: function(player, e) {
|
||||||
@@ -777,6 +596,7 @@
|
|||||||
// this.$html.hide();
|
// this.$html.hide();
|
||||||
},
|
},
|
||||||
waiting: function(player, e) {
|
waiting: function(player, e) {
|
||||||
|
|
||||||
// this.$html.hide()
|
// this.$html.hide()
|
||||||
},
|
},
|
||||||
timeupdate: function(player, e) {},
|
timeupdate: function(player, e) {},
|
||||||
@@ -785,20 +605,14 @@
|
|||||||
* 显示广告
|
* 显示广告
|
||||||
*/
|
*/
|
||||||
ended: function(player, e) {
|
ended: function(player, e) {
|
||||||
// this.$html.show();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
console.log('这是查看是否获取到hlstoken', this.videoData)
|
||||||
console.log('这是查看是否获取到hlstoken', this.videoData.mtsHlsUriToken, this.videoData)
|
|
||||||
|
|
||||||
|
|
||||||
var playerOptions = {
|
var playerOptions = {
|
||||||
id: "url-player-test",
|
id: "url-player-test",
|
||||||
width: '100%', //容器的大小
|
width: '100%', //容器的大小
|
||||||
height: '100%', //容器的大小
|
height: '100%', //容器的大小
|
||||||
"qualitySort": "asc",
|
"qualitySort": "asc",
|
||||||
// "format": "m3u8",
|
|
||||||
// "mediaType": "video",
|
|
||||||
"cover": "",
|
"cover": "",
|
||||||
"autoplay": true,
|
"autoplay": true,
|
||||||
"isLive": false,
|
"isLive": false,
|
||||||
@@ -806,18 +620,7 @@
|
|||||||
"playsinline": true,
|
"playsinline": true,
|
||||||
"controlBarVisibility": "hover",
|
"controlBarVisibility": "hover",
|
||||||
"useH5Prism": true,
|
"useH5Prism": true,
|
||||||
// cover: "",
|
|
||||||
components: [
|
components: [
|
||||||
// {
|
|
||||||
// name: 'BulletScreenComponent',
|
|
||||||
// type: AliPlayerComponent.BulletScreenComponent,
|
|
||||||
// /** Descriptions of the scrolling text component parameters: text, style, bulletPosition
|
|
||||||
// * text: The scrolling text
|
|
||||||
// * style: The style of the scrolling text
|
|
||||||
// * bulletPosition: The position of the scrolling text. Valid values: 'top', 'bottom', and 'random'. The default is 'random'.
|
|
||||||
// */
|
|
||||||
// args: ['http://101.201.146.165:8088/Pf-EH/statics/uploadFile/2024-05-10/b0f420c7-9178-41ad-9dd6-f59a64a6e190.png']
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
name: 'adComponent',
|
name: 'adComponent',
|
||||||
type: fullScreenButtonComponent,
|
type: fullScreenButtonComponent,
|
||||||
@@ -830,13 +633,6 @@
|
|||||||
type: AliPlayerComponent.RateComponent
|
type: AliPlayerComponent.RateComponent
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// {
|
|
||||||
// name: 'RotateMirrorComponent',
|
|
||||||
// type: AliPlayerComponent.RotateMirrorComponent
|
|
||||||
// },
|
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
skinLayout: [{
|
skinLayout: [{
|
||||||
@@ -890,14 +686,6 @@
|
|||||||
x: 10,
|
x: 10,
|
||||||
y: 7
|
y: 7
|
||||||
},
|
},
|
||||||
// {name: "fullScreenButton", align: "tr", x: 10, y: 12},
|
|
||||||
// {name:"subtitle", align:"tr",x:15, y:12},
|
|
||||||
// {
|
|
||||||
// name: "setting",
|
|
||||||
// align: "tr",
|
|
||||||
// x: 15,
|
|
||||||
// y: 12
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
name: "prism-speed-selector",
|
name: "prism-speed-selector",
|
||||||
align: "tr",
|
align: "tr",
|
||||||
@@ -955,54 +743,19 @@
|
|||||||
var player = new Aliplayer(playerOptions, function(player) {});
|
var player = new Aliplayer(playerOptions, function(player) {});
|
||||||
this.player = player;
|
this.player = player;
|
||||||
console.log('是否拿到第一次初始值呢', this.platform, typeof this.firstTime, this.firstTime)
|
console.log('是否拿到第一次初始值呢', this.platform, typeof this.firstTime, this.firstTime)
|
||||||
if (this.platform == 'ios') {
|
// if (this.platform == 'ios') {
|
||||||
|
|
||||||
this.player.one('timeupdate', () => {
|
|
||||||
this.player.seek(this.firstTime);
|
|
||||||
})
|
|
||||||
|
|
||||||
player.on('canplay', function() {
|
|
||||||
console.log('这是ios数据缓冲初次设置播放位置判断!!!!')
|
|
||||||
this.player.seek(this.firstTime);
|
|
||||||
})
|
|
||||||
// var seeked = false;
|
|
||||||
// player.on('loadedmetadata',function (e) {
|
|
||||||
// if(!seeked)
|
|
||||||
// {
|
|
||||||
// seeked = true;
|
|
||||||
// this.player.seek(20);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// player.on('waiting',function(){
|
|
||||||
// console.log('这是ios数据缓冲初次设置播放位置判断!!!!')
|
|
||||||
// setTimeout(()=>{
|
|
||||||
// player.seek(this.firstTime)
|
|
||||||
// },500)
|
|
||||||
|
|
||||||
|
// this.player.one('timeupdate', () => {
|
||||||
|
// this.player.seek(this.firstTime);
|
||||||
// })
|
// })
|
||||||
} else {
|
|
||||||
// if(player){
|
// } else {
|
||||||
this.player.seek(this.firstTime)
|
// // if(player){
|
||||||
|
// this.player.seek(this.firstTime)
|
||||||
|
// // }
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// var seeked = false;
|
|
||||||
// this.player.on('loadedmetadata',function (e) {
|
|
||||||
// if(!seeked)
|
|
||||||
// {
|
|
||||||
// seeked = true;
|
|
||||||
// player.seek(this.firstTime);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
clearInterval(this.videoTimer);
|
clearInterval(this.videoTimer);
|
||||||
|
|
||||||
this.videoTimer = null;
|
this.videoTimer = null;
|
||||||
@@ -1015,39 +768,20 @@
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
this.$refs.videoContent4.click()
|
this.$refs.videoContent4.click()
|
||||||
player.on('ready', function() {
|
player.on('ready', function() {
|
||||||
|
|
||||||
// player.fullscreenService.requestFullScreen()
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
player.one('canplay', function() {
|
||||||
// this.
|
console.log('这是ios数据缓冲初次设置播放位置判断!!!!',videoData)
|
||||||
|
// player.seek(20);
|
||||||
|
player.seek(videoData.firstTime);
|
||||||
// this.$refs.videoContent.click()
|
})
|
||||||
|
this.player.on('playing', function() {
|
||||||
|
console.log('正在播放')
|
||||||
|
})
|
||||||
this.player.on('ended', function() {
|
this.player.on('ended', function() {
|
||||||
// console.log('that.curTime at line 242:', this.curTime)
|
// console.log('that.curTime at line 242:', this.curTime)
|
||||||
// console.log('that.curStatus at line 210:', this.curStatus)
|
// console.log('that.curStatus at line 210:', this.curStatus)
|
||||||
this.$refs.videoContent2.click()
|
this.$refs.videoContent2.click()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// player.setRotate(90)
|
|
||||||
|
|
||||||
//全屏播放
|
|
||||||
|
|
||||||
// player.one('canplay', function() {
|
|
||||||
// // console.log('canplay', this.player.tag);
|
|
||||||
// player.tag.play();
|
|
||||||
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
showPreview(e) {
|
showPreview(e) {
|
||||||
// console.log('e at line 56:', e)
|
// console.log('e at line 56:', e)
|
||||||
@@ -1064,12 +798,6 @@
|
|||||||
}
|
}
|
||||||
console.log('imgList.push at line 64:', imgList)
|
console.log('imgList.push at line 64:', imgList)
|
||||||
|
|
||||||
|
|
||||||
//最后一步就是所有图片放在预览的方法previewImage中就可以了
|
|
||||||
// uni.previewImage({
|
|
||||||
// current: imgList,
|
|
||||||
// urls: imgList,
|
|
||||||
// })
|
|
||||||
uni.previewImage({
|
uni.previewImage({
|
||||||
urls: imgList,
|
urls: imgList,
|
||||||
longPressActions: {
|
longPressActions: {
|
||||||
@@ -1081,10 +809,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
receiveScreenType(newValue) {
|
receiveScreenType(newValue) {
|
||||||
// console.log('newValue at line 427屏幕方向111111111111:', newValue)
|
|
||||||
|
|
||||||
},
|
},
|
||||||
async receiveIsfresh(newValue) {
|
async receiveIsfresh(newValue) {
|
||||||
|
|
||||||
@@ -1093,77 +818,31 @@
|
|||||||
clearInterval(this.$store.state.videoTimer)
|
clearInterval(this.$store.state.videoTimer)
|
||||||
// await this.setVideoTime();
|
// await this.setVideoTime();
|
||||||
this.player.dispose();
|
this.player.dispose();
|
||||||
// $('#url-player-test').empty()
|
|
||||||
|
|
||||||
// this.player.seek(newValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
async receiveplatform(newValue) {
|
async receiveplatform(newValue) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
async receiveIsChange(newValue) {
|
async receiveIsChange(newValue) {
|
||||||
|
|
||||||
|
|
||||||
// this.timer=null
|
|
||||||
|
|
||||||
if (this.isChange) {
|
if (this.isChange) {
|
||||||
|
|
||||||
this.checkValue()
|
this.checkValue()
|
||||||
|
|
||||||
// if (this.videoData.type == 1) {
|
|
||||||
// console.log('是否走了切换加密视频方法:', this.isChange, this.videoData)
|
|
||||||
// await this.player.replayByVidAndPlayAuth(this.videoData.video, this.videoData.playAuth)
|
|
||||||
// this.$refs.videoContent.click()
|
|
||||||
// } else {
|
|
||||||
// console.log('是否走了切换老视频/音频方法:', this.isChange, this.videoData)
|
|
||||||
// await this.player.loadByUrl(this.videoData.videoUrl)
|
|
||||||
// this.$refs.videoContent.click()
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// this.$refs.videoContent3.click()
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
receiveVideoList(newValue, oldValue, ownerVm, vm) {
|
receiveVideoList(newValue, oldValue, ownerVm, vm) {
|
||||||
// //数据变化
|
// //数据变化
|
||||||
|
|
||||||
console.log('currentVideoListcurrentVideoListcurrentVideoList', newValue)
|
console.log('currentVideoListcurrentVideoListcurrentVideoList', newValue)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
receiveMsg(newValue, oldValue, ownerVm, vm) {
|
receiveMsg(newValue, oldValue, ownerVm, vm) {
|
||||||
//数据变化
|
//数据变化
|
||||||
// console.log('newValue', newValue)
|
videoData = newValue
|
||||||
// console.log('oldValue', oldValue)
|
|
||||||
// console.log('ownerVm', ownerVm)
|
|
||||||
// console.log('vm', vm)
|
|
||||||
},
|
},
|
||||||
receiveWinWidth(newValue, oldValue, ownerVm, vm) {
|
receiveWinWidth(newValue, oldValue, ownerVm, vm) {
|
||||||
//数据变化
|
//数据变化
|
||||||
console.log('newValue', newValue)
|
console.log('newValue', newValue)
|
||||||
// console.log('oldValue', oldValue)
|
|
||||||
// console.log('ownerVm', ownerVm)
|
|
||||||
// console.log('vm', vm)
|
|
||||||
},
|
},
|
||||||
receiveWinHeight(newValue, oldValue, ownerVm, vm) {
|
receiveWinHeight(newValue, oldValue, ownerVm, vm) {
|
||||||
//数据变化
|
//数据变化
|
||||||
console.log('newValue', newValue)
|
console.log('newValue', newValue)
|
||||||
// console.log('oldValue', oldValue)
|
|
||||||
// console.log('ownerVm', ownerVm)
|
|
||||||
// console.log('vm', vm)
|
|
||||||
},
|
},
|
||||||
checkValue() {
|
checkValue() {
|
||||||
console.log(this.videoId, this.authId, this.videoData, "1111888888")
|
console.log(this.videoId, this.authId, this.videoData, "1111888888")
|
||||||
@@ -1179,9 +858,6 @@
|
|||||||
},
|
},
|
||||||
loadWebPlayerSDK() {
|
loadWebPlayerSDK() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const s_tag = document.createElement('script'); // 引入播放器js
|
const s_tag = document.createElement('script'); // 引入播放器js
|
||||||
s_tag.type = 'text/javascript';
|
s_tag.type = 'text/javascript';
|
||||||
s_tag.src = 'https://g.alicdn.com/apsara-media-box/imp-web-player/2.20.3/aliplayer-min.js';
|
s_tag.src = 'https://g.alicdn.com/apsara-media-box/imp-web-player/2.20.3/aliplayer-min.js';
|
||||||
@@ -1195,38 +871,18 @@
|
|||||||
s_tag1.onload = () => {
|
s_tag1.onload = () => {
|
||||||
this.checkValue();
|
this.checkValue();
|
||||||
resolve();
|
resolve();
|
||||||
|
|
||||||
}
|
}
|
||||||
document.body.appendChild(s_tag1);
|
document.body.appendChild(s_tag1);
|
||||||
|
|
||||||
}
|
}
|
||||||
document.body.appendChild(s_tag);
|
document.body.appendChild(s_tag);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const l_tag = document.createElement('link'); // 引入播放器css
|
const l_tag = document.createElement('link'); // 引入播放器css
|
||||||
l_tag.rel = 'stylesheet';
|
l_tag.rel = 'stylesheet';
|
||||||
l_tag.href =
|
l_tag.href =
|
||||||
'https://g.alicdn.com/apsara-media-box/imp-web-player/2.20.3/skins/default/aliplayer-min.css';
|
'https://g.alicdn.com/apsara-media-box/imp-web-player/2.20.3/skins/default/aliplayer-min.css';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
document.body.appendChild(l_tag);
|
document.body.appendChild(l_tag);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
loadComponent() {
|
loadComponent() {
|
||||||
// return new Promise((resolve, reject) => {
|
|
||||||
// const s_tag = document.createElement('script');
|
|
||||||
// s_tag.type = 'text/javascript';
|
|
||||||
// // 需要先下载组件 js 文件,放到项目 /static/ 目录下
|
|
||||||
// // 下载地址:https://github.com/aliyunvideo/AliyunPlayer_Web/blob/master/customComponents/dist/aliplayer-components/aliplayercomponents-1.0.9.min.js
|
|
||||||
// s_tag.src = '@/static/aliplayercomponents.js';
|
|
||||||
// s_tag.charset = 'utf-8';
|
|
||||||
// s_tag.onload = () => {
|
|
||||||
// resolve();
|
|
||||||
// }
|
|
||||||
// document.body.appendChild(s_tag);
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user