Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
87b9bba2
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5996
Star
90
Fork
162
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
87b9bba2
编写于
5月 30, 2024
作者:
DCloud-yinjiacheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新video示例
上级
5eaa72cf
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
156 addition
and
175 deletion
+156
-175
pages/component/video/video.uvue
pages/component/video/video.uvue
+156
-175
未找到文件。
pages/component/video/video.uvue
浏览文件 @
87b9bba2
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
@fullscreenclick="onFullScreenClick" @controlstoggle="onControlsToggle" @fullscreenchange="onFullScreenChange">
@fullscreenclick="onFullScreenClick" @controlstoggle="onControlsToggle" @fullscreenchange="onFullScreenChange">
</video>
</video>
<scroll-view class="uni-padding-wrap uni-common-mt uni-flex-item">
<scroll-view class="uni-padding-wrap uni-common-mt uni-flex-item">
<input class="input" placeholder="输入视频地址播放" @confirm="onSrcInputConfirm"></input>
<view class="uni-btn-v">
<view class="uni-btn-v">
<navigator url="/pages/component/video/video-format">
<navigator url="/pages/component/video/video-format">
<button type="primary" @click="pause">视频格式示例</button>
<button type="primary" @click="pause">视频格式示例</button>
...
@@ -28,10 +27,12 @@
...
@@ -28,10 +27,12 @@
<button type="primary" @click="pause">暂停</button>
<button type="primary" @click="pause">暂停</button>
</view>
</view>
<view class="uni-btn-v">
<view class="uni-btn-v">
<button type="primary" @click="seek(pos)">跳转到指定位置</button>
<input class="input" placeholder="输入要跳转的位置,单位s" type="number" @input="onSeekInput"></input>
<button type="primary" @click="seek">跳转到指定位置</button>
</view>
</view>
<view class="uni-btn-v">
<view class="uni-btn-v">
<button type="primary" @click="requestFullScreen(requestFullScreenOptions)">进入全屏</button>
<enum-data title="选择进入全屏时的视频方向" :items="directionItemTypes" @change="onRequestFullScreenDirectionChange"></enum-data>
<button type="primary" @click="requestFullScreen">进入全屏</button>
</view>
</view>
<view class="uni-btn-v">
<view class="uni-btn-v">
<button type="primary" @click="exitFullScreen">退出全屏</button>
<button type="primary" @click="exitFullScreen">退出全屏</button>
...
@@ -40,103 +41,53 @@
...
@@ -40,103 +41,53 @@
<button type="primary" @click="stop">停止</button>
<button type="primary" @click="stop">停止</button>
</view>
</view>
<view class="uni-btn-v">
<view class="uni-btn-v">
<button type="primary" @click="sendDanmu(danmu)">发送弹幕</button>
<input class="input" placeholder="输入弹幕" value="{ 'text': '要显示的文本', 'color': '#FF0000' }" type="string" @input="onSendDanmuInput"></input>
<button type="primary" :disabled="!enableDanmu" @click="sendDanmu">发送弹幕</button>
</view>
</view>
<view class="uni-btn-v">
<view class="uni-btn-v">
<button type="primary" @click="playbackRate(rate)">设置倍速</button>
<enum-data title="选择倍速" :items="rateItemTypes" @change="onPlaybackRateChange"></enum-data>
<button type="primary" @click="playbackRate">设置倍速</button>
</view>
</view>
<view class="uni-title">
<view class="uni-title">
<text class="uni-title-text">属性示例</text>
<text class="uni-title-text">属性示例</text>
</view>
</view>
<view class="uni-btn-v">
<input class="input margin-10" type="string" placeholder="设置播放资源" @confirm="onSrcComfirm"></input>
<button type="primary" @click="setSrc(_src)">设置播放资源</button>
<input class="input margin-10" type="number" placeholder="设置初始播放位置(播放前设置有效)" @confirm="onInitialTimeComfirm"></input>
</view>
<input class="input margin-10" type="number" placeholder="设置视频时长(播放前设置有效)" @confirm="onDurationComfirm"></input>
<view class="uni-btn-v">
<input class="input margin-10" type="string" placeholder="设置视频封面" @confirm="onPosterComfirm"></input>
<button type="primary" @click="setAutoplay()">设置是否自动播放(未播放时设置有效)</button>
<input class="input margin-10" type="string" placeholder="设置视频标题(仅限非 Web 平台)" @confirm="onTitleComfirm"></input>
</view>
<input class="input margin-10" type="string" placeholder="设置header(json格式)" @confirm="onHeaderComfirm"></input>
<view class="uni-btn-v">
<boolean-data title="设置是否展示弹幕(播放前设置有效)" :defaultValue="enableDanmu" @change="onEnableDanmuChange"></boolean-data>
<button type="primary" @click="setLoop()">设置是否循环播放(本次播放完成后生效)</button>
<boolean-data title="设置是否自动播放(播放前设置有效)" :defaultValue="autoplay" @change="onAutoplayChange"></boolean-data>
</view>
<boolean-data title="设置是否循环播放(播放完成后生效)" :defaultValue="loop" @change="onLoopChange"></boolean-data>
<view class="uni-btn-v">
<boolean-data title="设置是否静音播放" :defaultValue="muted" @change="onMutedChange"></boolean-data>
<button type="primary" @click="setMuted()">设置是否静音播放</button>
<boolean-data title="设置是否显示默认播放控件" :defaultValue="controls" @change="onControlsChange"></boolean-data>
</view>
<boolean-data title="设置是否显示弹幕按钮" :defaultValue="danmuBtn" @change="onDanmuBtnChange"></boolean-data>
<view class="uni-btn-v">
<boolean-data title="设置是否显示进度条" :defaultValue="showProgress" @change="onShowProgressChange"></boolean-data>
<button type="primary" @click="setInitialTime(_initialTime)">设置初始播放位置(本次播放完成后生效)</button>
<boolean-data title="设置是否显示全屏按钮" :defaultValue="showFullscreenBtn" @change="onShowFullscreenBtnChange"></boolean-data>
</view>
<boolean-data title="设置是否显示视频底部控制栏的播放按钮" :defaultValue="showPlayBtn" @change="onShowPlayBtnChange"></boolean-data>
<view class="uni-btn-v">
<boolean-data title="设置是否显示静音按钮(仅限非 Web 平台)" :defaultValue="showMuteBtn" @change="onShowMuteBtnChange"></boolean-data>
<button type="primary" @click="setDuration(_duration)">设置视频时长(未播放时设置有效)</button>
<enum-data title="设置全屏时视频的方向" :items="directionItemTypes" @change="onDirectionChange"></enum-data>
</view>
<boolean-data title="设置是否显示视频中间的播放按钮" :defaultValue="showCenterPlayBtn" @change="onShowCenterPlayBtnChange"></boolean-data>
<view class="uni-btn-v">
<boolean-data title="设置是否显示loading控件" :defaultValue="showLoading" @change="onShowLoadingChange"></boolean-data>
<button type="primary" @click="setControls()">设置是否显示默认播放控件</button>
<boolean-data title="设置是否开启控制进度的手势" :defaultValue="enableProgressGesture" @change="onEnableProgressGestureChange"></boolean-data>
</view>
<boolean-data title="设置是否开启播放手势(仅限非 Web 平台)" :defaultValue="enablePlayGesture" @change="onEnablePlayGestureChange"></boolean-data>
<view class="uni-btn-v">
<button type="primary" @click="setDanmuBtn()">设置是否显示弹幕按钮</button>
</view>
<!-- #ifndef WEB -->
<!-- #ifndef WEB -->
<view class="uni-btn-v">
<boolean-data title="非全屏模式下,设置是否开启亮度与音量调节手势" :defaultValue="pageGesture" @change="onPageGestureChange"></boolean-data>
<button type="primary" @click="setPageGesture()">非全屏模式下,设置是否开启亮度与音量调节手势</button>
</view>
<!-- #endif -->
<!-- #endif -->
<view class="uni-btn-v">
<boolean-data title="非全屏模式下,设置是否开启亮度与音量调节手势(仅限非 Web 平台)" :defaultValue="vslideGesture" @change="onVslideGestureChange"></boolean-data>
<button type="primary" @click="setDirection(_direction)">设置全屏时视频的方向</button>
<boolean-data title="全屏模式下,设置是否开启亮度与音量调节手势(仅限非 Web 平台)" :defaultValue="vslideGestureInFullscreen" @change="onVslideGestureInFullscreenChange"></boolean-data>
</view>
<boolean-data title="设置是否对http、https视频源开启本地缓存(仅 App 平台,播放前设置有效)" :defaultValue="httpCache" @change="onHttpCacheChange"></boolean-data>
<view class="uni-btn-v">
<enum-data title="设置视频大小与video容器大小不一致时,视频的表现形式" :items="objectFitItemTypes" @change="onObjectFitChange"></enum-data>
<button type="primary" @click="setShowProgress()">设置是否显示进度条</button>
<enum-data title="设置解码器(仅 App 平台,播放前设置有效)" :items="codecItemTypes" @change="onCodecChange"></enum-data>
</view>
<enum-data title="设置播放策略(仅 App 平台,播放前设置有效)" :items="playStrategyItemTypes" @change="onPlayStrategyChange"></enum-data>
<view class="uni-btn-v">
<button type="primary" @click="setShowFullscreenBtn()">设置是否显示全屏按钮</button>
</view>
<view class="uni-btn-v">
<button type="primary" @click="setShowPlayBtn()">设置是否显示视频底部控制栏的播放按钮</button>
</view>
<view class="uni-btn-v">
<button type="primary" @click="setShowCenterPlayBtn()">设置是否显示视频中间的播放按钮</button>
</view>
<view class="uni-btn-v">
<button type="primary" @click="setShowLoading()">设置是否显示loading控件</button>
</view>
<view class="uni-btn-v">
<button type="primary" @click="setEnableProgressGesture()">设置是否开启控制进度的手势</button>
</view>
<view class="uni-btn-v">
<button type="primary" @click="setObjectFit(_objectFit)">设置视频大小与video容器大小不一致时,视频的表现形式</button>
</view>
<view class="uni-btn-v">
<button type="primary" @click="setPoster(_poster)">设置视频封面</button>
</view>
<view class="uni-btn-v">
<button type="primary" @click="setShowMuteBtn()">设置是否显示静音按钮(仅限非 Web 平台)</button>
</view>
<view class="uni-btn-v">
<button type="primary" @click="setTitle(_title)">设置视频标题(仅限非 Web 平台)</button>
</view>
<view class="uni-btn-v">
<button type="primary" @click="setEnablePlayGesture()">设置是否开启播放手势(仅限非 Web 平台)</button>
</view>
<view class="uni-btn-v">
<button type="primary" @click="setVslideGesture()">非全屏模式下,设置是否开启亮度与音量调节手势(仅限非 Web 平台)</button>
</view>
<view class="uni-btn-v">
<button type="primary" @click="setVslideGestureInFullscreen()">全屏模式下,设置是否开启亮度与音量调节手势(仅限非 Web 平台)</button>
</view>
<view class="uni-btn-v">
<button type="primary" @click="setCodec(_codec)">设置解码器(仅 App 平台,未播放时设置有效)</button>
</view>
<view class="uni-btn-v">
<button type="primary" @click="setHttpCache()">设置是否对http、https视频源开启本地缓存(仅 App 平台,未播放时设置有效)</button>
</view>
<view class="uni-btn-v">
<button type="primary" @click="setPlayStrategy(_playStrategy)">设置播放策略(仅 App 平台,未播放时设置有效)</button>
</view>
<view class="uni-btn-v">
<button type="primary" @click="setHeader(_header)">设置header</button>
</view>
</scroll-view>
</scroll-view>
<video v-if="autoTest" :src="localSrc" @error="onError"></video>
<video v-if="autoTest" :src="localSrc" @error="onError"></video>
</view>
</view>
</template>
</template>
<script>
<script>
import { ItemType } from '@/components/enum-data/enum-data';
export default {
export default {
onReady() {
onReady() {
this.videoContext = uni.createVideoContext('video', this);
this.videoContext = uni.createVideoContext('video', this);
...
@@ -146,14 +97,11 @@
...
@@ -146,14 +97,11 @@
videoContext: null as VideoContext | null,
videoContext: null as VideoContext | null,
// 属性
// 属性
src: "https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.mp4",
src: "https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.mp4",
_src: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-app-video-courses.mp4",
autoplay: false,
autoplay: false,
loop: false,
loop: false,
muted: false,
muted: false,
initialTime: 0,
initialTime: 0,
_initialTime: 6,
duration: 0,
duration: 0,
_duration: 60,
controls: true,
controls: true,
danmuList: [{
danmuList: [{
text: '要显示的文本',
text: '要显示的文本',
...
@@ -180,10 +128,8 @@
...
@@ -180,10 +128,8 @@
enableDanmu: true,
enableDanmu: true,
pageGesture: false,
pageGesture: false,
direction: -1,
direction: -1,
_direction: 0,
directionItemTypes: [{ "value": 0, "name": "0(正常竖向)" }, { "value": 1, "name": "90(屏幕逆时针90度)" }, { "value": 2, "name": "-90(屏幕顺时针90度)" }] as ItemType[],
requestFullScreenOptions: {
directionItems: [0, 90, -90],
direction: -90
} as RequestFullScreenOptions,
showProgress: true,
showProgress: true,
showFullscreenBtn: true,
showFullscreenBtn: true,
showPlayBtn: true,
showPlayBtn: true,
...
@@ -191,37 +137,38 @@
...
@@ -191,37 +137,38 @@
showLoading: true,
showLoading: true,
enableProgressGesture: true,
enableProgressGesture: true,
objectFit: "contain",
objectFit: "contain",
_objectFit: "fill",
objectFitItemTypes: [{ "value": 0, "name": "contain(包含)" }, { "value": 1, "name": "fill(填充)" }, { "value": 2, "name": "cover(覆盖)" }] as ItemType[],
objectFitItems: ["contain", "fill", "cover"],
poster: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-android.png",
poster: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-android.png",
_poster: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-ios.png",
showMuteBtn: false,
showMuteBtn: false,
title: "video-component",
title: "video-component",
_title: "video-component video-component",
enablePlayGesture: false,
enablePlayGesture: false,
vslideGesture: false,
vslideGesture: false,
vslideGestureInFullscreen: true,
vslideGestureInFullscreen: true,
codec: "hardware",
codec: "hardware",
_codec: "software",
codecItemTypes: [{ "value": 0, "name": "hardware(硬解码)" }, { "value": 1, "name": "software(软解码)" }] as ItemType[],
codecItems: ["hardware", "software"],
httpCache: true,
httpCache: true,
playStrategy: 0,
playStrategy: 0,
_playStrategy: 2,
playStrategyItemTypes: [{ "value": 0, "name": "0(普通模式)" }, { "value": 1, "name": "1(平滑播放模式)" }, { "value": 1, "name": "2(M3U8优化模式)" }] as ItemType[],
playStrategyItems: [0, 1, 2],
header: {
header: {
'User-Agent': 'User-Agent test',
'User-Agent': 'User-Agent test',
'header': 'header test',
'header': 'header test',
'cookie': 'cookie test'
'cookie': 'cookie test'
} as UTSJSONObject,
} as UTSJSONObject,
_header: {
'User-Agent': 'User-Agent test2',
'header': 'header test2',
'cookie': 'cookie test2'
} as UTSJSONObject,
// API
// API
pos: 10,
pos: 0,
rate: 1.5,
requestFullScreenOptions: {
direction: -90
} as RequestFullScreenOptions,
danmu: {
danmu: {
text: '要显示的文本',
text: '要显示的文本',
color: '#FF0000'
color: '#FF0000'
} as Danmu,
} as Danmu,
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],
// 自动化测试
// 自动化测试
autoTest: false,
autoTest: false,
isPlaying: false,
isPlaying: false,
...
@@ -243,13 +190,16 @@
...
@@ -243,13 +190,16 @@
(uni.getElementById("video") as UniVideoElement).pause(); //as写法测试。注意id不对时as会崩溃
(uni.getElementById("video") as UniVideoElement).pause(); //as写法测试。注意id不对时as会崩溃
// this.videoContext?.pause();
// this.videoContext?.pause();
},
},
seek: function (
pos : number
) {
seek: function () {
console.log("seek -> " + pos);
console.log("seek -> " +
this.
pos);
this.videoContext?.seek(pos);
this.videoContext?.seek(
this.
pos);
},
},
requestFullScreen: function (options : RequestFullScreenOptions | null) {
onSeekInput: function (event : UniInputEvent) {
console.log("requestFullScreen -> " + options);
this.pos = parseInt(event.detail.value);
this.videoContext?.requestFullScreen(options);
},
requestFullScreen: function () {
console.log("requestFullScreen -> " + this.requestFullScreenOptions);
this.videoContext?.requestFullScreen(this.requestFullScreenOptions);
},
},
exitFullScreen: function () {
exitFullScreen: function () {
console.log("exitFullScreen");
console.log("exitFullScreen");
...
@@ -260,121 +210,151 @@
...
@@ -260,121 +210,151 @@
uni.getElementById<UniVideoElement>("video")?.stop(); //泛型写法测试
uni.getElementById<UniVideoElement>("video")?.stop(); //泛型写法测试
// this.videoContext?.stop();
// this.videoContext?.stop();
},
},
sendDanmu: function (danmu : Danmu) {
sendDanmu: function () {
console.log("sendDanmu -> " + danmu);
console.log("sendDanmu -> " + this.danmu);
this.videoContext?.sendDanmu(danmu);
this.videoContext?.sendDanmu(this.danmu);
},
onSendDanmuInput: function (event : UniInputEvent) {
let json = JSON.parse<Danmu>(event.detail.value)
if (json == null) return;
this.danmu = json as Danmu;
},
},
playbackRate: function (rate : number) {
playbackRate: function () {
console.log("playbackRate -> " + rate);
console.log("playbackRate -> " + this.rate);
this.videoContext?.playbackRate(rate);
this.videoContext?.playbackRate(this.rate);
},
onPlaybackRateChange: function (value : number) {
this.rate = this.rateItems[value];
},
},
// 属性
// 属性
setSrc: function (src : string) {
onSrcComfirm: function (event : UniInputConfirmEvent) {
this.src = src;
let value = event.detail.value;
if (value == '') return;
this.src = value;
console.log("src -> " + this.src)
console.log("src -> " + this.src)
},
},
setAutoplay: function (
) {
onAutoplayChange: function (value : boolean
) {
this.autoplay =
!this.autoplay
;
this.autoplay =
value
;
console.log("autoplay -> " + this.autoplay)
console.log("autoplay -> " + this.autoplay)
},
},
setLoop: function (
) {
onLoopChange: function (value : boolean
) {
this.loop =
!this.loop
;
this.loop =
value
;
console.log("loop -> " + this.loop)
console.log("loop -> " + this.loop)
},
},
setMuted: function (
) {
onMutedChange: function (value : boolean
) {
this.muted =
!this.muted
;
this.muted =
value
;
console.log("muted -> " + this.muted)
console.log("muted -> " + this.muted)
},
},
setInitialTime: function (initialTime : number) {
onInitialTimeComfirm: function (event : UniInputConfirmEvent) {
this.initialTime = initialTime;
let value = parseInt(event.detail.value)
if (value == NaN) value = 0;
this.initialTime = value;
console.log("initialTime -> " + this.initialTime)
console.log("initialTime -> " + this.initialTime)
},
},
setDuration: function (duration : number) {
onDurationComfirm: function (event : UniInputConfirmEvent) {
this.duration = duration;
let value = parseInt(event.detail.value)
if (value == NaN) value = 0;
this.duration = value;
console.log("duration -> " + this.duration)
console.log("duration -> " + this.duration)
},
},
setControls: function (
) {
onControlsChange: function (value : boolean
) {
this.controls =
!this.controls
;
this.controls =
value
;
console.log("controls -> " + this.controls)
console.log("controls -> " + this.controls)
},
},
setDanmuBtn: function () {
onEnableDanmuChange: function (value : boolean) {
this.danmuBtn = !this.danmuBtn;
this.enableDanmu = value;
console.log("enableDanmu -> " + this.enableDanmu)
},
onDanmuBtnChange: function (value : boolean) {
this.danmuBtn = value;
console.log("danmuBtn -> " + this.danmuBtn)
console.log("danmuBtn -> " + this.danmuBtn)
},
},
setPageGesture: function (
) {
onPageGestureChange: function (value : boolean
) {
this.pageGesture =
!this.pageGestur
e;
this.pageGesture =
valu
e;
console.log("pageGesture -> " + this.pageGesture)
console.log("pageGesture -> " + this.pageGesture)
},
},
setDirection: function (direction : number) {
onRequestFullScreenDirectionChange: function (value : number) {
this.direction = direction;
let direction = this.directionItems[value];
this.requestFullScreenOptions = {
direction
} as RequestFullScreenOptions;
},
onDirectionChange: function (value : number) {
this.direction = this.directionItems[value];
console.log("direction -> " + this.direction)
console.log("direction -> " + this.direction)
},
},
setShowProgress: function (
) {
onShowProgressChange: function (value : boolean
) {
this.showProgress =
!this.showProgress
;
this.showProgress =
value
;
console.log("showProgress -> " + this.showProgress)
console.log("showProgress -> " + this.showProgress)
},
},
setShowFullscreenBtn: function (
) {
onShowFullscreenBtnChange: function (value : boolean
) {
this.showFullscreenBtn =
!this.showFullscreenBtn
;
this.showFullscreenBtn =
value
;
console.log("showFullscreenBtn -> " + this.showFullscreenBtn)
console.log("showFullscreenBtn -> " + this.showFullscreenBtn)
},
},
setShowPlayBtn: function (
) {
onShowPlayBtnChange: function (value : boolean
) {
this.showPlayBtn =
!this.showPlayBtn
;
this.showPlayBtn =
value
;
console.log("showPlayBtn -> " + this.showPlayBtn)
console.log("showPlayBtn -> " + this.showPlayBtn)
},
},
setShowCenterPlayBtn: function (
) {
onShowCenterPlayBtnChange: function (value : boolean
) {
this.showCenterPlayBtn =
!this.showCenterPlayBtn
;
this.showCenterPlayBtn =
value
;
console.log("showCenterPlayBtn -> " + this.showCenterPlayBtn)
console.log("showCenterPlayBtn -> " + this.showCenterPlayBtn)
},
},
setShowLoading: function (
) {
onShowLoadingChange: function (value : boolean
) {
this.showLoading =
!this.showLoading
;
this.showLoading =
value
;
console.log("showLoading -> " + this.showLoading)
console.log("showLoading -> " + this.showLoading)
},
},
setEnableProgressGesture: function (
) {
onEnableProgressGestureChange: function (value : boolean
) {
this.enableProgressGesture =
!this.enableProgressGestur
e;
this.enableProgressGesture =
valu
e;
console.log("enableProgressGesture -> " + this.enableProgressGesture)
console.log("enableProgressGesture -> " + this.enableProgressGesture)
},
},
setObjectFit: function (objectFit : string
) {
onObjectFitChange: function (value : number
) {
this.objectFit =
objectFit
;
this.objectFit =
this.objectFitItems[value]
;
console.log("objectFit -> " + this.objectFit)
console.log("objectFit -> " + this.objectFit)
},
},
setPoster: function (poster : string) {
onPosterComfirm: function (event : UniInputConfirmEvent) {
this.poster = poster;
let value = event.detail.value;
if (value == '') return;
this.poster = value;
console.log("poster -> " + this.poster)
console.log("poster -> " + this.poster)
},
},
setShowMuteBtn: function (
) {
onShowMuteBtnChange: function (value : boolean
) {
this.showMuteBtn =
!this.showMuteBtn
;
this.showMuteBtn =
value
;
console.log("showMuteBtn -> " + this.showMuteBtn)
console.log("showMuteBtn -> " + this.showMuteBtn)
},
},
setTitle: function (title : string) {
onTitleComfirm: function (event : UniInputConfirmEvent) {
this.title = title;
let value = event.detail.value;
if (value == '') return;
this.title = value;
console.log("title -> " + this.title)
console.log("title -> " + this.title)
},
},
setEnablePlayGesture: function (
) {
onEnablePlayGestureChange: function (value : boolean
) {
this.enablePlayGesture =
!this.enablePlayGestur
e;
this.enablePlayGesture =
valu
e;
console.log("enablePlayGesture -> " + this.enablePlayGesture)
console.log("enablePlayGesture -> " + this.enablePlayGesture)
},
},
setVslideGesture: function (
) {
onVslideGestureChange: function (value : boolean
) {
this.vslideGesture =
!this.vslideGestur
e;
this.vslideGesture =
valu
e;
console.log("vslideGesture -> " + this.vslideGesture)
console.log("vslideGesture -> " + this.vslideGesture)
},
},
setVslideGestureInFullscreen: function (
) {
onVslideGestureInFullscreenChange: function (value : boolean
) {
this.vslideGestureInFullscreen =
!this.vslideGestureInFullscreen
;
this.vslideGestureInFullscreen =
value
;
console.log("vslideGestureInFullscreen -> " + this.vslideGestureInFullscreen)
console.log("vslideGestureInFullscreen -> " + this.vslideGestureInFullscreen)
},
},
setCodec: function (codec : string
) {
onCodecChange: function (value : number
) {
this.codec =
codec
;
this.codec =
this.codecItems[value]
;
console.log("codec -> " + this.codec)
console.log("codec -> " + this.codec)
},
},
setHttpCache: function (
) {
onHttpCacheChange: function (value : boolean
) {
this.httpCache =
!this.httpCach
e;
this.httpCache =
valu
e;
console.log("httpCache -> " + this.httpCache)
console.log("httpCache -> " + this.httpCache)
},
},
setPlayStrategy: function (playStrategy
: number) {
onPlayStrategyChange: function (value
: number) {
this.playStrategy =
playStrategy
;
this.playStrategy =
this.playStrategyItems[value]
;
console.log("playStrategy -> " + this.playStrategy)
console.log("playStrategy -> " + this.playStrategy)
},
},
setHeader: function (header : UTSJSONObject) {
onHeaderComfirm: function (event : UniInputConfirmEvent) {
this.header = header;
let json = JSON.parse(event.detail.value)
if (json == null) return;
this.header = json as UTSJSONObject;
console.log("header -> " + JSON.stringify(this.header))
console.log("header -> " + JSON.stringify(this.header))
},
},
// 事件
// 事件
...
@@ -413,9 +393,6 @@
...
@@ -413,9 +393,6 @@
onControlsToggle: function (res : UniVideoControlsToggleEvent) {
onControlsToggle: function (res : UniVideoControlsToggleEvent) {
console.log(res.type + " -> " + JSON.stringify(res.detail));
console.log(res.type + " -> " + JSON.stringify(res.detail));
},
},
onSrcInputConfirm(event : UniInputConfirmEvent) {
this.src = event.detail.value;
},
// 自动化测试
// 自动化测试
downloadSource() {
downloadSource() {
uni.downloadFile({
uni.downloadFile({
...
@@ -442,6 +419,10 @@
...
@@ -442,6 +419,10 @@
.input {
.input {
height: 40px;
height: 40px;
background: #FFF;
background: #FFF;
margin: 5px 0;
padding: 8px 13px;
}
.margin-10 {
margin: 10px;
}
}
</style>
</style>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录