video
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="container" style="background-color: #fff; position: relative">
|
||||
<view class="container" style="background-color: #000; position: relative">
|
||||
<!-- <u-icon
|
||||
@click="goBack"
|
||||
name="arrow-left"
|
||||
@@ -9,29 +9,78 @@
|
||||
statusBarHeight + 2
|
||||
}px; left: ${10}px;z-index: 999;`"
|
||||
></u-icon>-->
|
||||
|
||||
<view style="width: 100%">
|
||||
|
||||
<common-list-aliyun
|
||||
v-if="isSetFirstTime && videoData.playAuth"
|
||||
:encryptType="1"
|
||||
:vid="videoData.video"
|
||||
:playauth="videoData.playAuth"
|
||||
ref="player"
|
||||
:useFlashPrism="false"
|
||||
:autoplay="true"
|
||||
:isLive="false"
|
||||
:showBuffer="true"
|
||||
:cover="cover"
|
||||
:showBarTime="true"
|
||||
:disableSeek="true"
|
||||
showBarTime="500"
|
||||
|
||||
controlBarVisibility="always"
|
||||
<!-- <zhimi_aliplayer_view
|
||||
ref="playerView"
|
||||
style="width: 100%; height: 300px"
|
||||
></zhimi_aliplayer_view>
|
||||
<button type="primary" @click="start()">开始</button>
|
||||
<button type="primary" @click="pause()">暂停</button> -->
|
||||
<view style="width: 100%; height: 200px">
|
||||
<div
|
||||
class=""
|
||||
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"
|
||||
:change:winWidth="renderScript.receiveWinWidth"
|
||||
:change:winHeight="renderScript.receiveWinHeight"
|
||||
:change:firstTime="renderScript.receiveFirstTime"
|
||||
:change:isSetFirstTime="renderScript.receiveisSetFirstTime"
|
||||
:change:isfresh="renderScript.receiveIsfresh"
|
||||
:change:platform="renderScript.receiveplatform"
|
||||
:change:isChange="renderScript.receiveIsChange"
|
||||
:change:currentVideoList="renderScript.receiveVideoList"
|
||||
></div>
|
||||
<div @tap="renderScript.emitData" ref="videoContent1" v-show="false">
|
||||
直接调用renderjs中的emitData的方法,传递当前播放时长
|
||||
</div>
|
||||
|
||||
<div @tap="renderScript.endEmitData" ref="videoContent2" v-show="false">
|
||||
监听结束方法,记录播放时长
|
||||
</div>
|
||||
|
||||
<div
|
||||
@tap="renderScript.changeVideoData"
|
||||
ref="videoContent3"
|
||||
v-show="false"
|
||||
>
|
||||
</common-list-aliyun>
|
||||
|
||||
监听切换视频方法
|
||||
</div>
|
||||
<div @tap="renderScript.emitSetData" ref="videoContent4" v-show="false">
|
||||
监听切换视频方法
|
||||
</div>
|
||||
<div class="fullScreenButton-container">
|
||||
<div
|
||||
:class="`prism-fullscreen-btn ${isFullScreen ? 'fullscreen' : ''}`"
|
||||
@tap="renderScript.changeVideoScreen"
|
||||
></div>
|
||||
</div>
|
||||
</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>
|
||||
</template>
|
||||
<script>
|
||||
@@ -105,9 +154,44 @@ export default {
|
||||
},
|
||||
|
||||
//第一次加载
|
||||
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: {
|
||||
start() {
|
||||
// var playerView = this.$refs.playerView;
|
||||
this.$refs.playerView.start();
|
||||
},
|
||||
pause() {
|
||||
// var playerView = ;
|
||||
this.$refs.playerView.pause();
|
||||
},
|
||||
changeVideoData() {
|
||||
this.isChange = false;
|
||||
},
|
||||
@@ -166,9 +250,70 @@ export default {
|
||||
this.videoId = this.options.video;
|
||||
console.log("这是苹果视屏id", this.videoId);
|
||||
await this.getLive(isChange);
|
||||
// await this.getVideo(isChange);
|
||||
// this.$emit("child-event", this.timer);
|
||||
},
|
||||
async getVideo() {
|
||||
var data = {};
|
||||
var that=this;
|
||||
$http
|
||||
.request({
|
||||
url: `sociology/course/ttt`,
|
||||
method: "Post", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
data,
|
||||
header: {
|
||||
//默认 无 说明:请求头
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then(async (res) => {
|
||||
console.log(" 视频播放11111111111:", res);
|
||||
|
||||
var credentials = res.result.credentials;
|
||||
// var playerView = this.$refs.playerView;
|
||||
// console.log('playerView at line 273:', playerView)
|
||||
/*
|
||||
STS加密播放
|
||||
|
||||
*/
|
||||
that.$refs.playerView.setVidSts({
|
||||
vid: this.videoData.video,
|
||||
accessKeyId: credentials.accessKeyId,
|
||||
securityToken: credentials.securityToken,
|
||||
accessKeySecret: credentials.accessKeySecret,
|
||||
expireTime: credentials.expireTime,
|
||||
Region: "cn-shanghai",
|
||||
});
|
||||
// playerView.setLocalSource({
|
||||
// uri: "http://duoduovideo.oss-cn-beijing.aliyuncs.com/5f093c6fb6e90.mp4",
|
||||
// });
|
||||
|
||||
let isFullScreen = true;
|
||||
// fixed fullscreen play on android
|
||||
if (plus.os.name.toLowerCase() === "android") {
|
||||
plus.key.addEventListener("backbutton", (e) => {
|
||||
if (isFullScreen) {
|
||||
that.$refs.playerView.changeScreenMode(0, false);
|
||||
isFullScreen = false;
|
||||
} else {
|
||||
// 这里由于安卓无法监听返回按键,这里只能通过plus监听,然后自己模拟退回
|
||||
uni.navigateBack();
|
||||
}
|
||||
});
|
||||
}
|
||||
that.$refs.playerView.setPlayerCallBack(({ type, data }) => {
|
||||
switch (type) {
|
||||
case "isFullScreen":
|
||||
isFullScreen = Boolean(data);
|
||||
break;
|
||||
default:
|
||||
console.log({ type, data });
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
async getData(data, isChange) {
|
||||
var that = this;
|
||||
if (!this.isSetFirstTime) {
|
||||
var netWork = data.userCourseVideoPositionEntity
|
||||
? data.userCourseVideoPositionEntity.position
|
||||
@@ -209,9 +354,9 @@ export default {
|
||||
// await this.playVideo();
|
||||
// }
|
||||
console.log(this.firstTime, "这是第一次播放时长");
|
||||
|
||||
this.isSetFirstTime = true;
|
||||
await that.getVideo();
|
||||
}
|
||||
this.isSetFirstTime = true;
|
||||
},
|
||||
async playVideo(e) {
|
||||
this.videoContext = uni.createVideoContext("videoId", this);
|
||||
@@ -362,6 +507,678 @@ export default {
|
||||
};
|
||||
</script>
|
||||
|
||||
<script module="renderScript" lang="renderjs">
|
||||
import $ from 'jquery'
|
||||
// import StaticADComponent from './staticadcomponent/index.js';
|
||||
/**
|
||||
* 静态广告组件
|
||||
*/
|
||||
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 静态广告组件
|
||||
*/
|
||||
|
||||
components: {
|
||||
// MyComponent
|
||||
},
|
||||
mounted() {
|
||||
// 在适合的生命周期,通过script和link标签引入播放器sdk、css
|
||||
console.log(this.options, '这是monted')
|
||||
this.loadWebPlayerSDK()
|
||||
// this.loadComponent()
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
player: null,
|
||||
videoTimer: null,
|
||||
curTime: null,
|
||||
// firstTime: null,
|
||||
curStatus: null,
|
||||
// currentTime:null,
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
watch: {
|
||||
|
||||
|
||||
curTime(val) {
|
||||
|
||||
if (this.curTime !== null && this.curStatus !== null) {
|
||||
this.$refs.videoContent1.click()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
handleClick(event, ownerInstance) {
|
||||
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) {
|
||||
var that = this;
|
||||
|
||||
ownerInstance.callMethod('recordTime', {
|
||||
time: that.curTime,
|
||||
status: that.curStatus
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
|
||||
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) {
|
||||
console.log('是否刚开始设置播放时间', newValue, this.firstTime, this.player);
|
||||
// if (this.player) {
|
||||
// // this.firstTime=newValue;
|
||||
// // await this.player.seek(this.firstTime);
|
||||
|
||||
|
||||
|
||||
|
||||
// }
|
||||
|
||||
|
||||
},
|
||||
|
||||
emitSetData(event, ownerInstance) {
|
||||
var that = this;
|
||||
// this.player.seek(this.firstTime)
|
||||
console.log('是否设置的第一次初始播放', this.firstTime, this.videoData.id);
|
||||
|
||||
|
||||
ownerInstance.callMethod('setVideoFirtsetTime')
|
||||
|
||||
},
|
||||
changeVideoScreen(event, ownerInstance) {
|
||||
var that = this;
|
||||
// this.$emit('changeScreenLoading',true)
|
||||
var status = this.player.fullscreenService.getIsFullScreen();
|
||||
|
||||
|
||||
|
||||
ownerInstance.callMethod('screenChange', {
|
||||
status: status,
|
||||
primary: status ? 'portrait' : 'landscape'
|
||||
})
|
||||
|
||||
|
||||
if (status) {
|
||||
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
plus.screen.lockOrientation("portrait-primary"); //锁死屏幕方向为竖屏
|
||||
this.player.fullscreenService.cancelFullScreen();
|
||||
// this.$emit('changeScreenLoading',false);
|
||||
|
||||
|
||||
}, 100);
|
||||
|
||||
|
||||
// this.player.setPlayerSize('100%','200px');
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
// this.player.setPlayerSize({
|
||||
// w:"400px",
|
||||
// height:'60%'
|
||||
// });
|
||||
// plus.screen.unlockOrientation();
|
||||
this.player.fullscreenService.requestFullScreen();
|
||||
setTimeout(() => {
|
||||
// this.$emit('changeScreenLoading',false);
|
||||
plus.screen.lockOrientation("landscape-primary");
|
||||
|
||||
}, 100);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
changeVideoData(event, ownerInstance) {
|
||||
var that = this;
|
||||
|
||||
ownerInstance.callMethod('changeVideoData', )
|
||||
},
|
||||
endEmitData(event, ownerInstance) {
|
||||
var that = this;
|
||||
|
||||
ownerInstance.callMethod('handleEnd', )
|
||||
},
|
||||
getLive() {
|
||||
console.log('这是这只只是666666:', this.firstTime, this.videoData)
|
||||
|
||||
if (this.player) {
|
||||
|
||||
this.player.dispose();
|
||||
$('#url-player-test').empty();
|
||||
this.player = null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
var fullScreenButtonComponent = Aliplayer.Component({
|
||||
/**
|
||||
* 初始函数,在new对象时调用
|
||||
*
|
||||
* @param {string} adAddress - 广告视频地址
|
||||
* @param {string} toAddress - 广告链接地址
|
||||
*/
|
||||
init: function(status, toAddress) {
|
||||
|
||||
this.fullScreenStatus = status
|
||||
// this.adAddress = adAddress;
|
||||
// this.toAddress = toAddress;
|
||||
|
||||
this.$html = $('.fullScreenButton-container');
|
||||
// this.$html.hide();
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建广告Dom元素
|
||||
*/
|
||||
createEl: function(el) {
|
||||
|
||||
|
||||
this.$html.find('.ad').attr('src', this.adAddress);
|
||||
var $adWrapper = this.$html.find('.ad-wrapper');
|
||||
$adWrapper.attr('href', this.toAddress);
|
||||
$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);
|
||||
},
|
||||
ready: function(player, e) {
|
||||
// this.$html.hide()
|
||||
},
|
||||
/**
|
||||
* 隐藏广告
|
||||
*/
|
||||
play: function(player, e) {
|
||||
// this.$html.show();
|
||||
},
|
||||
/**
|
||||
* 显示广告
|
||||
*/
|
||||
pause: function(player, e) {
|
||||
// this.$html.show();
|
||||
},
|
||||
/**
|
||||
* 隐藏广告
|
||||
*/
|
||||
playing: function(player, e) {
|
||||
this.$html.show();
|
||||
// this.$html.hide();
|
||||
},
|
||||
waiting: function(player, e) {
|
||||
// this.$html.hide()
|
||||
},
|
||||
timeupdate: function(player, e) {},
|
||||
error: function(player, e) {},
|
||||
/**
|
||||
* 显示广告
|
||||
*/
|
||||
ended: function(player, e) {
|
||||
// this.$html.show();
|
||||
}
|
||||
});
|
||||
|
||||
console.log('this.currentVideoList at line 456111111111111111111111:', this.videoList)
|
||||
|
||||
|
||||
var playerOptions = {
|
||||
id: "url-player-test",
|
||||
preload: false,
|
||||
"vid": this.videoData
|
||||
.videoId, // 必选参数,可以通过点播控制台(路径:媒资库>音/视频)查询。示例:1e067a2831b641db90d570b6480f****。
|
||||
|
||||
width: '100%', //容器的大小
|
||||
// videoWidth: '100vw', //容器的大小
|
||||
// videoHeight: '100vh', //容器的大小
|
||||
height: '100%', //容器的大小
|
||||
playsinline: true,
|
||||
controlBarVisibility: "click",
|
||||
cover: "",
|
||||
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',
|
||||
type: fullScreenButtonComponent,
|
||||
args: [
|
||||
'http://101.201.146.165:8088/Pf-EH/statics/uploadFile/2024-05-10/b0f420c7-9178-41ad-9dd6-f59a64a6e190.png'
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'RateComponent',
|
||||
type: AliPlayerComponent.RateComponent
|
||||
},
|
||||
|
||||
|
||||
// {
|
||||
// name: 'RotateMirrorComponent',
|
||||
// type: AliPlayerComponent.RotateMirrorComponent
|
||||
// },
|
||||
|
||||
|
||||
],
|
||||
|
||||
skinLayout: [{
|
||||
name: "bigPlayButton",
|
||||
align: "blabs",
|
||||
x: 30,
|
||||
y: 80
|
||||
},
|
||||
{
|
||||
name: "H5Loading",
|
||||
align: "cc"
|
||||
},
|
||||
{
|
||||
name: "errorDisplay",
|
||||
align: "tlabs",
|
||||
x: 0,
|
||||
y: 0
|
||||
},
|
||||
{
|
||||
name: "infoDisplay"
|
||||
},
|
||||
{
|
||||
name: "tooltip",
|
||||
align: "blabs",
|
||||
x: 0,
|
||||
y: 56
|
||||
},
|
||||
{
|
||||
name: "thumbnail"
|
||||
},
|
||||
{
|
||||
name: "controlBar",
|
||||
align: "blabs",
|
||||
x: 0,
|
||||
y: 0,
|
||||
children: [{
|
||||
name: "progress",
|
||||
align: "blabs",
|
||||
x: 0,
|
||||
y: 44
|
||||
},
|
||||
{
|
||||
name: "playButton",
|
||||
align: "tl",
|
||||
x: 15,
|
||||
y: 12
|
||||
},
|
||||
{
|
||||
name: "timeDisplay",
|
||||
align: "tl",
|
||||
x: 10,
|
||||
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",
|
||||
align: "tr",
|
||||
x: 15,
|
||||
y: 12
|
||||
},
|
||||
{
|
||||
name: "volume",
|
||||
align: "tr",
|
||||
x: 5,
|
||||
y: 10
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (this.videoData.type == 1) {
|
||||
playerOptions = {
|
||||
...playerOptions,
|
||||
"playauth": this.videoData.playAuth, // 必选参数,参数值可通过调用GetVideoPlayAuth接口获取。
|
||||
"encryptType": 1, // 必选参数,当播放私有加密流时需要设置本参数值为1。其它情况无需设置。
|
||||
"playConfig": {
|
||||
"EncryptType": 'AliyunVoDEncryption'
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
playerOptions = {
|
||||
...playerOptions,
|
||||
source: this.videoData.videoUrl
|
||||
}
|
||||
}
|
||||
var player = new Aliplayer(playerOptions, function(player) { });
|
||||
this.player = player;
|
||||
console.log('是否拿到第一次初始值呢',this.platform, typeof this.firstTime, this.firstTime)
|
||||
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)
|
||||
|
||||
// })
|
||||
}else{
|
||||
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);
|
||||
|
||||
this.videoTimer = null;
|
||||
this.videoTimer = setInterval(() => {
|
||||
var that = this;
|
||||
that.curTime = parseInt(this.player.getCurrentTime());
|
||||
that.curStatus = this.player.getStatus()
|
||||
|
||||
|
||||
}, 1000);
|
||||
this.$refs.videoContent4.click()
|
||||
player.on('ready', function() {
|
||||
|
||||
// player.fullscreenService.requestFullScreen()
|
||||
|
||||
})
|
||||
|
||||
// this.
|
||||
|
||||
|
||||
// this.$refs.videoContent.click()
|
||||
this.player.on('ended', function() {
|
||||
// console.log('that.curTime at line 242:', this.curTime)
|
||||
// console.log('that.curStatus at line 210:', this.curStatus)
|
||||
this.$refs.videoContent2.click()
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
// player.setRotate(90)
|
||||
|
||||
//全屏播放
|
||||
|
||||
// player.one('canplay', function() {
|
||||
// // console.log('canplay', this.player.tag);
|
||||
// player.tag.play();
|
||||
|
||||
// });
|
||||
|
||||
|
||||
|
||||
},
|
||||
showPreview(e) {
|
||||
// console.log('e at line 56:', e)
|
||||
let conimg = e.target.dataset.nodes;
|
||||
let imgs = conimg.match(/<img[^>]+>/g); //选择节点中的img
|
||||
console.log('imgs at line 59:', imgs)
|
||||
let imgList = [];
|
||||
//遍历img标签的src里面的内容放在定义的数组imgList中
|
||||
for (var j = 0; j < imgs.length; j++) {
|
||||
imgs[j].replace(/<img[^>]*src=['"]([^'"]+)[^>]*>/gi, function(match, capture) {
|
||||
imgList.push(capture)
|
||||
|
||||
})
|
||||
}
|
||||
console.log('imgList.push at line 64:', imgList)
|
||||
|
||||
|
||||
//最后一步就是所有图片放在预览的方法previewImage中就可以了
|
||||
// uni.previewImage({
|
||||
// current: imgList,
|
||||
// urls: imgList,
|
||||
// })
|
||||
uni.previewImage({
|
||||
urls: imgList,
|
||||
longPressActions: {
|
||||
itemList: ['很抱歉,暂不支持保存图片到本地'],
|
||||
success: function(res) {
|
||||
// console.log(res,'+++++')
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
receiveScreenType(newValue) {
|
||||
// console.log('newValue at line 427屏幕方向111111111111:', newValue)
|
||||
|
||||
},
|
||||
async receiveIsfresh(newValue) {
|
||||
|
||||
|
||||
|
||||
console.log('是否走了刷新销毁方法:', this.player)
|
||||
if (this.player) {
|
||||
clearInterval(this.$store.state.videoTimer)
|
||||
// await this.setVideoTime();
|
||||
this.player.dispose();
|
||||
// $('#url-player-test').empty()
|
||||
|
||||
// this.player.seek(newValue);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
async receiveplatform(newValue) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
async receiveIsChange(newValue) {
|
||||
|
||||
|
||||
// this.timer=null
|
||||
|
||||
if (this.isChange) {
|
||||
|
||||
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) {
|
||||
// //数据变化
|
||||
|
||||
console.log('currentVideoListcurrentVideoListcurrentVideoList', newValue)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
receiveMsg(newValue, oldValue, ownerVm, vm) {
|
||||
//数据变化
|
||||
// console.log('newValue', newValue)
|
||||
// console.log('oldValue', oldValue)
|
||||
// console.log('ownerVm', ownerVm)
|
||||
// console.log('vm', vm)
|
||||
},
|
||||
receiveWinWidth(newValue, oldValue, ownerVm, vm) {
|
||||
//数据变化
|
||||
console.log('newValue', newValue)
|
||||
// console.log('oldValue', oldValue)
|
||||
// console.log('ownerVm', ownerVm)
|
||||
// console.log('vm', vm)
|
||||
},
|
||||
receiveWinHeight(newValue, oldValue, ownerVm, vm) {
|
||||
//数据变化
|
||||
console.log('newValue', newValue)
|
||||
// console.log('oldValue', oldValue)
|
||||
// console.log('ownerVm', ownerVm)
|
||||
// console.log('vm', vm)
|
||||
},
|
||||
checkValue() {
|
||||
console.log(this.videoId, this.authId, this.videoData, "1111888888")
|
||||
if ((!this.videoData.playAuth || !this.currentVideoList)) {
|
||||
setTimeout(() => {
|
||||
this.checkValue();
|
||||
}, 1000);
|
||||
} else {
|
||||
|
||||
console.log('这是这只只是594:', this.firstTime, this.videoData)
|
||||
this.getLive();
|
||||
}
|
||||
},
|
||||
loadWebPlayerSDK() {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
|
||||
|
||||
const s_tag = document.createElement('script'); // 引入播放器js
|
||||
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.charset = 'utf-8';
|
||||
s_tag.onload = () => {
|
||||
const s_tag1 = document.createElement('script'); // 引入播放器js
|
||||
s_tag1.type = 'text/javascript';
|
||||
s_tag1.src =
|
||||
'https://player.alicdn.com/aliplayer/presentation/js/aliplayercomponents.min.js';
|
||||
s_tag1.charset = 'utf-8';
|
||||
s_tag1.onload = () => {
|
||||
this.checkValue();
|
||||
resolve();
|
||||
|
||||
}
|
||||
document.body.appendChild(s_tag1);
|
||||
|
||||
}
|
||||
document.body.appendChild(s_tag);
|
||||
|
||||
|
||||
|
||||
const l_tag = document.createElement('link'); // 引入播放器css
|
||||
l_tag.rel = 'stylesheet';
|
||||
l_tag.href =
|
||||
'https://g.alicdn.com/apsara-media-box/imp-web-player/2.20.3/skins/default/aliplayer-min.css';
|
||||
|
||||
|
||||
|
||||
document.body.appendChild(l_tag);
|
||||
});
|
||||
},
|
||||
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);
|
||||
// });
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.container {
|
||||
width: 100vw;
|
||||
|
||||
Reference in New Issue
Block a user