From 3f3c3f31b74ef65b0da08c6d29c59bcb2c57780b Mon Sep 17 00:00:00 2001 From: yinjiacheng Date: Mon, 12 Aug 2024 13:00:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0video=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/video/video.uvue | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pages/component/video/video.uvue b/pages/component/video/video.uvue index 7e2676af..feedda44 100644 --- a/pages/component/video/video.uvue +++ b/pages/component/video/video.uvue @@ -10,6 +10,9 @@ :http-cache="httpCache" :play-strategy="playStrategy" :danmu-list="danmuList" @play="onPlay" @pause="onPause" @ended="onEnded" @timeupdate="onTimeUpdate" @waiting="onWaiting" @error="onError" @progress="onProgress" @fullscreenclick="onFullScreenClick" @controlstoggle="onControlsToggle" @fullscreenchange="onFullScreenChange"> + + + @@ -17,6 +20,12 @@ + + + 中间播放按钮是否替换为子组件 + + + API示例 @@ -167,6 +176,8 @@ rate: 1, rateItemTypes: [{ "value": 0, "name": "0.5" }, { "value": 1, "name": "0.8" }, { "value": 2, "name": "1.0" }, { "value": 3, "name": "1.25" }, { "value": 4, "name": "1.5" }] as ItemType[], rateItems: [0.5, 0.8, 1.0, 1.25, 1.5], + customPlayBtnEnable: false, + customPlayBtnShow: true, // 自动化测试 autoTest: false, isPlaying: false, @@ -216,6 +227,7 @@ console.log("stop"); uni.getElementById("video")?.stop(); //泛型写法测试 // this.videoContext?.stop(); + this.customPlayBtnShow = true; }, sendDanmu: function () { console.log("sendDanmu -> " + this.danmu); @@ -364,11 +376,15 @@ this.header = json as UTSJSONObject; console.log("header -> " + JSON.stringify(this.header)) }, + onCustomPlayBtnEnableChange: function (event : UniSwitchChangeEvent) { + this.customPlayBtnEnable = event.detail.value; + }, // 事件 onPlay: function (res : UniEvent) { console.log(res.type); this.isPlaying = true; this.isPause = false; + this.customPlayBtnShow = false; if (this.autoTest) { this.eventPlay = { "tagName": res.target?.tagName, @@ -502,4 +518,13 @@ .margin-10 { margin: 10px; } + + .custom-play-btn { + width: 60px; + height: 60px; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + position: absolute; + } -- GitLab