视频播放

This commit is contained in:
2024-06-19 15:31:08 +08:00
parent 05e8da330a
commit 3e8696345e
164 changed files with 44570 additions and 1117 deletions

View File

@@ -199,7 +199,7 @@ export default {
width: 100%;
// height: 100rpx;
.video_item {
width: 24%;
width: 23%;
margin-right: 10rpx;
margin-bottom: 20rpx;
float: left;

View File

@@ -1,5 +1,16 @@
<template>
<div>{{ message }}</div>
</template>
<script>
import $ from "jquery";
export default class MyComponent {
// data() {
// return {
// message: 'Hello, Vue!'
// }
// }
export default class StaticADComponent {
constructor(adAddress, toAddress) {
this.adAddress = adAddress;
this.toAddress = toAddress;
@@ -30,4 +41,4 @@ export default class StaticADComponent {
this.$html.show();
}
}
</script>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
<template>
<view class="container" style="background-color: #000; position: relative">
<!-- <u-icon
<!-- <u-icon
@click="goBack"
name="arrow-left"
color="#3ab3ae"
@@ -9,16 +9,21 @@
statusBarHeight + 2
}px; left: ${10}px;z-index: 999;`"
></u-icon>-->
<view style="width: 100%; height: 30vh" v-if="currentVideo.type == 1">
<view style="width: 100%; height: 200px" v-if="currentVideo.type == 1">
<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"
:change:videoData="renderScript.receiveMsg"
:change:winWidth="renderScript.receiveWinWidth"
:change:winHeight="renderScript.receiveWinHeight"
:change:firstTime="renderScript.receiveFirstTime"
:change:currentVideoList="renderScript.receiveVideoList"
></div>
@@ -27,9 +32,17 @@
</div>
<div @tap="renderScript.endEmitData" ref="videoContent2" v-show="false">
监听结束方法记录播放时长
</div></view
>
<view style="width: 100%; height: 30vh; position: relative" v-else>
</div>
<div class="fullScreenButton-container">
<div
:class="`prism-fullscreen-btn ${isFullScreen ? 'fullscreen' : ''}`"
@tap="renderScript.changeVideoScreen"
></div>
<!-- <img class=" iconfont icon-list" src="../../../../static/icon/cate_bg.png" style="width: 60px;height: 10px;"></img> -->
</div>
</view>
<view style="width: 100%; height: 200px; position: relative" v-else>
<video
@timeupdate="videoTimeUpdateEvent($event)"
ref="videos"
@@ -150,14 +163,21 @@ export default {
},
methods: {
screenChange(e) {
let fullScreen = e.detail.fullScreen; // truefalse退
if (!fullScreen) {
//退
this.isFullScreen = false;
} else {
this.isFullScreen = true;
}
screenChange(data) {
console.log(
"status at line 这是当前的状态158:",
data.status,
data.primary
);
this.isFullScreen = !data.status;
this.$emit("changeScreen", this.isFullScreen);
// let fullScreen = e.detail.fullScreen; // truefalse退
// if (!fullScreen) {
// //退
// this.isFullScreen = false;
// } else {
// this.isFullScreen = true;
// }
},
//
controlChange(e) {
@@ -180,6 +200,12 @@ export default {
});
},
async init(data) {
// uni.getSystemInfo({
// success(res) {
// var winWidth = res.screenWidth;
// var winHeight = res.screenHeight;
// var statusBarHeight = res.statusBarHeight;
console.log("at line 59:", "是否先走这里");
if (uni.getStorageSync("videoOssList")) {
this.videoList = JSON.parse(uni.getStorageSync("videoOssList"));
@@ -357,8 +383,9 @@ export default {
</script>
<script module="renderScript" lang="renderjs">
import StaticADComponent from './StaticADComponent.vue'
// import AliplayerComponents from 'aliplayercomponents';
import $ from 'jquery'
// import StaticADComponent from './staticadcomponent/index.js';
/**
* 静态广告组件
*/
@@ -369,8 +396,8 @@ export default {
* 静态广告组件
*/
components: {
StaticADComponent
components: {
// MyComponent
},
mounted() {
// scriptlinksdkcss
@@ -420,6 +447,58 @@ export default {
})
},
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);
}
},
endEmitData(event, ownerInstance) {
var that = this;
@@ -427,38 +506,77 @@ export default {
},
getLive() {
if(this.videoData.type==1){
// var StaticADComponent = Aliplayer.Component({
// init:function(adAddress,toAddress)
// {
// this.adAddress = adAddress;
// this.toAddress = toAddress;
// this.$html = $(html);
// },
// 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).append(this.$html);
// },
// ready:function(player,e)
// {
// },
// play:function(player,e)
// {
// this.$html.hide();
// },
// pause:function(player,e)
// {
// this.$html.show();
// }
// });
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 player = new Aliplayer({
@@ -473,45 +591,33 @@ console.log('this.currentVideoList at line 456111111111111111111111:', this.vide
width: '100%', //
// videoWidth: '100vw', //
// videoHeight: '100vh', //
height: '30vh', //
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: ['本课程版权归天津众妙之门科技有限公司所有,翻版必究!', {fontSize: '16px', color: 'red',}, 'random']
},
{name:'adComponent',type:StaticADComponent,args:['http://example.aliyundoc.com/cover.png']},
// {
// 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: ['!', {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
},
// {
// name: 'RotateMirrorComponent',
// type: AliPlayerComponent.RotateMirrorComponent
// },
],
// components: [{
// name: 'PlaylistComponent',
// type: AliPlayerComponent.PlaylistComponent,
// args: [this.currentVideoList.map(e=>{
// e.name=1;
// e.vid= e.videoId, // >/1e067a2831b641db90d570b6480f****
// e.playauth= this.videoData.playAuth, // GetVideoPlayAuth
// e.encryptType= 1, // 1
// e.playConfig= {
// "EncryptType": 'AliyunVoDEncryption'
// }
// })]
// }],
skinLayout:[
{name: "bigPlayButton", align: "blabs", x: 30, y: 80},
{name: "H5Loading", align: "cc"},
@@ -525,8 +631,8 @@ console.log('this.currentVideoList at line 456111111111111111111111:', this.vide
{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: "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}
@@ -605,11 +711,25 @@ this.player.on('ended', function() {
},
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)
// 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, "1111888888")
@@ -741,4 +861,121 @@ cover-view {
cover-image {
visibility: visible !important;
}
.fullScreenButton-container {
color: #fff;
float: right;
height: 35px;
margin-top: 6px;
margin-right: 5px;
display: flex;
align-items: center;
position: relative;
i {
color: #fff;
display: inline-block;
font-size: 22px;
display: block;
margin-top: 7px;
cursor: pointer;
& + i {
margin-left: 3px;
}
@media (min-width: 768px) {
&:hover + .player-tooltip {
display: block;
}
}
}
.player-tooltip {
&.prev {
left: -10px;
}
&.list {
left: 5px;
}
&.next {
right: -12px;
}
}
}
.playlist-content {
position: absolute;
right: 0;
width: 0px;
padding-bottom: 48px;
box-sizing: border-box;
height: 100%;
transition: all 0.38s ease-in-out;
overflow: hidden;
.list {
background-color: #000;
background-color: rgba(0, 0, 0, 0.3);
height: 100%;
overflow: auto;
.video-item {
color: #fff;
padding: 0px 10px;
line-height: 35px;
font-size: 14px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
&.active {
background-color: #000;
color: #00ddff;
}
@media (min-width: 768px) {
&:hover {
background-color: #000;
color: #00ddff;
}
}
}
}
}
.player-tooltip {
position: absolute;
display: none;
font-size: 12px;
color: #fff;
line-height: 28px;
letter-spacing: 0;
text-align: center;
background: #3c3c3c;
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.1);
height: 28px;
top: -48px;
padding: 0 5px;
white-space: nowrap;
}
.playlist-skip-tip {
padding: 5px 15px;
position: absolute;
top: 50%;
left: 50%;
z-index: 30;
line-height: 30px;
font-size: 14px;
border-radius: 4px;
background: rgba(255, 255, 255, 0.8);
color: #000;
text-align: center;
transform: translate(-50%, -50%);
}
#rotating-div {
width: 100vw;
height: 100vh;
background-color: #3498db;
transform: rotate(90deg); /* 旋转90度 */
transform-origin: center center; /* 设置旋转中心点在div中心 */
position: fixed; /* 固定定位,全屏显示 */
left: 0;
top: 0;
bottom: 0;
right: 0;
}
</style>

View File

@@ -0,0 +1,44 @@
.ad-container
{
display:none;
position:absolute;
left:50%;
top:50%;
margin-left:-150px;
margin-top:-100px;
}
.ad-container span
{
width: 27px;
height: 16px;
border-radius: 1px;
background-color: rgba(0,0,0,.5);
position: absolute;
font-size: 10px;
color: #fff;
line-height: 16px;
text-align: center;
top:0px;
left:0px;
}
.ad-container .close
{
position:absolute;
top:2px;
right:2px;
width: 20px;
height: 20px;
}
.ad-container .close:hover
{
cursor:pointer;
}
.ad-container .ad
{
width:300px;
height:200px;
}

View File

@@ -0,0 +1,76 @@
import $ from 'jquery'
// const html = require('./index.html');
// require('https://g.alicdn.com/apsara-media-box/imp-web-player/2.20.3/skins/default/aliplayer-min.css');
// require('../aliplayer-min.js');
// require('../aliplayercomponents.min.js');
// require('../aliplayer-min.css');
require('./index.css');
/**
* 静态广告组件
*/
const fullScreenButtonComponent = Aliplayer.Component({
/**
* 初始函数在new对象时调用
*
* @param {string} adAddress - 广告视频地址
* @param {string} toAddress - 广告链接地址
*/
init: function (adAddress, toAddress) {
this.adAddress = adAddress;
this.toAddress = toAddress;
this.$html = $('.ad-container');
},
/**
* 创建广告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).append(this.$html);
},
ready: function (player, e) {
},
/**
* 隐藏广告
*/
play: function (player, e) {
this.$html.hide();
},
/**
* 显示广告
*/
pause: function (player, e) {
this.$html.show();
},
/**
* 隐藏广告
*/
playing: function (player, e) {
this.$html.hide();
},
waiting: function (player, e) {
},
timeupdate: function (player, e) {
},
error: function (player, e) {
},
/**
* 显示广告
*/
ended: function (player, e) {
this.$html.show();
}
});
export default fullScreenButtonComponent;