This commit is contained in:
@fawn-nine
2024-07-02 14:05:47 +08:00
3 changed files with 3210 additions and 1454 deletions

View File

@@ -10,23 +10,12 @@
}px; left: ${10}px;z-index: 999;`" }px; left: ${10}px;z-index: 999;`"
></u-icon>--> ></u-icon>-->
<view style="width: 100%; height: 200px" v-if="currentVideo.type == 1"> <view style="width: 100%; height: 200px" v-if="currentVideo.type == 1">
<div <div class="" style="background-color: #000" ref="videoContent" @tap="renderScript.handleClick"
class="" id="url-player-test" :videoData="videoData" :winWidth="winWidth" :winHeight="winHeight"
style="background-color: #000" :currentVideoList="currentVideoList" :firstTime="firstTime" :change:videoData="renderScript.receiveMsg"
ref="videoContent" :change:winWidth="renderScript.receiveWinWidth" :change:winHeight="renderScript.receiveWinHeight"
@tap="renderScript.handleClick"
id="url-player-test"
:videoData="videoData"
:winWidth="winWidth"
:winHeight="winHeight"
:currentVideoList="currentVideoList"
:firstTime="firstTime"
:change:videoData="renderScript.receiveMsg"
:change:winWidth="renderScript.receiveWinWidth"
:change:winHeight="renderScript.receiveWinHeight"
:change:firstTime="renderScript.receiveFirstTime" :change:firstTime="renderScript.receiveFirstTime"
:change:currentVideoList="renderScript.receiveVideoList" :change:currentVideoList="renderScript.receiveVideoList"></div>
></div>
<div @tap="renderScript.emitData" ref="videoContent1" v-show="false"> <div @tap="renderScript.emitData" ref="videoContent1" v-show="false">
直接调用renderjs中的emitData的方法,传递当前播放时长 直接调用renderjs中的emitData的方法,传递当前播放时长
</div> </div>
@@ -35,26 +24,17 @@
</div> </div>
<div class="fullScreenButton-container"> <div class="fullScreenButton-container">
<div <div :class="`prism-fullscreen-btn ${isFullScreen ? 'fullscreen' : ''}`"
:class="`prism-fullscreen-btn ${isFullScreen ? 'fullscreen' : ''}`" @tap="renderScript.changeVideoScreen"></div>
@tap="renderScript.changeVideoScreen" <!-- <div class="beisuBtn" id="beisuBtn" @tap="renderScript.changeSpeed">倍速</div> -->
></div>
<!-- <img class=" iconfont icon-list" src="../../../../static/icon/cate_bg.png" style="width: 60px;height: 10px;"></img> --> <!-- <img class=" iconfont icon-list" src="../../../../static/icon/cate_bg.png" style="width: 60px;height: 10px;"></img> -->
</div> </div>
<!-- <div class="beisuBtn" id="beisuBtn" @tap="renderScript.changeSpeed">倍速</div> -->
</view> </view>
<view style="width: 100%; height: 200px; position: relative" v-else> <view style="width: 100%; height: 200px; position: relative" v-else>
<video <video @timeupdate="videoTimeUpdateEvent($event)" ref="videos" style="width: 100%; height: 100%" autoplay
@timeupdate="videoTimeUpdateEvent($event)" id="videoId" object-fit="contain" class="video-box" :src="videoUrl"
ref="videos" :poster="`${videoUrl}?x-oss-process=video/snapshot,t_${1},f_jpg`" @play="playVideo">
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"
>
<cover-view style="position: absolute; top: 10px; z-index: 80"> <cover-view style="position: absolute; top: 10px; z-index: 80">
<cover-view class="returnBack" @click="goBack"> <cover-view class="returnBack" @click="goBack">
<uni-icons type="back" size="26" color="#fff"></uni-icons> <uni-icons type="back" size="26" color="#fff"></uni-icons>
@@ -79,11 +59,14 @@
</view> </view>
</template> </template>
<script> <script>
import $http from "@/config/requestConfig.js"; import $http from "@/config/requestConfig.js";
import { mapState, mapMutations } from "vuex"; import {
mapState,
mapMutations
} from "vuex";
// importScripts('@/static/aliplayer/aliplayer-min.js') // importScripts('@/static/aliplayer/aliplayer-min.js')
export default { export default {
props: ["currentVideo", "currentVideoList"], props: ["currentVideo", "currentVideoList"],
data() { data() {
return { return {
@@ -227,9 +210,9 @@ export default {
this.videoData.userCourseVideoPositionEntity this.videoData.userCourseVideoPositionEntity
); );
if (!this.isSetFirstTime) { if (!this.isSetFirstTime) {
var netWork = this.videoData.userCourseVideoPositionEntity var netWork = this.videoData.userCourseVideoPositionEntity ?
? this.videoData.userCourseVideoPositionEntity.position this.videoData.userCourseVideoPositionEntity.position :
: 0; 0;
var list = JSON.parse(uni.getStorageSync("videoOssList")); var list = JSON.parse(uni.getStorageSync("videoOssList"));
console.log("这是获取接口 设置的起始时长", netWork); console.log("这是获取接口 设置的起始时长", netWork);
var index = list.findIndex((e) => e.id == this.videoData.id); var index = list.findIndex((e) => e.id == this.videoData.id);
@@ -379,24 +362,23 @@ export default {
}, },
created() {}, created() {},
}; };
</script> </script>
<script module="renderScript" lang="renderjs"> <script module="renderScript" lang="renderjs">
import $ from 'jquery'
import $ from 'jquery' // import StaticADComponent from './staticadcomponent/index.js';
// import StaticADComponent from './staticadcomponent/index.js'; /**
/**
* 静态广告组件 * 静态广告组件
*/ */
export default { export default {
/** /**
* 静态广告组件 * 静态广告组件
*/ */
components: { components: {
// MyComponent // MyComponent
}, },
mounted() { mounted() {
@@ -429,11 +411,11 @@ components: {
handleClick(event, ownerInstance) { handleClick(event, ownerInstance) {
console.log('event at line 165:', event) console.log('event at line 165:', event)
// this.player.on('ready',function(){ // this.player.on('ready',function(){
// var status= this.player.fullscreenService.getIsFullScreen() // var status= this.player.fullscreenService.getIsFullScreen()
// console.log('status at line 403:', status) // console.log('status at line 403:', status)
// console.log('触发点击事件',status)) // console.log('触发点击事件',status))
// }) // })
ownerInstance.callMethod('getData') ownerInstance.callMethod('getData')
@@ -450,62 +432,43 @@ components: {
changeVideoScreen(event, ownerInstance) { changeVideoScreen(event, ownerInstance) {
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) {
setTimeout(() => {
if(status){
setTimeout(() => {
plus.screen.lockOrientation("portrait-primary"); //锁死屏幕方向为竖屏 plus.screen.lockOrientation("portrait-primary"); //锁死屏幕方向为竖屏
this.player.fullscreenService.cancelFullScreen() ; this.player.fullscreenService.cancelFullScreen();
// this.$emit('changeScreenLoading',false); // this.$emit('changeScreenLoading',false);
}, 100);
}, 100);
// this.player.setPlayerSize('100%','200px'); // this.player.setPlayerSize('100%','200px');
} else {
// this.player.setPlayerSize({
// w:"400px",
// height:'60%'
}else{ // });
// plus.screen.unlockOrientation();
// this.player.setPlayerSize({ this.player.fullscreenService.requestFullScreen();
// w:"400px",
// height:'60%'
// });
// plus.screen.unlockOrientation();
this.player.fullscreenService.requestFullScreen();
setTimeout(() => { setTimeout(() => {
// this.$emit('changeScreenLoading',false); // this.$emit('changeScreenLoading',false);
plus.screen.lockOrientation("landscape-primary"); plus.screen.lockOrientation("landscape-primary");
}, 100); }, 100);
} }
}, },
changeSpeed(event, ownerInstance){
console.log('点击了');
},
endEmitData(event, ownerInstance) { endEmitData(event, ownerInstance) {
var that = this; var that = this;
ownerInstance.callMethod('handleEnd', ) ownerInstance.callMethod('handleEnd', )
}, },
getLive() { getLive() {
if(this.videoData.type==1){ if (this.videoData.type == 1) {
var fullScreenButtonComponent = Aliplayer.Component({ var fullScreenButtonComponent = Aliplayer.Component({
/** /**
* 初始函数在new对象时调用 * 初始函数在new对象时调用
@@ -513,9 +476,9 @@ if(this.videoData.type==1){
* @param {string} adAddress - 广告视频地址 * @param {string} adAddress - 广告视频地址
* @param {string} toAddress - 广告链接地址 * @param {string} toAddress - 广告链接地址
*/ */
init: function (status, toAddress) { init: function(status, toAddress) {
this.fullScreenStatus=status this.fullScreenStatus = status
// this.adAddress = adAddress; // this.adAddress = adAddress;
// this.toAddress = toAddress; // this.toAddress = toAddress;
@@ -526,13 +489,13 @@ if(this.videoData.type==1){
/** /**
* 创建广告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(); // Aliplayer.util.stopPropagation();
}); });
// this.$html.find('.close').click(function () { // this.$html.find('.close').click(function () {
@@ -541,44 +504,42 @@ if(this.videoData.type==1){
// $(el).find('.prism-controlbar').append(this.$html); // $(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) {
// this.$html.hide() // this.$html.hide()
}, },
/** /**
* 隐藏广告 * 隐藏广告
*/ */
play: function (player, e) { play: function(player, e) {
// this.$html.show(); // this.$html.show();
}, },
/** /**
* 显示广告 * 显示广告
*/ */
pause: function (player, e) { pause: function(player, e) {
// this.$html.show(); // this.$html.show();
}, },
/** /**
* 隐藏广告 * 隐藏广告
*/ */
playing: function (player, e) { playing: function(player, e) {
this.$html.show(); this.$html.show();
// 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) {},
}, error: function(player, e) {},
error: function (player, e) {
},
/** /**
* 显示广告 * 显示广告
*/ */
ended: function (player, e) { ended: function(player, e) {
// this.$html.show(); // this.$html.show();
} }
}); });
console.log('this.currentVideoList at line 456111111111111111111111:', this.videoList) console.log('this.currentVideoList at line 456111111111111111111111:', this.videoList)
var player = new Aliplayer({ var player = new Aliplayer({
id: "url-player-test", id: "url-player-test",
"vid": this.videoData "vid": this.videoData
@@ -592,50 +553,111 @@ console.log('this.currentVideoList at line 456111111111111111111111:', this.vide
// videoWidth: '100vw', //容器的大小 // videoWidth: '100vw', //容器的大小
// videoHeight: '100vh', //容器的大小 // videoHeight: '100vh', //容器的大小
height: '100%', //容器的大小 height: '100%', //容器的大小
playsinline:true, playsinline: true,
controlBarVisibility:"click", controlBarVisibility: "click",
cover:"", cover: "",
components: [ components: [
// { // {
// name: 'BulletScreenComponent', // name: 'BulletScreenComponent',
// type: AliPlayerComponent.BulletScreenComponent, // type: AliPlayerComponent.BulletScreenComponent,
// /** Descriptions of the scrolling text component parameters: text, style, bulletPosition // /** Descriptions of the scrolling text component parameters: text, style, bulletPosition
// * text: The scrolling text // * text: The scrolling text
// * style: The style of 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'. // * bulletPosition: The position of the scrolling text. Valid values: 'top', 'bottom', and 'random'. The default is 'random'.
// */ // */
// args: ['本课程版权归天津众妙之门科技有限公司所有,翻版必究!', {fontSize: '16px', color: 'red',}, 'random'] // args: ['本课程版权归天津众妙之门科技有限公司所有,翻版必究!', {fontSize: '16px', color: 'red',}, 'random']
// }, // },
{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: '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, name: 'adComponent',
children: [ type: fullScreenButtonComponent,
{name: "progress", align: "blabs", x: 0, y: 44}, args: [
{name: "playButton", align: "tl", x: 15, y: 12}, 'http://101.201.146.165:8088/Pf-EH/statics/uploadFile/2024-05-10/b0f420c7-9178-41ad-9dd6-f59a64a6e190.png']
{name: "timeDisplay", align: "tl", x: 10, y: 7}, },
{
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: "fullScreenButton", align: "tr", x: 10, y: 12},
// {name:"subtitle", align:"tr",x:15, 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: "setting",
{name: "volume", align: "tr", x: 5, y: 10} align: "tr",
x: 15,
y: 12
},
{
name: "prism-speed-selector",
align: "tr",
x: 15,
y: 12
},
{
name: "volume",
align: "tr",
x: 5,
y: 10
}
] ]
} }
] ]
@@ -651,23 +673,23 @@ console.log('this.currentVideoList at line 456111111111111111111111:', this.vide
this.player = player; this.player = player;
this.$refs.videoContent.click() this.$refs.videoContent.click()
var timer = setInterval(() => { var timer = setInterval(() => {
var that = this; var that = this;
that.curTime = parseInt(this.player.getCurrentTime()); that.curTime = parseInt(this.player.getCurrentTime());
that.curStatus = this.player.getStatus() that.curStatus = this.player.getStatus()
}, 1000); }, 1000);
// player.on('ready',function(){ // player.on('ready',function(){
// player.fullscreenService.requestFullScreen() // player.fullscreenService.requestFullScreen()
// }) // })
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.setRotate(90)
@@ -733,13 +755,13 @@ this.player.on('ended', function() {
}, },
checkValue() { checkValue() {
console.log(this.videoId, this.authId, "1111888888") console.log(this.videoId, this.authId, "1111888888")
if (!this.videoData.playAuth||!this.currentVideoList) { if (!this.videoData.playAuth || !this.currentVideoList) {
setTimeout(() => { setTimeout(() => {
this.checkValue(); this.checkValue();
}, 1000); }, 1000);
} else { } else {
console.log('this.videoList at line 这是这只只是594:', this.currentVideoList) console.log('this.videoList at line 这是这只只是594:', this.currentVideoList)
this.getLive(); this.getLive();
} }
}, },
@@ -755,7 +777,8 @@ console.log('this.videoList at line 这是这只只是594:', this.currentVideoLi
s_tag.onload = () => { s_tag.onload = () => {
const s_tag1 = document.createElement('script'); // 引入播放器js const s_tag1 = document.createElement('script'); // 引入播放器js
s_tag1.type = 'text/javascript'; s_tag1.type = 'text/javascript';
s_tag1.src = 'https://player.alicdn.com/aliplayer/presentation/js/aliplayercomponents.min.js'; s_tag1.src =
'https://player.alicdn.com/aliplayer/presentation/js/aliplayercomponents.min.js';
s_tag1.charset = 'utf-8'; s_tag1.charset = 'utf-8';
s_tag1.onload = () => { s_tag1.onload = () => {
this.checkValue(); this.checkValue();
@@ -794,75 +817,77 @@ console.log('this.videoList at line 这是这只只是594:', this.currentVideoLi
// }); // });
} }
} }
} }
</script> </script>
<style> <style>
.container { .container {
width: 100vw; width: 100vw;
height: auto; height: auto;
/deep/.pause { /deep/.pause {
width: 60rpx !important; width: 60rpx !important;
height: 60rpx !important; height: 60rpx !important;
} }
} }
.fds { .fds {
background-color: blue; background-color: blue;
height: 600rpx; height: 600rpx;
position: fixed; position: fixed;
top: 60rpx; top: 60rpx;
} }
.returnBack { .returnBack {
flex-direction: row; flex-direction: row;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
height: 88rpx; height: 88rpx;
padding-left: 20rpx; padding-left: 20rpx;
} }
.txt { .txt {
color: #fff; color: #fff;
} }
.right_title { .right_title {
background: #000; background: #000;
height: 96rpx; height: 96rpx;
justify-content: space-between; justify-content: space-between;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
margin-left: auto; margin-left: auto;
} }
.return { .return {
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
color: #fff; color: #fff;
} }
.right_handle { .right_handle {
width: 200rpx; width: 200rpx;
flex-direction: row; flex-direction: row;
justify-content: flex-end; justify-content: flex-end;
padding-right: 20rpx; padding-right: 20rpx;
} }
cover-view { cover-view {
display: block; display: block;
line-height: 1.2; line-height: 1.2;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
pointer-events: auto; pointer-events: auto;
} }
cover-view {
visibility: visible !important;
}
cover-image { cover-view {
visibility: visible !important; visibility: visible !important;
} }
.fullScreenButton-container { cover-image {
visibility: visible !important;
}
.fullScreenButton-container {
color: #fff; color: #fff;
float: right; float: right;
height: 35px; height: 35px;
@@ -871,6 +896,7 @@ cover-image {
display: flex; display: flex;
align-items: center; align-items: center;
position: relative; position: relative;
i { i {
color: #fff; color: #fff;
display: inline-block; display: inline-block;
@@ -878,28 +904,35 @@ cover-image {
display: block; display: block;
margin-top: 7px; margin-top: 7px;
cursor: pointer; cursor: pointer;
& + i {
&+i {
margin-left: 3px; margin-left: 3px;
} }
@media (min-width: 768px) { @media (min-width: 768px) {
&:hover + .player-tooltip { &:hover+.player-tooltip {
display: block; display: block;
} }
} }
} }
.player-tooltip { .player-tooltip {
&.prev { &.prev {
left: -10px; left: -10px;
} }
&.list { &.list {
left: 5px; left: 5px;
} }
&.next { &.next {
right: -12px; right: -12px;
} }
} }
} }
.playlist-content {
.playlist-content {
position: absolute; position: absolute;
right: 0; right: 0;
width: 0px; width: 0px;
@@ -908,11 +941,13 @@ cover-image {
height: 100%; height: 100%;
transition: all 0.38s ease-in-out; transition: all 0.38s ease-in-out;
overflow: hidden; overflow: hidden;
.list { .list {
background-color: #000; background-color: #000;
background-color: rgba(0, 0, 0, 0.3); background-color: rgba(0, 0, 0, 0.3);
height: 100%; height: 100%;
overflow: auto; overflow: auto;
.video-item { .video-item {
color: #fff; color: #fff;
padding: 0px 10px; padding: 0px 10px;
@@ -922,10 +957,12 @@ cover-image {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
cursor: pointer; cursor: pointer;
&.active { &.active {
background-color: #000; background-color: #000;
color: #00ddff; color: #00ddff;
} }
@media (min-width: 768px) { @media (min-width: 768px) {
&:hover { &:hover {
background-color: #000; background-color: #000;
@@ -934,9 +971,9 @@ cover-image {
} }
} }
} }
} }
.player-tooltip { .player-tooltip {
position: absolute; position: absolute;
display: none; display: none;
font-size: 12px; font-size: 12px;
@@ -950,9 +987,9 @@ cover-image {
top: -48px; top: -48px;
padding: 0 5px; padding: 0 5px;
white-space: nowrap; white-space: nowrap;
} }
.playlist-skip-tip { .playlist-skip-tip {
padding: 5px 15px; padding: 5px 15px;
position: absolute; position: absolute;
top: 50%; top: 50%;
@@ -965,17 +1002,21 @@ cover-image {
color: #000; color: #000;
text-align: center; text-align: center;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
} }
#rotating-div {
#rotating-div {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
background-color: #3498db; background-color: #3498db;
transform: rotate(90deg); /* 旋转90度 */ transform: rotate(90deg);
transform-origin: center center; /* 设置旋转中心点在div中心 */ /* 旋转90度 */
position: fixed; /* 固定定位,全屏显示 */ transform-origin: center center;
/* 设置旋转中心点在div中心 */
position: fixed;
/* 固定定位,全屏显示 */
left: 0; left: 0;
top: 0; top: 0;
bottom: 0; bottom: 0;
right: 0; right: 0;
} }
</style> </style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff