视频添加倍速

This commit is contained in:
@fawn-nine
2024-07-02 11:27:48 +08:00
parent 3fe52975b5
commit cd34e5455e

View File

@@ -10,23 +10,12 @@
}px; left: ${10}px;z-index: 999;`"
></u-icon>-->
<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"
<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>
:change:currentVideoList="renderScript.receiveVideoList"></div>
<div @tap="renderScript.emitData" ref="videoContent1" v-show="false">
直接调用renderjs中的emitData的方法,传递当前播放时长
</div>
@@ -35,26 +24,17 @@
</div>
<div class="fullScreenButton-container">
<div
:class="`prism-fullscreen-btn ${isFullScreen ? 'fullscreen' : ''}`"
@tap="renderScript.changeVideoScreen"
></div>
<div :class="`prism-fullscreen-btn ${isFullScreen ? 'fullscreen' : ''}`"
@tap="renderScript.changeVideoScreen"></div>
<!-- <div class="beisuBtn" id="beisuBtn" @tap="renderScript.changeSpeed">倍速</div> -->
<!-- <img class=" iconfont icon-list" src="../../../../static/icon/cate_bg.png" style="width: 60px;height: 10px;"></img> -->
</div>
<!-- <div class="beisuBtn" id="beisuBtn" @tap="renderScript.changeSpeed">倍速</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 @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">
<cover-view style="position: absolute; top: 10px; z-index: 80">
<cover-view class="returnBack" @click="goBack">
<uni-icons type="back" size="26" color="#fff"></uni-icons>
@@ -80,7 +60,10 @@
</template>
<script>
import $http from "@/config/requestConfig.js";
import { mapState, mapMutations } from "vuex";
import {
mapState,
mapMutations
} from "vuex";
// importScripts('@/static/aliplayer/aliplayer-min.js')
export default {
@@ -227,9 +210,9 @@ export default {
this.videoData.userCourseVideoPositionEntity
);
if (!this.isSetFirstTime) {
var netWork = this.videoData.userCourseVideoPositionEntity
? this.videoData.userCourseVideoPositionEntity.position
: 0;
var netWork = this.videoData.userCourseVideoPositionEntity ?
this.videoData.userCourseVideoPositionEntity.position :
0;
var list = JSON.parse(uni.getStorageSync("videoOssList"));
console.log("这是获取接口 设置的起始时长", netWork);
var index = list.findIndex((e) => e.id == this.videoData.id);
@@ -383,7 +366,6 @@ export default {
</script>
<script module="renderScript" lang="renderjs">
import $ from 'jquery'
// import StaticADComponent from './staticadcomponent/index.js';
/**
@@ -451,33 +433,17 @@ components: {
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({
@@ -491,14 +457,11 @@ this.player.fullscreenService.requestFullScreen();
plus.screen.lockOrientation("landscape-primary");
}, 100);
}
},
changeSpeed(event, ownerInstance){
console.log('点击了');
},
endEmitData(event, ownerInstance) {
var that = this;
@@ -566,10 +529,8 @@ if(this.videoData.type==1){
waiting: function(player, e) {
// this.$html.hide()
},
timeupdate: function (player, e) {
},
error: function (player, e) {
},
timeupdate: function(player, e) {},
error: function(player, e) {},
/**
* 显示广告
*/
@@ -606,9 +567,40 @@ console.log('this.currentVideoList at line 456111111111111111111111:', this.vide
// */
// 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: '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: 'adComponent1',
// type: beisuBtnComponent,
// args:['http://example.aliyundoc.com/cover.png']
// {
// name: 'X0.75',
// speed: 0.75
// }, {
// name: 'X1.0',
// speed: 1.0
// }, {
// name: 'X1.25',
// speed: 1.25
// }, {
// name: 'X1.5',
// speed: 1.5
// }, {
// name: 'X2.0',
// speed: 2.0
// },
// ]
// },
// {
// name: 'RotateMirrorComponent',
@@ -618,24 +610,77 @@ console.log('this.currentVideoList at line 456111111111111111111111:', this.vide
],
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"},
skinLayout: [{
name: "bigPlayButton",
align: "blabs",
x: 30,
y: 80
},
{
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: "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}
{
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
}
]
}
]
@@ -755,7 +800,8 @@ console.log('this.videoList at line 这是这只只是594:', this.currentVideoLi
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.src =
'https://player.alicdn.com/aliplayer/presentation/js/aliplayercomponents.min.js';
s_tag1.charset = 'utf-8';
s_tag1.onload = () => {
this.checkValue();
@@ -800,6 +846,7 @@ console.log('this.videoList at line 这是这只只是594:', this.currentVideoLi
.container {
width: 100vw;
height: auto;
/deep/.pause {
width: 60rpx !important;
height: 60rpx !important;
@@ -854,6 +901,7 @@ cover-view {
white-space: nowrap;
pointer-events: auto;
}
cover-view {
visibility: visible !important;
}
@@ -871,6 +919,7 @@ cover-image {
display: flex;
align-items: center;
position: relative;
i {
color: #fff;
display: inline-block;
@@ -878,27 +927,34 @@ cover-image {
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;
@@ -908,11 +964,13 @@ cover-image {
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;
@@ -922,10 +980,12 @@ cover-image {
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
&.active {
background-color: #000;
color: #00ddff;
}
@media (min-width: 768px) {
&:hover {
background-color: #000;
@@ -966,13 +1026,17 @@ cover-image {
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; /* 固定定位,全屏显示 */
transform: rotate(90deg);
/* 旋转90度 */
transform-origin: center center;
/* 设置旋转中心点在div中心 */
position: fixed;
/* 固定定位,全屏显示 */
left: 0;
top: 0;
bottom: 0;