视频添加倍速

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;`" }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>
@@ -80,7 +60,10 @@
</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 {
@@ -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);
@@ -383,7 +366,6 @@ export default {
</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';
/** /**
@@ -451,33 +433,17 @@ components: {
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); // this.$emit('changeScreenLoading',false);
}, 100); }, 100);
// this.player.setPlayerSize('100%','200px'); // this.player.setPlayerSize('100%','200px');
} else { } else {
// this.player.setPlayerSize({ // this.player.setPlayerSize({
@@ -491,14 +457,11 @@ this.player.fullscreenService.requestFullScreen();
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;
@@ -566,10 +529,8 @@ if(this.videoData.type==1){
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) {
},
/** /**
* 显示广告 * 显示广告
*/ */
@@ -606,9 +567,40 @@ console.log('this.currentVideoList at line 456111111111111111111111:', this.vide
// */ // */
// 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: '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', // name: 'RotateMirrorComponent',
@@ -618,24 +610,77 @@ console.log('this.currentVideoList at line 456111111111111111111111:', this.vide
], ],
skinLayout:[ skinLayout: [{
{name: "bigPlayButton", align: "blabs", x: 30, y: 80}, name: "bigPlayButton",
{name: "H5Loading", align: "cc"}, align: "blabs",
{name: "errorDisplay", align: "tlabs", x: 0, y: 0}, x: 30,
{name: "infoDisplay"}, y: 80
{name:"tooltip", align:"blabs",x: 0, y: 56}, },
{name: "thumbnail"},
{ {
name: "controlBar", align: "blabs", x: 0, y: 0, name: "H5Loading",
children: [ align: "cc"
{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: "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
}
] ]
} }
] ]
@@ -755,7 +800,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();
@@ -800,6 +846,7 @@ console.log('this.videoList at line 这是这只只是594:', this.currentVideoLi
.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;
@@ -854,6 +901,7 @@ cover-view {
white-space: nowrap; white-space: nowrap;
pointer-events: auto; pointer-events: auto;
} }
cover-view { cover-view {
visibility: visible !important; visibility: visible !important;
} }
@@ -871,6 +919,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,27 +927,34 @@ 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;
@@ -908,11 +964,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 +980,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;
@@ -966,13 +1026,17 @@ cover-image {
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;