提交 4d6d19f9 编写于 作者: DCloud-yinjiacheng's avatar DCloud-yinjiacheng

更新video示例

上级 3d0c1bec
<template> <template>
<view class="uni-flex-item"> <view class="uni-flex-item">
<video class="video" ref="video" :header="header" :src=src :autoplay="autoplay" :loop="loop" :muted="muted" <video class="video" ref="video" id="video" :header="header" :src=src :autoplay="autoplay" :loop="loop"
:initial-time="initialTime" :duration="duration" :controls="controls" :danmu-btn="danmuBtn" :muted="muted" :initial-time="initialTime" :duration="duration" :controls="controls" :danmu-btn="danmuBtn"
:enable-danmu="enableDanmu" :page-gesture="pageGesture" :direction="direction" :show-progress="showProgress" :enable-danmu="enableDanmu" :page-gesture="pageGesture" :direction="direction" :show-progress="showProgress"
:show-fullscreen-btn="showFullscreenBtn" :show-play-btn="showPlayBtn" :show-fullscreen-btn="showFullscreenBtn" :show-play-btn="showPlayBtn" :show-center-play-btn="showCenterPlayBtn"
:show-center-play-btn="showCenterPlayBtn" :show-loading="showLoading" :show-loading="showLoading" :enable-progress-gesture="enableProgressGesture" :object-fit="objectFit"
:enable-progress-gesture="enableProgressGesture" :object-fit="objectFit" :poster="poster" :poster="poster" :show-mute-btn="showMuteBtn" :title="title" :enable-play-gesture="enablePlayGesture"
:show-mute-btn="showMuteBtn" :title="title" :enable-play-gesture="enablePlayGesture" :vslide-gesture="vslideGesture" :vslide-gesture-in-fullscreen="vslideGestureInFullscreen" :codec="codec"
:vslide-gesture="vslideGesture" :vslide-gesture-in-fullscreen="vslideGestureInFullscreen" :codec="codec" :http-cache="httpCache" :play-strategy="playStrategy" :danmu-list="danmuList" @play="onPlay" @pause="onPause"
:http-cache="httpCache" :play-strategy="playStrategy" :danmu-list="danmuList" @play="onPlay" @ended="onEnded" @timeupdate="onTimeUpdate" @waiting="onWaiting" @error="onError" @progress="onProgress"
@pause="onPause" @ended="onEnded" @timeupdate="onTimeUpdate" @waiting="onWaiting" @error="onError" @fullscreenclick="onFullScreenClick" @controlstoggle="onControlsToggle" @fullscreenchange="onFullScreenChange">
@progress="onProgress" @fullscreenclick="onFullScreenClick" @controlstoggle="onControlsToggle" </video>
@fullscreenchange="onFullScreenChange"> <scroll-view class="uni-padding-wrap uni-common-mt uni-flex-item">
</video> <view class="uni-title">
<scroll-view class="uni-padding-wrap uni-common-mt uni-flex-item"> <text class="uni-title-text">API示例</text>
<view class="uni-title"> </View>
<text class="uni-title-text">API示例</text> <view class="uni-btn-v">
</View> <button type="primary" @click="play">播放</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="play">播放</button> <view class="uni-btn-v">
</view> <button type="primary" @click="pause">暂停</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="pause">暂停</button> <view class="uni-btn-v">
</view> <button type="primary" @click="seek(pos)">跳转到指定位置</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="seek(pos)">跳转到指定位置</button> <view class="uni-btn-v">
</view> <button type="primary" @click="requestFullScreen(direction)">进入全屏</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="requestFullScreen(direction)">进入全屏</button> <view class="uni-btn-v">
</view> <button type="primary" @click="exitFullScreen">退出全屏</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="exitFullScreen">退出全屏</button> <view class="uni-btn-v">
</view> <button type="primary" @click="stop">停止</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="stop">停止</button> <view class="uni-btn-v">
</view> <button type="primary" @click="hide">隐藏</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="hide">隐藏</button> <view class="uni-btn-v">
</view> <button type="primary" @click="show">显示</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="show">显示</button> <view class="uni-btn-v">
</view> <button type="primary" @click="close">关闭</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="close">关闭</button> <view class="uni-btn-v">
</view> <button type="primary" @click="sendDanmu(danmu)">发送弹幕</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="sendDanmu(danmu)">发送弹幕</button> <view class="uni-btn-v">
</view> <button type="primary" @click="playbackRate(rate)">设置倍速</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="playbackRate(rate)">设置倍速</button> <view class="uni-title">
</view> <text class="uni-title-text uni-center">属性示例</text>
<view class="uni-title"> </view>
<text class="uni-title-text uni-center">属性示例</text> <view class="uni-btn-v">
</view> <button type="primary" @click="setSrc(_src)">设置播放资源</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setSrc(_src)">设置播放资源</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setAutoplay()">设置是否自动播放(未播放时设置有效)</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setAutoplay()">设置是否自动播放(未播放时设置有效)</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setLoop()">设置是否循环播放(本次播放完成后生效)</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setLoop()">设置是否循环播放(本次播放完成后生效)</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setMuted()">设置是否静音播放</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setMuted()">设置是否静音播放</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setInitialTime(_initialTime)">设置初始播放位置(本次播放完成后生效)</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setInitialTime(_initialTime)">设置初始播放位置(本次播放完成后生效)</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setDuration(_duration)">设置视频时长(未播放时设置有效)</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setDuration(_duration)">设置视频时长(未播放时设置有效)</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setControls()">设置是否显示默认播放控件</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setControls()">设置是否显示默认播放控件</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setDanmuBtn()">设置是否显示弹幕按钮</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setDanmuBtn()">设置是否显示弹幕按钮</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setPageGesture()">非全屏模式下,设置是否开启亮度与音量调节手势</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setPageGesture()">非全屏模式下,设置是否开启亮度与音量调节手势</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setDirection(_direction)">设置全屏时视频的方向</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setDirection(_direction)">设置全屏时视频的方向</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setShowProgress()">设置是否显示进度条</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setShowProgress()">设置是否显示进度条</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setShowFullscreenBtn()">设置是否显示全屏按钮</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setShowFullscreenBtn()">设置是否显示全屏按钮</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setShowPlayBtn()">设置是否显示视频底部控制栏的播放按钮</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setShowPlayBtn()">设置是否显示视频底部控制栏的播放按钮</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setShowCenterPlayBtn()">设置是否显示视频中间的播放按钮</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setShowCenterPlayBtn()">设置是否显示视频中间的播放按钮</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setShowLoading()">设置是否显示loading控件</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setShowLoading()">设置是否显示loading控件</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setEnableProgressGesture()">设置是否开启控制进度的手势</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setEnableProgressGesture()">设置是否开启控制进度的手势</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setObjectFit(_objectFit)">设置视频大小与video容器大小不一致时,视频的表现形式</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setObjectFit(_objectFit)">设置视频大小与video容器大小不一致时,视频的表现形式</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setPoster(_poster)">设置视频封面</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setPoster(_poster)">设置视频封面</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setShowMuteBtn()">设置是否显示静音按钮</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setShowMuteBtn()">设置是否显示静音按钮</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setTitle(_title)">设置视频标题</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setTitle(_title)">设置视频标题</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setEnablePlayGesture()">设置是否开启播放手势</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setEnablePlayGesture()">设置是否开启播放手势</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setVslideGesture()">非全屏模式下,设置是否开启亮度与音量调节手势</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setVslideGesture()">非全屏模式下,设置是否开启亮度与音量调节手势</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setVslideGestureInFullscreen()">全屏模式下,设置是否开启亮度与音量调节手势</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setVslideGestureInFullscreen()">全屏模式下,设置是否开启亮度与音量调节手势</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setCodec(_codec)">设置解码器(未播放时设置有效)</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setCodec(_codec)">设置解码器(未播放时设置有效)</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setHttpCache()">设置是否对http、https视频源开启本地缓存(未播放时设置有效)</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setHttpCache()">设置是否对http、https视频源开启本地缓存(未播放时设置有效)</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setPlayStrategy(_playStrategy)">设置播放策略(未播放时设置有效)</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setPlayStrategy(_playStrategy)">设置播放策略(未播放时设置有效)</button> <view class="uni-btn-v">
</view> <button type="primary" @click="setHeader(_header)">设置header</button>
<view class="uni-btn-v"> </view>
<button type="primary" @click="setHeader(_header)">设置header</button> </scroll-view>
</view> </view>
</scroll-view>
</view>
</template> </template>
<script lang="uts"> <script lang="uts">
import { VideoNode } from "uts.sdk.modules.DCloudUniVideo"; import { VideoNode } from "uts.sdk.modules.DCloudUniVideo";
export default { export default {
data() { onReady() {
return { this.videoContext = uni.createVideoContext('video', this);
// 属性 },
src: "https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20181126-lite.m4v", data() {
_src: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-app-video-courses.mp4", return {
autoplay: false, videoContext: null as VideoContext | null,
loop: false, // 属性
muted: false, src: "https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20181126-lite.m4v",
initialTime: 0, _src: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-app-video-courses.mp4",
_initialTime: 6, autoplay: false,
duration: -1, loop: false,
_duration: 60, muted: false,
controls: true, initialTime: 0,
danmuList: [{ _initialTime: 6,
text: '要显示的文本', duration: -1,
color: '#FF0000', _duration: 60,
time: 3 controls: true,
}, { danmuList: [{
text: '要显示的文本2', text: '要显示的文本',
color: '#31ff23', color: '#FF0000',
time: 5 time: 3
}, { }, {
text: '要显示的文本3', text: '要显示的文本2',
color: '#f13ef8', color: '#31ff23',
time: 7 time: 5
}, { }, {
text: '要显示的文本4', text: '要显示的文本3',
color: '#4972f8', color: '#f13ef8',
time: 9 time: 7
}, { }, {
text: '要显示的文本5', text: '要显示的文本4',
color: '#000000', color: '#4972f8',
time: 11 time: 9
}] as Array<UTSJSONObject>, }, {
danmuBtn: false, text: '要显示的文本5',
enableDanmu: true, color: '#000000',
pageGesture: false, time: 11
direction: 0, }] as Array<Danmu>,
_direction: -90, danmuBtn: false,
showProgress: true, enableDanmu: true,
showFullscreenBtn: true, pageGesture: false,
showPlayBtn: true, direction: {
showCenterPlayBtn: true, direction: 0
showLoading: true, } as RequestFullScreenOptions,
enableProgressGesture: true, _direction: {
objectFit: "contain", direction: -90
_objectFit: "fill", } as RequestFullScreenOptions,
poster: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-android.png", showProgress: true,
_poster: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-ios.png", showFullscreenBtn: true,
showMuteBtn: false, showPlayBtn: true,
title: "video-component", showCenterPlayBtn: true,
_title: "video-component video-component", showLoading: true,
enablePlayGesture: false, enableProgressGesture: true,
vslideGesture: false, objectFit: "contain",
vslideGestureInFullscreen: true, _objectFit: "fill",
codec: "hardware", poster: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-android.png",
_codec: "software", _poster: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-ios.png",
httpCache: true, showMuteBtn: false,
playStrategy: 0, title: "video-component",
_playStrategy: 2, _title: "video-component video-component",
header: { enablePlayGesture: false,
'User-Agent': 'header test' vslideGesture: false,
} as UTSJSONObject, vslideGestureInFullscreen: true,
_header: { codec: "hardware",
'User-Agent': 'header test2' _codec: "software",
} as UTSJSONObject, httpCache: true,
// API playStrategy: 0,
pos: 10, _playStrategy: 2,
rate: "1.5", header: {
danmu: { 'User-Agent': 'header test'
text: '要显示的文本', } as UTSJSONObject,
color: '#FF0000' _header: {
} as UTSJSONObject 'User-Agent': 'header test2'
} } as UTSJSONObject,
}, // API
methods: { pos: 10,
// API rate: 1.5,
play: function () { danmu: {
console.log("play"); text: '要显示的文本',
(this.$refs["video"] as VideoNode).play(); color: '#FF0000'
}, } as Danmu
pause: function () { }
console.log("pause"); },
(this.$refs["video"] as VideoNode).pause(); methods: {
}, // API
seek: function (pos : number) { play: function () {
console.log("seek -> " + pos); console.log("play");
(this.$refs["video"] as VideoNode).seek(pos); this.videoContext?.play();
}, },
requestFullScreen: function (direction : number) { pause: function () {
console.log("requestFullScreen -> " + direction); console.log("pause");
(this.$refs["video"] as VideoNode).requestFullScreen(direction); this.videoContext?.pause();
}, },
exitFullScreen: function () { seek: function (pos : number) {
console.log("exitFullScreen"); console.log("seek -> " + pos);
(this.$refs["video"] as VideoNode).exitFullScreen(); this.videoContext?.seek(pos);
}, },
stop: function () { requestFullScreen: function (options : RequestFullScreenOptions) {
console.log("stop"); console.log("requestFullScreen -> " + options);
(this.$refs["video"] as VideoNode).stop(); this.videoContext?.requestFullScreen(options);
}, },
hide: function () { exitFullScreen: function () {
console.log("hide"); console.log("exitFullScreen");
(this.$refs["video"] as VideoNode).hide(); this.videoContext?.exitFullScreen();
}, },
show: function () { stop: function () {
console.log("show"); console.log("stop");
(this.$refs["video"] as VideoNode).show(); (this.$refs["video"] as VideoNode).stop();
}, },
close: function () { hide: function () {
console.log("close"); console.log("hide");
(this.$refs["video"] as VideoNode).close(); (this.$refs["video"] as VideoNode).hide();
}, },
sendDanmu: function (data : UTSJSONObject) { show: function () {
console.log("sendDanmu -> " + data); console.log("show");
(this.$refs["video"] as VideoNode).sendDanmu(data); (this.$refs["video"] as VideoNode).show();
}, },
playbackRate: function (rate : string) { close: function () {
console.log("playbackRate -> " + rate); console.log("close");
(this.$refs["video"] as VideoNode).playbackRate(rate); (this.$refs["video"] as VideoNode).close();
}, },
// 属性 sendDanmu: function (danmu : Danmu) {
setSrc: function (src : string) { console.log("sendDanmu -> " + danmu);
this.src = src; this.videoContext?.sendDanmu(danmu);
console.log("src -> " + this.src) },
}, playbackRate: function (rate : number) {
setAutoplay: function () { console.log("playbackRate -> " + rate);
this.autoplay = !this.autoplay; this.videoContext?.playbackRate(rate);
console.log("autoplay -> " + this.autoplay) },
}, // 属性
setLoop: function () { setSrc: function (src : string) {
this.loop = !this.loop; this.src = src;
console.log("loop -> " + this.loop) console.log("src -> " + this.src)
}, },
setMuted: function () { setAutoplay: function () {
this.muted = !this.muted; this.autoplay = !this.autoplay;
console.log("muted -> " + this.muted) console.log("autoplay -> " + this.autoplay)
}, },
setInitialTime: function (initialTime : number) { setLoop: function () {
this.initialTime = initialTime; this.loop = !this.loop;
console.log("initialTime -> " + this.initialTime) console.log("loop -> " + this.loop)
}, },
setDuration: function (duration : number) { setMuted: function () {
this.duration = duration; this.muted = !this.muted;
console.log("duration -> " + this.duration) console.log("muted -> " + this.muted)
}, },
setControls: function () { setInitialTime: function (initialTime : number) {
this.controls = !this.controls; this.initialTime = initialTime;
console.log("controls -> " + this.controls) console.log("initialTime -> " + this.initialTime)
}, },
setDanmuBtn: function () { setDuration: function (duration : number) {
this.danmuBtn = !this.danmuBtn; this.duration = duration;
console.log("danmuBtn -> " + this.danmuBtn) console.log("duration -> " + this.duration)
}, },
setPageGesture: function () { setControls: function () {
this.pageGesture = !this.pageGesture; this.controls = !this.controls;
console.log("pageGesture -> " + this.pageGesture) console.log("controls -> " + this.controls)
}, },
setDirection: function (direction : number) { setDanmuBtn: function () {
this.direction = direction; this.danmuBtn = !this.danmuBtn;
console.log("direction -> " + this.direction) console.log("danmuBtn -> " + this.danmuBtn)
}, },
setShowProgress: function () { setPageGesture: function () {
this.showProgress = !this.showProgress; this.pageGesture = !this.pageGesture;
console.log("showProgress -> " + this.showProgress) console.log("pageGesture -> " + this.pageGesture)
}, },
setShowFullscreenBtn: function () { setDirection: function (options : RequestFullScreenOptions) {
this.showFullscreenBtn = !this.showFullscreenBtn; this.direction = options;
console.log("showFullscreenBtn -> " + this.showFullscreenBtn) console.log("direction -> " + this.direction)
}, },
setShowPlayBtn: function () { setShowProgress: function () {
this.showPlayBtn = !this.showPlayBtn; this.showProgress = !this.showProgress;
console.log("showPlayBtn -> " + this.showPlayBtn) console.log("showProgress -> " + this.showProgress)
}, },
setShowCenterPlayBtn: function () { setShowFullscreenBtn: function () {
this.showCenterPlayBtn = !this.showCenterPlayBtn; this.showFullscreenBtn = !this.showFullscreenBtn;
console.log("showCenterPlayBtn -> " + this.showCenterPlayBtn) console.log("showFullscreenBtn -> " + this.showFullscreenBtn)
}, },
setShowLoading: function () { setShowPlayBtn: function () {
this.showLoading = !this.showLoading; this.showPlayBtn = !this.showPlayBtn;
console.log("showLoading -> " + this.showLoading) console.log("showPlayBtn -> " + this.showPlayBtn)
}, },
setEnableProgressGesture: function () { setShowCenterPlayBtn: function () {
this.enableProgressGesture = !this.enableProgressGesture; this.showCenterPlayBtn = !this.showCenterPlayBtn;
console.log("enableProgressGesture -> " + this.enableProgressGesture) console.log("showCenterPlayBtn -> " + this.showCenterPlayBtn)
}, },
setObjectFit: function (objectFit : string) { setShowLoading: function () {
this.objectFit = objectFit; this.showLoading = !this.showLoading;
console.log("objectFit -> " + this.objectFit) console.log("showLoading -> " + this.showLoading)
}, },
setPoster: function (poster : string) { setEnableProgressGesture: function () {
this.poster = poster; this.enableProgressGesture = !this.enableProgressGesture;
console.log("poster -> " + this.poster) console.log("enableProgressGesture -> " + this.enableProgressGesture)
}, },
setShowMuteBtn: function () { setObjectFit: function (objectFit : string) {
this.showMuteBtn = !this.showMuteBtn; this.objectFit = objectFit;
console.log("showMuteBtn -> " + this.showMuteBtn) console.log("objectFit -> " + this.objectFit)
}, },
setTitle: function (title : string) { setPoster: function (poster : string) {
this.title = title; this.poster = poster;
console.log("title -> " + this.title) console.log("poster -> " + this.poster)
}, },
setEnablePlayGesture: function () { setShowMuteBtn: function () {
this.enablePlayGesture = !this.enablePlayGesture; this.showMuteBtn = !this.showMuteBtn;
console.log("enablePlayGesture -> " + this.enablePlayGesture) console.log("showMuteBtn -> " + this.showMuteBtn)
}, },
setVslideGesture: function () { setTitle: function (title : string) {
this.vslideGesture = !this.vslideGesture; this.title = title;
console.log("vslideGesture -> " + this.vslideGesture) console.log("title -> " + this.title)
}, },
setVslideGestureInFullscreen: function () { setEnablePlayGesture: function () {
this.vslideGestureInFullscreen = !this.vslideGestureInFullscreen; this.enablePlayGesture = !this.enablePlayGesture;
console.log("vslideGestureInFullscreen -> " + this.vslideGestureInFullscreen) console.log("enablePlayGesture -> " + this.enablePlayGesture)
}, },
setCodec: function (codec : string) { setVslideGesture: function () {
this.codec = codec; this.vslideGesture = !this.vslideGesture;
console.log("codec -> " + this.codec) console.log("vslideGesture -> " + this.vslideGesture)
}, },
setHttpCache: function () { setVslideGestureInFullscreen: function () {
this.httpCache = !this.httpCache; this.vslideGestureInFullscreen = !this.vslideGestureInFullscreen;
console.log("httpCache -> " + this.httpCache) console.log("vslideGestureInFullscreen -> " + this.vslideGestureInFullscreen)
}, },
setPlayStrategy: function (playStrategy : number) { setCodec: function (codec : string) {
this.playStrategy = playStrategy; this.codec = codec;
console.log("playStrategy -> " + this.playStrategy) console.log("codec -> " + this.codec)
}, },
setHeader: function (header : UTSJSONObject) { setHttpCache: function () {
this.header = header; this.httpCache = !this.httpCache;
console.log("header -> " + this.header) console.log("httpCache -> " + this.httpCache)
}, },
// 事件 setPlayStrategy: function (playStrategy : number) {
onPlay: function (res : any) { this.playStrategy = playStrategy;
console.log(JSON.stringify(res)); console.log("playStrategy -> " + this.playStrategy)
}, },
onPause: function (res : any) { setHeader: function (header : UTSJSONObject) {
console.log(JSON.stringify(res)); this.header = header;
}, console.log("header -> " + this.header)
onEnded: function (res : any) { },
console.log(JSON.stringify(res)); // 事件
}, onPlay: function (res : any) {
onTimeUpdate: function (_ : any) { console.log(JSON.stringify(res));
// console.log(JSON.stringify(res)); },
}, onPause: function (res : any) {
onFullScreenChange: function (res : any) { console.log(JSON.stringify(res));
console.log(JSON.stringify(res)); },
}, onEnded: function (res : any) {
onWaiting: function (res : any) { console.log(JSON.stringify(res));
console.log(JSON.stringify(res)); },
}, onTimeUpdate: function (_ : any) {
onError: function (res : any) { // console.log(JSON.stringify(res));
console.log(JSON.stringify(res)); },
}, onFullScreenChange: function (res : any) {
onProgress: function (res : any) { console.log(JSON.stringify(res));
console.log(JSON.stringify(res)); },
}, onWaiting: function (res : any) {
onFullScreenClick: function (res : any) { console.log(JSON.stringify(res));
console.log(JSON.stringify(res)); },
}, onError: function (res : any) {
onControlsToggle: function (res : any) { console.log(JSON.stringify(res));
console.log(JSON.stringify(res)); },
} onProgress: function (res : any) {
} console.log(JSON.stringify(res));
} },
onFullScreenClick: function (res : any) {
console.log(JSON.stringify(res));
},
onControlsToggle: function (res : any) {
console.log(JSON.stringify(res));
}
}
}
</script> </script>
<style> <style>
.video { .video {
width: 750rpx; width: 750rpx;
height: 400rpx; height: 400rpx;
} }
</style> </style>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册