refactor: 确立独立子工程架构 (backend, admin, mpuniapp) 并同步更新 AGENTS.md 规范

这个提交包含在:
wikiboss
2026-09-20 17:05:22 +08:00
父节点 de3cf8b870
当前提交 9fa1d1fbd0
共有 1679 个文件被更改,包括 204798 次插入 和 16817 次删除

查看文件

@@ -0,0 +1,60 @@
<template>
<view class="dialog-container">
<video id="myVideo" src="https://web-ext-storage.dcloud.net.cn/uni-app-x/video/uni-ai-5-16.mp4"
title="这里是 dialogPage 中的 video"></video>
<view class="dialog-content">
<button id="fullscreen-btn" class="mt-10" @click="requestFullScreen">
requestFullScreen
</button>
<button class="mt-10" @click="exitFullScreen">
exitFullScreen
</button>
<button class="mt-10" @click="closeThisPage">
closeThisPage
</button>
</view>
</view>
</template>
<script setup lang="uts">
const currentPage = getCurrentInstance()?.proxy?.$page
function requestFullScreen() {
uni.createVideoContext('myVideo')?.requestFullScreen(null)
}
function exitFullScreen() {
uni.createVideoContext('myVideo')?.exitFullScreen()
}
function closeThisPage() {
if (currentPage != null) {
uni.closeDialogPage({
dialogPage: currentPage
})
}
}
onBackPress(() => {
exitFullScreen()
return true
})
</script>
<style>
.dialog-container {
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.3);
display: flex;
justify-content: center;
align-items: center;
}
.dialog-content {
width: 80%;
padding: 10px;
background-color: #fff;
border-radius: 6px;
}
</style>

查看文件

@@ -0,0 +1,33 @@
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isMP = platformInfo.startsWith('mp')
const isAppWebView = process.env.UNI_AUTOMATOR_APP_WEBVIEW == 'true'
const isWeb = platformInfo.startsWith('web')
const isIos = platformInfo.startsWith('ios')
describe("video-format", () => {
if (isMP || isAppWebView || isWeb) {
it('skip', () => {
expect(1).toBe(1)
})
return
}
let page
// 添加辅助函数来简化数据设置
async function setPageData(newData) {
return await page.setData({ autoTestData: newData });
}
beforeAll(async () => {
page = await program.reLaunch('/pages/component/video/video-format');
await page.waitFor('view');
await page.waitFor(3000)
})
it("screenshot", async () => {
await setPageData({autoTest: true})
const image = await program.screenshot({ fullPage: true });
expect(image).toSaveImageSnapshot();
})
});

查看文件

@@ -0,0 +1,122 @@
<template>
<!-- #ifdef APP -->
<scroll-view class="page-scroll-view">
<!-- #endif -->
<page-head title="video-format"></page-head>
<!-- 自动化测试图片显示是否正常 -->
<image v-if="autoTestData.autoTest" src="/static/logo_square.jpeg" style="width: 50px;height: 50px;"></image>
<view class="uni-padding-wrap uni-common-mt">
<view class="uni-title">
<text class="uni-title-text">支持的视频格式示例</text>
</view>
<view v-for="(item,index) in supportFormats" :key="index">
<text class="uni-subtitle-text">{{item.format}}</text>
<video :id="'video-' + item.format" class="video" :src="item.src" :controls="true" :direction="-90"
@error="onError(item.format, $event as UniVideoErrorEvent)"></video>
</view>
<view class="uni-title">
<text class="uni-title-text">暂不支持的格式</text>
</view>
<view v-for="(item,index) in notSupportFormats" :key="index">
<text class="uni-subtitle-text">{{item.format}}</text>
<video :id="'video-' + item.format" :ref="'videoRef-' + item.format" class="video" :src="item.src"
:controls="true" :direction="-90"></video>
</view>
</view>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<script setup>
type VideoFormat = {
format : string
src : string
}
let supportFormats = ref([
// TODO web本地运行时本地服务返回的content-type不对,导致本地视频无法播放。此外web端原生video不支持flv、m3u8、avi格式,但是和app端相比多了ogg格式的支持
{
format: 'mp4',
src: 'https://web-ext-storage.dcloud.net.cn/video/sample/2minute-demo.mp4'
},
{
format: 'm4v',
src: 'https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.m4v'
},
{
format: 'mov',
src: 'https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.mov'
},
// #ifndef APP-HARMONY
{
format: 'webm(iOS、Safari、鸿蒙不支持)',
src: 'https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.webm'
},
// #endif
{
format: '3gp',
src: 'https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.3gp'
},
// #ifndef WEB || MP
{
format: 'flv',
src: 'https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.flv'
},
// #endif
// #ifndef WEB
{
format: 'm3u8',
src: 'https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.m3u8'
},
// #endif
// #ifndef WEB || MP || APP-HARMONY
{
format: '本地m3u8',
src: '/static/test-video/2minute-demo.m3u8'
},
// #endif
{
format: '错误路径',
src: 'https://www.dcloud.net.cn/errorpath.mp4'
},
] as Array<VideoFormat>)
let notSupportFormats = ref([
// #ifndef WEB
{
format: 'ogg',
src: 'https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.ogg'
},
// #endif
// #ifndef MP
{
format: 'avi',
src: 'https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.avi'
}
// #endif
] as Array<VideoFormat>)
// 自动化测试
const autoTestData = reactive({ autoTest: false })
const isError = reactive({ value: false })
const onError = (format : string, e : UniVideoErrorEvent) => {
console.log(format + ":" + JSON.stringify(e));
if (format != "错误路径") {
isError['value'] = true;
}
}
onReady(() => {
// const v = uni.createVideoContext("video-mp4",getCurrentInstance()!.proxy!)
// v?.play()
})
defineExpose({ isError, autoTestData })
</script>
<style>
.video {
height: 200px;
}
</style>

查看文件

@@ -0,0 +1,442 @@
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isAndroid = platformInfo.startsWith('android')
const isHarmony = platformInfo.startsWith('harmony')
const isIOS = platformInfo.startsWith('ios')
const isMP = platformInfo.startsWith('mp')
const isWeb = platformInfo.startsWith('web')
const isDev = process.env.HX_Version.endsWith('-dev')
const isAppWebView = process.env.UNI_AUTOMATOR_APP_WEBVIEW == 'true'
const isDom2 = process.env.UNI_APP_X_DOM2 === "true"
const platformInfos = platformInfo.split(' ');
const version = parseInt(platformInfos[platformInfos.length - 1]);
const isApp = isAndroid || isIOS || isHarmony
describe('component-native-video', () => {
if (isMP) {
it('skip', () => {
expect(1).toBe(1)
})
return
}
// TODO: web 端暂不支持测试 harmony 模拟器异常
if (isWeb || isAppWebView || (isHarmony && platformInfo.includes('模拟器')) || (isAndroid && version == 5)) {
it('web', async () => {
expect(1).toBe(1)
})
return
}
let page;
let start = 0;
let deviceShotOptions = {};
// 辅助函数:简化页面数据设置
async function setPageData(newData) {
return await page.setData({ data: newData });
}
beforeAll(async () => {
page = await program.reLaunch('/pages/component/video/video');
if (isWeb) {
await setPageData({
muted: true
});
} else {
const windowInfo = await program.callUniMethod('getWindowInfo');
deviceShotOptions = {
deviceShot: true,
area: {
x: 0,
y: windowInfo.safeAreaInsets.top + 44,
width: windowInfo.safeArea.width - 8,
// 规避底部手势导航栏的影响
height: windowInfo.safeArea.height - 40
},
};
}
await page.$('.video');
});
it('screenshot', async () => {
// 等待视频封面图加载完成
await page.waitFor(2000);
const image = await program.screenshot({ fullPage: true });
expect(image).toSaveImageSnapshot();
});
it('test play pause', async () => {
expect(await page.data('data.isError')).toBe(false);
// play
await page.callMethod('play');
await page.waitFor(10000);
expect(await page.data('data.isPlaying')).toBe(true);
// pause
await page.callMethod('pause');
await page.waitFor(3000);
expect(await page.data('data.isPause')).toBe(true);
});
if (!isMP) {
it('test download source', async () => {
await setPageData({
autoTest: true,
isError: false
});
const oldSrc = await page.data('data.src');
await page.callMethod('downloadSource');
await page.waitFor(5000);
expect(await page.data('data.isError')).toBe(false);
await setPageData({
src: oldSrc
});
// 在性能差一些的 harmony 机器上,设置 src 后再次播放可能需要等待一段时间
await page.waitFor(2000);
});
it('test video local mp4', async () => {
await setPageData({
autoTest: true,
isError: false
});
const oldSrc = await page.data('data.src');
await setPageData({
src: '/static/test-video/10second-demo.mp4'
});
await page.waitFor(1000);
expect(await page.data('data.isError')).toBe(false);
await setPageData({
src: oldSrc
});
// 在性能差一些的 harmony 机器上,设置 src 后再次播放可能需要等待一段时间
await page.waitFor(2000);
})
// 鸿蒙不播放本地 m3u8
if (!isHarmony) {
it('test video local m3u8', async () => {
await setPageData({
autoTest: true,
isError: false
});
const oldSrc = await page.data('data.src');
await setPageData({
src: '/static/test-video/2minute-demo.m3u8'
});
await page.waitFor(100);
expect(await page.data('data.isError')).toBe(false);
await setPageData({
src: oldSrc
});
})
}
if (isAndroid) {
it('android test assets path', async () => {
const oldSrc = await page.data('data.src');
await setPageData({
isError: false,
src: 'file:///android_asset/uni-autoTest/demo10s.mp4'
});
await page.waitFor(500);
expect(await page.data('data.isError')).toBe(false);
await setPageData({
src: oldSrc
});
});
}
}
it('test event play pause', async () => {
await setPageData({
isPause: false,
isPlaying: false,
autoTest: true,
});
await page.callMethod('play');
start = Date.now();
await page.waitFor(async () => {
return (await page.data('data.isPlaying')) || (Date.now() - start > 3000);
});
start = Date.now();
await page.waitFor(async () => {
return (await page.data('data.eventPlay')) || (Date.now() - start > 500);
});
if (!isIOS) {
expect(await page.data('data.eventPlay')).toEqual({
tagName: 'VIDEO',
type: 'play'
});
}
await page.callMethod('pause');
start = Date.now();
await page.waitFor(async () => {
return (await page.data('data.isPause')) || (Date.now() - start > 3000);
});
start = Date.now();
await page.waitFor(async () => {
return (await page.data('data.eventPause')) || (Date.now() - start > 1000);
});
if (!isIOS) {
expect(await page.data('data.eventPause')).toEqual({
tagName: 'VIDEO',
type: 'pause'
});
}
if (isAndroid || isIOS) {
await page.callMethod('play');
}
});
it('test video parent touch events', async () => {
await setPageData({
autoTest: true,
eventParentTouchstart: null,
eventParentTouchmove: null,
eventParentTouchend: null
});
const videoRect = await page.callMethod('getVideoRect');
expect(videoRect).not.toBeNull();
let x = Math.ceil(videoRect.x + videoRect.width / 2);
let y = Math.ceil(videoRect.y + videoRect.height / 2);
if (isIOS || isHarmony) {
const windowInfo = await page.callMethod('getWindowInfo');
y += windowInfo.safeArea.top + 44;
}
await program.swipe({
startPoint: { x, y },
endPoint: { x: x + 10, y: y + 10 },
duration: 200
});
await page.waitFor(500);
expect(await page.data('data.eventParentTouchstart')).toEqual({
tagName: 'VIEW',
currentTargetTagName: 'VIEW',
type: 'touchstart'
});
expect(await page.data('data.eventParentTouchmove')).toEqual({
tagName: 'VIEW',
currentTargetTagName: 'VIEW',
type: 'touchmove'
});
expect(await page.data('data.eventParentTouchend')).toEqual({
tagName: 'VIEW',
currentTargetTagName: 'VIEW',
type: 'touchend'
});
});
if (isAndroid || isHarmony) {
if (isAndroid) {
it('test event waiting progress', async () => {
await page.callMethod('seek', 10);
start = Date.now();
await page.waitFor(async () => {
return ((await page.data('data.eventWaiting')) && (await page.data('eventProgress'))) || (Date.now() - start > 1000);
});
expect(await page.data('data.eventWaiting')).toEqual({
tagName: 'VIDEO',
type: 'waiting'
});
expect(await page.data('data.eventProgress')).toEqual({
tagName: 'VIDEO',
type: 'progress',
isBufferedValid: true
});
});
}
it('test event fullscreenchange fullscreenclick controlstoggle', async () => {
if (isAndroid) {
await program.adbCommand('settings put secure immersive_mode_confirmations confirmed');
}
await page.callMethod('requestFullScreen');
start = Date.now();
await page.waitFor(async () => {
return (await page.data('data.eventFullscreenchange')) || (Date.now() - start > 1000);
});
expect(await page.data('data.eventFullscreenchange')).toEqual({
tagName: 'VIDEO',
type: 'fullscreenchange',
fullScreen: true,
direction: 'horizontal'
});
if (isAndroid) {
await page.waitFor(5000);
const res = await program.adbCommand('wm size');
const width = res.data.split(' ').at(-1).split('x')[0];
const height = res.data.split(' ').at(-1).split('x')[1];
await program.adbCommand(`input tap ${height / 2} ${width / 2}`);
start = Date.now();
await page.waitFor(async () => {
return (await page.data('data.eventFullscreenclick')) || (Date.now() - start > 1000);
});
const res2 = await program.adbCommand('wm density');
const scale = res2.data.split(' ').at(-1) / 160;
expect(await page.data('data.eventFullscreenclick')).toEqual({
tagName: 'VIDEO',
type: 'fullscreenclick',
screenX: parseInt(height / 2 / scale),
screenY: parseInt(width / 2 / scale),
screenWidth: parseInt(height / scale),
screenHeight: parseInt(width / scale)
});
start = Date.now();
await page.waitFor(async () => {
return (await page.data('data.eventControlstoggle')) || (Date.now() - start > 1000);
});
expect(await page.data('data.eventControlstoggle')).toEqual({
tagName: 'VIDEO',
type: 'controlstoggle',
show: true
});
}
await page.callMethod('exitFullScreen');
await page.waitFor(1000);
await page.callMethod('requestVerticalFullScreen');
await page.waitFor(1000);
expect(await page.data('data.eventFullscreenchange')).toEqual({
tagName: 'VIDEO',
type: 'fullscreenchange',
fullScreen: true,
direction: 'vertical'
});
await page.callMethod('exitFullScreen');
});
it('test event ended timeupdate', async () => {
await page.callMethod('seek', 120);
if (isAndroid) {
start = Date.now();
await page.waitFor(async () => {
return (await page.data('data.eventEnded')) || (Date.now() - start > 30000);
});
expect(await page.data('data.eventEnded')).toEqual({
tagName: 'VIDEO',
type: 'ended'
});
}
await page.waitFor(3000);
if (isAndroid || isHarmony) {
let currentTime = 121
if (isHarmony) currentTime = 120
start = Date.now();
await page.waitFor(async () => {
return (await page.data('data.eventTimeupdate')) || (Date.now() - start > 500);
});
expect(await page.data('data.eventTimeupdate')).toEqual({
tagName: 'VIDEO',
type: 'timeupdate',
currentTime,
duration: 121
});
}
});
it('test event error', async () => {
const oldSrc = await page.data('data.src');
await setPageData({
src: 'invalid url'
});
start = Date.now();
await page.waitFor(async () => {
return (await page.data('data.eventError')) || (Date.now() - start > 5000);
});
const eventError = await page.data('data.eventError')
expect(eventError.tagName).toEqual('VIDEO')
expect(eventError.type).toEqual('error')
if (!isHarmony) {
expect(eventError.errCode).toEqual(300001)
} else {
// 鸿蒙 video onError 没有错误信息,恒为 200001 内部错误
expect(eventError.errCode).toEqual(200001)
}
await setPageData({
autoTest: false,
src: oldSrc
});
});
if (isAndroid) {
it('test sub component', async () => {
await setPageData({
subCompEnable: true,
subCompShow: true
});
await page.waitFor(100);
expect(await page.callMethod('hasSubComponent')).toBe(true);
await page.callMethod('requestFullScreen');
await page.waitFor(2000);
const image = await program.screenshot(deviceShotOptions);
expect(image).toSaveImageSnapshot();
await page.callMethod('exitFullScreen');
await page.waitFor(2000);
await page.callMethod('requestVerticalFullScreen');
await page.waitFor(2000);
const image2 = await program.screenshot(deviceShotOptions);
expect(image2).toSaveImageSnapshot();
await page.callMethod('exitFullScreen');
await setPageData({
subCompEnable: false,
subCompShow: false
});
});
}
it('test enable-danmu', async () => {
await page.callMethod('play');
await page.waitFor(5000);
await setPageData({
enableDanmu: false
});
const windowInfo = await program.callUniMethod('getWindowInfo');
const image = await program.screenshot({
deviceShot: true,
area: {
x: 0,
y: windowInfo.statusBarHeight + 44
}
});
expect(image).toSaveImageSnapshot();
});
it('test continuous send danmu track', async () => {
await setPageData({
enableDanmu: true
});
await page.callMethod('play');
await page.waitFor(2000);
await page.callMethod('continuousSendDanmu');
await page.waitFor(3000);
const windowInfo = await program.callUniMethod('getWindowInfo');
const image = await program.screenshot({
deviceShot: true,
area: {
x: 0,
y: windowInfo.statusBarHeight + 44
}
});
expect(image).toSaveImageSnapshot();
});
}
if (isApp && !isAppWebView) {
it('test dialog video', async () => {
await page.callMethod('openDialogPageVideo')
await page.waitFor(500);
await page.callMethod('closeDialogPageVideo')
await page.waitFor(500);
await page.callMethod('openDialogPageVideo')
const rect = await page.callMethod('getDialogPageVideoFullscreenBtnRect')
expect(rect).not.toBeNull();
/* const windowInfo = await program.callUniMethod('getWindowInfo');
expect(windowInfo).not.toBeNull(); */
await page.waitFor(3000);
const x = rect.left + rect.width / 2
// 加了 windowInfo.statusBarHeight + 44 反而点不到按钮
const y = rect.top + rect.height / 2
await program.tap({x, y, duration: 300});
const image = await program.screenshot(deviceShotOptions);
expect(image).toSaveImageSnapshot();
await page.callMethod('closeDialogPageVideo')
});
}
});

查看文件

@@ -0,0 +1,953 @@
<template>
<view id="video-parent" class="uni-flex-item" @touchstart="onVideoParentTouchStart" @touchmove="onVideoParentTouchMove"
@touchend="onVideoParentTouchEnd">
<video class="video" ref="video" id="video" :header="data.header" :src="data.src" :autoplay="data.autoplay" :loop="data.loop"
:muted="data.muted" :initial-time="data.initialTime" :duration="data.duration" :controls="data.controls" :danmu-btn="data.danmuBtn && fullscreenShowDanmuBtn"
:enable-danmu="data.enableDanmu" :page-gesture="data.pageGesture" :direction="data.direction" :show-progress="data.showProgress"
:show-fullscreen-btn="data.showFullscreenBtn && fullscreenShowFullscreenBtn" :show-play-btn="data.showPlayBtn && fullscreenShowPlayBtn" :show-center-play-btn="data.showCenterPlayBtn"
:show-loading="data.showLoading" :enable-progress-gesture="data.enableProgressGesture" :object-fit="data.objectFit"
:poster="data.poster" :show-mute-btn="data.showMuteBtn && fullscreenShowMuteBtn" :title="data.title" :enable-play-gesture="data.enablePlayGesture"
:vslide-gesture="data.vslideGesture" :vslide-gesture-in-fullscreen="data.vslideGestureInFullscreen"
:http-cache="data.httpCache" :danmu-list="data.danmuList" @play="onPlay" @pause="onPause"
@ended="onEnded" @timeupdate="onTimeUpdate" @waiting="onWaiting" @error="onError" @progress="onProgress"
@fullscreenclick="onFullScreenClick" @controlstoggle="onControlsToggle" @fullscreenchange="onFullScreenChange">
<image v-if="data.subCompEnable && data.subCompShow" class="img-fast-backward"
src="../../../static/test-video/fast-backward.png" @tap.stop="fastBackward"></image>
<image v-if="data.subCompEnable && data.subCompShow" class="img-fast-forward"
src="../../../static/test-video/fast-forward.png" @tap.stop="fastForward"></image>
<input v-if="data.subCompEnable && data.subCompShow" id="input-send-danmu" class="input-send-danmu" placeholder="请输入弹幕内容"
placeholder-style="color: white;" confirm-type="send" @confirm="onSendDanmuConfirm"
@keyboardheightchange="onSendDanmuKeyboardHeightChange" @blur="onSendDanmuBlur"></input>
<!-- #ifdef APP-HARMONY -->
<template #controls>
<view v-if="data.subCompControlsShow" class="video-fullscreen_controls">
<view style="flex-direction: row;justify-content: center;align-items: center;">
<view class="control-btn" @click="togglePlay">
<text class="control-icon">{{ data.isPlaying ? ICON_PAUSH : ICON_PLAY }}</text>
</view>
<view class="control-btn" @click="toggleDanmu">
<text class="control-icon">{{ data.enableDanmu ? ICON_DANMU_ACTIVE : ICON_DANMU }}</text>
</view>
<view class="control-btn" @click="toggleMute">
<text class="control-icon">{{ data.muted ? ICON_VOLUME_MUTE : ICON_VOLUME }}</text>
</view>
</view>
<view>
<view class="control-btn" @click="toggleFullscreen">
<text class="control-icon">{{ data.isFullscreen ? ICON_FULLSCREEN_CLOSE : ICON_FULLSCREEN }}</text>
</view>
</view>
</view>
</template>
<!-- #endif -->
</video>
<scroll-view class="uni-padding-wrap uni-common-mt uni-flex-item">
<view class="uni-btn-v">
<navigator url="/pages/component/video/video-format">
<button type="primary" @click="pause">视频格式示例</button>
</navigator>
</view>
<!-- #ifdef APP-HARMONY -->
<view class="uni-btn-v">
<navigator url="/pages/component/list-view/list-view-multiplex-video">
<button type="primary" @click="pause">list-view嵌套视频复用示例</button>
</navigator>
</view>
<!-- #endif -->
<!-- #ifdef APP-HARMONY -->
<view class="uni-btn-v">
<button type="primary" @click="openDialogPageVideo">dialogPage 视频格式示例</button>
</view>
<view class="uni-row uni-btn-v" style="justify-content: space-between;align-items: center;">
<text class="uni-title" style="width: 80%;">全屏后自定义 controls</text>
<switch :checked="data.subCompControlsEnable" @change="onSubCompControlsEnable" />
</view>
<!-- #endif -->
<view class="uni-row uni-btn-v" style="justify-content: space-between;align-items: center;">
<text class="uni-title" style="width: 80%;">子组件实现快进、快退、发送弹幕功能(全屏后显示)</text>
<switch :checked="data.subCompEnable" @change="onSubCompEnableChange" />
</view>
<view class="uni-title">
<text class="uni-title-text">API示例</text>
</View>
<view class="uni-btn-v">
<button type="primary" @click="play">播放</button>
</view>
<view class="uni-btn-v">
<button type="primary" @click="pause">暂停</button>
</view>
<view class="uni-btn-v">
<input class="input" placeholder="输入要跳转的位置,单位s" type="number" @input="onSeekInput"></input>
<button type="primary" @click="seek(data.pos)">跳转到指定位置</button>
</view>
<view class="uni-btn-v">
<enum-data title="选择进入全屏时的视频方向" :items="data.directionItemTypes"
@change="onRequestFullScreenDirectionChange"></enum-data>
<button type="primary" @click="requestFullScreen">进入全屏</button>
</view>
<view class="uni-btn-v">
<button type="primary" @click="exitFullScreen">退出全屏</button>
</view>
<view class="uni-btn-v">
<button type="primary" @click="stop">停止</button>
</view>
<view class="uni-btn-v">
<input class="input" placeholder="输入弹幕" value="{ 'text': '要显示的文本', 'color': '#FF0000' }" type="string"
@input="onSendDanmuInput"></input>
<button type="primary" :disabled="!data.enableDanmu" @click="sendDanmu">发送弹幕</button>
</view>
<view class="uni-btn-v">
<enum-data title="选择倍速" :items="data.rateItemTypes" @change="onPlaybackRateChange"></enum-data>
<button type="primary" @click="playbackRate">设置倍速</button>
</view>
<view class="uni-title">
<text class="uni-title-text">属性示例</text>
</view>
<!-- //TODO: ios dom2 加一层父view,scrll-view组件滚动方向逻辑就正常了,dom2需要排查input和scroll-view 在该场景导致direction 失效的问题 -->
<view class="uni-btn-v">
<input class="input margin-10" type="string" placeholder="设置播放资源" @confirm="onSrcComfirm"></input>
<input class="input margin-10" type="number" placeholder="设置初始播放位置(播放前设置有效)"
@confirm="onInitialTimeComfirm"></input>
<input class="input margin-10" type="number" placeholder="设置视频时长(播放前设置有效)" @confirm="onDurationComfirm"></input>
<input class="input margin-10" type="string" placeholder="设置视频封面" @confirm="onPosterComfirm"></input>
<input class="input margin-10" type="string" placeholder="设置视频标题(仅限非 Web 平台)" @confirm="onTitleComfirm"></input>
<input class="input margin-10" type="string" placeholder="设置header(json格式)" @confirm="onHeaderComfirm"></input>
</view>
<boolean-data title="设置是否展示弹幕(播放前设置有效)" :defaultValue="data.enableDanmu" @change="onEnableDanmuChange"></boolean-data>
<boolean-data title="设置是否自动播放(播放前设置有效)" :defaultValue="data.autoplay" @change="onAutoplayChange"></boolean-data>
<boolean-data title="设置是否循环播放(播放完成后生效)" :defaultValue="data.loop" @change="onLoopChange"></boolean-data>
<boolean-data title="设置是否静音播放" :defaultValue="data.muted" @change="onMutedChange"></boolean-data>
<boolean-data title="设置是否显示默认播放控件" :defaultValue="data.controls" @change="onControlsChange"></boolean-data>
<boolean-data title="设置是否显示弹幕按钮" :defaultValue="data.danmuBtn" @change="onDanmuBtnChange"></boolean-data>
<boolean-data title="设置是否显示进度条" :defaultValue="data.showProgress" @change="onShowProgressChange"></boolean-data>
<boolean-data title="设置是否显示全屏按钮" :defaultValue="data.showFullscreenBtn"
@change="onShowFullscreenBtnChange"></boolean-data>
<boolean-data title="设置是否显示视频底部控制栏的播放按钮" :defaultValue="data.showPlayBtn" @change="onShowPlayBtnChange"></boolean-data>
<boolean-data title="设置是否显示静音按钮(仅限非 Web 平台)" :defaultValue="data.showMuteBtn"
@change="onShowMuteBtnChange"></boolean-data>
<boolean-data title="设置是否显示视频中间的播放按钮" :defaultValue="data.showCenterPlayBtn"
@change="onShowCenterPlayBtnChange"></boolean-data>
<boolean-data title="设置是否显示loading控件" :defaultValue="data.showLoading" @change="onShowLoadingChange"></boolean-data>
<boolean-data title="设置是否开启控制进度的手势" :defaultValue="data.enableProgressGesture"
@change="onEnableProgressGestureChange"></boolean-data>
<boolean-data title="设置是否开启播放手势,双击播放暂停(仅限非 Web 平台)" :defaultValue="data.enablePlayGesture"
@change="onEnablePlayGestureChange"></boolean-data>
<!-- #ifndef WEB -->
<boolean-data title="非全屏模式下,设置是否开启亮度与音量调节手势 page-gesture" :defaultValue="data.pageGesture"
@change="onPageGestureChange"></boolean-data>
<!-- #endif -->
<boolean-data title="非全屏模式下,设置是否开启亮度与音量调节手势 vslide-gesture(仅限非 Web 平台)" :defaultValue="data.vslideGesture"
@change="onVslideGestureChange"></boolean-data>
<boolean-data title="全屏模式下,设置是否开启亮度与音量调节手势(仅限非 Web 平台)" :defaultValue="data.vslideGestureInFullscreen"
@change="onVslideGestureInFullscreenChange"></boolean-data>
<enum-data title="视频与video容器大小不一致时的表现" :items="data.objectFitItemTypes"
@change="onObjectFitChange"></enum-data>
<!-- #ifndef APP-HARMONY -->
<boolean-data title="设置是否对http、https视频源开启本地缓存(仅 Android、iOS 平台,播放前设置有效)" :defaultValue="data.httpCache"
@change="onHttpCacheChange"></boolean-data>
<!-- #endif -->
</scroll-view>
</view>
</template>
<script setup lang="uts">
import { ItemType } from '@/components/enum-data/enum-data-types';
type RectType = {
x: number;
y: number;
width: number;
height: number;
}
type DataType = {
videoContext: VideoContext | null;
// 属性
src: string;
autoplay: boolean;
loop: boolean;
muted: boolean;
initialTime: number;
duration: number;
controls: boolean;
danmuList: Array<Danmu>;
danmuBtn: boolean;
enableDanmu: boolean;
pageGesture: boolean;
direction: number;
directionItemTypes: ItemType[];
directionItems: number[];
showProgress: boolean;
showFullscreenBtn: boolean;
showPlayBtn: boolean;
showCenterPlayBtn: boolean;
showLoading: boolean;
enableProgressGesture: boolean;
objectFit: string;
objectFitItemTypes: ItemType[];
objectFitItems: string[];
poster: string;
showMuteBtn: boolean;
title: string;
enablePlayGesture: boolean;
vslideGesture: boolean;
vslideGestureInFullscreen: boolean;
httpCache: boolean;
header: UTSJSONObject;
// API
pos: number;
requestFullScreenOptions: RequestFullScreenOptions | null;
danmu: Danmu;
rate: number;
rateItemTypes: ItemType[];
rateItems: number[];
subCompEnable: boolean;
subCompControlsEnable: boolean;
subCompShow: boolean;
subCompControlsShow: boolean;
isFullscreen: boolean;
curPos: number;
endPos: number;
// 自动化测试
autoTest: boolean;
isPlaying: boolean;
isPause: boolean;
isError: boolean;
eventPlay: UTSJSONObject | null;
eventPause: UTSJSONObject | null;
eventEnded: UTSJSONObject | null;
eventTimeupdate: UTSJSONObject | null;
eventFullscreenchange: UTSJSONObject | null;
eventWaiting: UTSJSONObject | null;
eventError: UTSJSONObject | null;
eventProgress: UTSJSONObject | null;
eventFullscreenclick: UTSJSONObject | null;
eventControlstoggle: UTSJSONObject | null;
eventParentTouchstart: UTSJSONObject | null;
eventParentTouchmove: UTSJSONObject | null;
eventParentTouchend: UTSJSONObject | null;
dialogPageVideo: UniPage | null;
}
const ICON_PLAY = '\uea24';
const ICON_PAUSH = '\uea25';
const ICON_DANMU = '\uea26';
const ICON_DANMU_ACTIVE = '\uea27';
const ICON_VOLUME = '\uea30';
const ICON_VOLUME_MUTE = '\uea31';
const ICON_FULLSCREEN_CLOSE = '\uea28';
const ICON_FULLSCREEN = '\uea29';
// 使用reactive避免ref数据在自动化测试中无法访问
const data = reactive({
videoContext: null,
// 属性
src: "https://web-ext-storage.dcloud.net.cn/video/sample/2minute-demo.mp4",
autoplay: false,
loop: false,
muted: false,
initialTime: 0,
duration: 0,
controls: true,
danmuList: [{
text: '要显示的文本',
color: '#FF0000',
time: 3
}, {
text: '要显示的文本2',
color: '#31ff23',
time: 5
}, {
text: '要显示的文本3',
color: '#f13ef8',
time: 7
}, {
text: '要显示的文本4',
color: '#4972f8',
time: 9
}, {
text: '要显示的文本5',
color: '#000000',
time: 11
}],
danmuBtn: false,
enableDanmu: true,
pageGesture: false,
direction: -1,
directionItemTypes: [{ "value": 0, "name": "0(正常竖向)" }, { "value": 1, "name": "90(屏幕逆时针90度)" }, { "value": 2, "name": "-90(屏幕顺时针90度)" }],
directionItems: [0, 90, -90],
showProgress: true,
showFullscreenBtn: true,
showPlayBtn: true,
showCenterPlayBtn: true,
showLoading: true,
enableProgressGesture: true,
objectFit: "contain",
objectFitItemTypes: [{ "value": 0, "name": "contain(包含)" }, { "value": 1, "name": "fill(填充)" }, { "value": 2, "name": "cover(覆盖)" }],
objectFitItems: ["contain", "fill", "cover"],
poster: "https://web-ext-storage.dcloud.net.cn/hello-uni-app-x/video/video-poster.jpg",
showMuteBtn: false,
title: "video-component",
enablePlayGesture: false,
vslideGesture: false,
vslideGestureInFullscreen: true,
httpCache: true,
header: {
'User-Agent': 'User-Agent test',
'header': 'header test',
'cookie': 'cookie test'
},
// API
pos: 0,
requestFullScreenOptions: null,
danmu: {
text: '要显示的文本',
color: '#FF0000'
},
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" }],
rateItems: [0.5, 0.8, 1.0, 1.25, 1.5],
subCompEnable: false,
subCompControlsEnable: false,
subCompShow: false,
subCompControlsShow: false,
isFullscreen: false,
curPos: 0,
endPos: 0,
// 自动化测试
autoTest: false,
isPlaying: false,
isPause: false,
isError: false,
eventPlay: null,
eventPause: null,
eventEnded: null,
eventTimeupdate: null,
eventFullscreenchange: null,
eventWaiting: null,
eventError: null,
eventProgress: null,
eventFullscreenclick: null,
eventControlstoggle: null,
eventParentTouchstart: null,
eventParentTouchmove: null,
eventParentTouchend: null,
dialogPageVideo: null
} as DataType)
onReady(() => {
data.videoContext = uni.createVideoContext('video');
// data.videoContext = uni.createVideoContext('video', this);
})
const pause = () => {
console.log("pause");
// #ifdef MP || WEB
data.videoContext?.pause();
// #endif
// #ifdef APP
data.videoContext?.pause()
// (uni.getElementById("video") as UniVideoElement).pause(); //as写法测试。注意id不对时as会崩溃
// #endif
}
const openDialogPageVideo = () => {
pause()
data.dialogPageVideo = uni.openDialogPage({
url: '/pages/component/video/video-dialog-page'
})
}
const closeDialogPageVideo = () => {
uni.closeDialogPage({
dialogPage: data.dialogPageVideo
})
}
const getDialogPageVideoFullscreenBtnRect = (): DOMRect | null => {
return data.dialogPageVideo?.getElementById('fullscreen-btn')?.getBoundingClientRect() ?? null;
}
// API
const play = () => {
console.log("play");
data.videoContext?.play();
}
const seek = (pos : number) => {
console.log("seek -> " + pos);
data.videoContext?.seek(pos);
}
const onSeekInput = (event : UniInputEvent) => {
data.pos = parseInt(event.detail.value);
}
const requestFullScreen = () => {
console.log("requestFullScreen -> " + data.requestFullScreenOptions);
data.videoContext?.requestFullScreen(data.requestFullScreenOptions);
}
const exitFullScreen = () => {
console.log("exitFullScreen");
data.videoContext?.exitFullScreen();
}
const stop = () => {
console.log("stop");
// #ifdef MP
data.videoContext?.stop();
// #endif
// #ifndef MP
data.videoContext?.stop();
// uni.getElementById<UniVideoElement>("video")?.stop(); //泛型写法测试
// #endif
}
const sendDanmu = () => {
console.log("sendDanmu -> " + data.danmu);
data.videoContext?.sendDanmu(data.danmu);
}
const continuousSendDanmu = () => {
const colors = ['#FF0000', '#31ff23', '#f13ef8', '#4972f8', '#FF9800', '#9C27B0']
for (let i = 0; i < colors.length; i++) {
const color = colors[i]
const text = '弹幕' + (i + 1)
setTimeout(() => {
data.videoContext?.sendDanmu({
text,
color
});
}, i * 500);
}
}
const onSendDanmuInput = (event : UniInputEvent) => {
let json = JSON.parse<Danmu>(event.detail.value)
if (json == null) return;
data.danmu = json as Danmu;
}
const playbackRate = () => {
console.log("playbackRate -> " + data.rate);
data.videoContext?.playbackRate(data.rate);
}
const onPlaybackRateChange = (value : number) => {
data.rate = data.rateItems[value];
}
const togglePlay = () => {
if (data.isPlaying) {
pause();
} else {
play();
}
}
const toggleDanmu = () => {
data.enableDanmu = !data.enableDanmu;
}
const toggleMute = () => {
data.muted = !data.muted;
}
const toggleFullscreen = () => {
if (data.isFullscreen) {
exitFullScreen()
} else {
requestFullScreen();
}
}
const fastBackward = () => {
let posValue = data.curPos - 15;
if (posValue < 0) posValue = 0;
seek(posValue);
}
const fastForward = () => {
let posValue = data.curPos + 15;
if (posValue > data.endPos) posValue = data.endPos;
seek(posValue);
}
const onSendDanmuConfirm = (event : UniInputConfirmEvent) => {
data.videoContext?.sendDanmu({
text: event.detail.value,
color: '#ff0000'
} as Danmu);
}
const onSendDanmuKeyboardHeightChange = (event : UniInputKeyboardHeightChangeEvent) => {
const element = uni.getElementById('input-send-danmu') as UniElement;
if (event.detail.height.toInt() == 0) {
element.style.setProperty('bottom', '50px');
} else {
element.style.setProperty('bottom', event.detail.height + element.getBoundingClientRect().height);
}
}
const onSendDanmuBlur = (_ : UniInputBlurEvent) => {
(uni.getElementById('input-send-danmu') as UniElement).style.setProperty('bottom', '50px');
}
// 属性
const onSrcComfirm = (event : UniInputConfirmEvent) => {
let value = event.detail.value;
if (value == '') return;
data.src = value;
console.log("src -> " + data.src)
}
const onAutoplayChange = (value : boolean) => {
data.autoplay = value;
console.log("autoplay -> " + data.autoplay)
}
const onLoopChange = (value : boolean) => {
data.loop = value;
console.log("loop -> " + data.loop)
}
const onMutedChange = (value : boolean) => {
data.muted = value;
console.log("muted -> " + data.muted)
}
const onInitialTimeComfirm = (event : UniInputConfirmEvent) => {
let value = parseInt(event.detail.value)
if (isNaN(value)) value = 0;
data.initialTime = value;
console.log("initialTime -> " + data.initialTime)
}
const onDurationComfirm = (event : UniInputConfirmEvent) => {
let value = parseInt(event.detail.value)
if (isNaN(value)) value = 0;
data.duration = value;
console.log("duration -> " + data.duration)
}
const onControlsChange = (value : boolean) => {
data.controls = value;
console.log("controls -> " + data.controls)
}
const onEnableDanmuChange = (value : boolean) => {
data.enableDanmu = value;
console.log("enableDanmu -> " + data.enableDanmu)
}
const onDanmuBtnChange = (value : boolean) => {
data.danmuBtn = value;
console.log("danmuBtn -> " + data.danmuBtn)
}
const onPageGestureChange = (value : boolean) => {
data.pageGesture = value;
console.log("pageGesture -> " + data.pageGesture)
}
const onRequestFullScreenDirectionChange = (value : number) => {
let directionValue = data.directionItems[value];
data.requestFullScreenOptions = {
direction: directionValue
} as RequestFullScreenOptions;
}
const onShowProgressChange = (value : boolean) => {
data.showProgress = value;
console.log("showProgress -> " + data.showProgress)
}
const onShowFullscreenBtnChange = (value : boolean) => {
data.showFullscreenBtn = value;
console.log("showFullscreenBtn -> " + data.showFullscreenBtn)
}
const onShowPlayBtnChange = (value : boolean) => {
data.showPlayBtn = value;
console.log("showPlayBtn -> " + data.showPlayBtn)
}
const onShowCenterPlayBtnChange = (value : boolean) => {
data.showCenterPlayBtn = value;
console.log("showCenterPlayBtn -> " + data.showCenterPlayBtn)
}
const onShowLoadingChange = (value : boolean) => {
data.showLoading = value;
console.log("showLoading -> " + data.showLoading)
}
const onEnableProgressGestureChange = (value : boolean) => {
data.enableProgressGesture = value;
console.log("enableProgressGesture -> " + data.enableProgressGesture)
}
const onObjectFitChange = (value : number) => {
data.objectFit = data.objectFitItems[value];
console.log("objectFit -> " + data.objectFit)
}
const onPosterComfirm = (event : UniInputConfirmEvent) => {
let value = event.detail.value;
if (value == '') return;
data.poster = value;
console.log("poster -> " + data.poster)
}
const onShowMuteBtnChange = (value : boolean) => {
data.showMuteBtn = value;
console.log("showMuteBtn -> " + data.showMuteBtn)
}
const onTitleComfirm = (event : UniInputConfirmEvent) => {
let value = event.detail.value;
if (value == '') return;
data.title = value;
console.log("title -> " + data.title)
}
const onEnablePlayGestureChange = (value : boolean) => {
data.enablePlayGesture = value;
console.log("enablePlayGesture -> " + data.enablePlayGesture)
}
const onVslideGestureChange = (value : boolean) => {
data.vslideGesture = value;
console.log("vslideGesture -> " + data.vslideGesture)
}
const onVslideGestureInFullscreenChange = (value : boolean) => {
data.vslideGestureInFullscreen = value;
console.log("vslideGestureInFullscreen -> " + data.vslideGestureInFullscreen)
}
const onHttpCacheChange = (value : boolean) => {
data.httpCache = value;
console.log("httpCache -> " + data.httpCache)
}
const onHeaderComfirm = (event : UniInputConfirmEvent) => {
let json = JSON.parse(event.detail.value)
if (json == null) return;
data.header = json as UTSJSONObject;
console.log("header -> " + JSON.stringify(data.header))
}
const onSubCompEnableChange = (event : UniSwitchChangeEvent) => {
data.subCompEnable = event.detail.value;
}
function onSubCompControlsEnable(event: UniSwitchChangeEvent) {
data.subCompControlsEnable = event.detail.value;
}
const isHorizontalFullscreen = ref(false)
const fullscreenShowPlayBtn = ref(data.showPlayBtn)
const fullscreenShowMuteBtn = ref(data.showMuteBtn)
const fullscreenShowFullscreenBtn = ref(data.showFullscreenBtn)
const fullscreenShowDanmuBtn = ref(data.danmuBtn)
watchEffect(() => {
data.subCompControlsShow = isHorizontalFullscreen.value && data.subCompControlsEnable
// 当全屏显示自定义 controls 时,不显示 video 组件原本 controls 按钮
fullscreenShowPlayBtn.value = !data.subCompControlsShow
fullscreenShowMuteBtn.value = !data.subCompControlsShow
fullscreenShowFullscreenBtn.value = !data.subCompControlsShow // 不显示全屏按钮,返回手势或者右上角退出全屏
fullscreenShowDanmuBtn.value = !data.subCompControlsShow
})
// 事件
const onPlay = (res : UniEvent) => {
console.log(res.type);
data.isPlaying = true;
data.isPause = false;
if (data.autoTest) {
data.eventPlay = {
"tagName": res.target?.tagName,
"type": res.type
};
}
}
const onPause = (res : UniEvent) => {
console.log(res.type);
data.isPlaying = false;
data.isPause = true;
if (data.autoTest) {
data.eventPause = {
"tagName": res.target?.tagName,
"type": res.type
};
}
}
const onEnded = (res : UniEvent) => {
console.log(res.type);
if (data.autoTest) {
data.eventEnded = {
"tagName": res.target?.tagName,
"type": res.type
};
}
}
const onTimeUpdate = (res : UniVideoTimeUpdateEvent) => {
console.log(res.type + " -> " + JSON.stringify(res.detail));
data.curPos = res.detail.currentTime;
data.endPos = res.detail.duration;
if (data.autoTest) {
data.eventTimeupdate = {
"tagName": res.target?.tagName,
"type": res.type,
"currentTime": Math.trunc(res.detail.currentTime),
"duration": Math.trunc(res.detail.duration)
};
}
}
const onFullScreenChange = (res : UniVideoFullScreenChangeEvent) => {
const detail = res.detail
console.log(res.type + " -> " + JSON.stringify(detail));
data.subCompShow = detail.fullScreen;
data.isFullscreen = detail.fullScreen;
isHorizontalFullscreen.value = detail.fullScreen && detail.direction === 'horizontal'
if (data.autoTest) {
data.eventFullscreenchange = {
"tagName": res.target?.tagName,
"type": res.type,
"fullScreen": res.detail.fullScreen,
"direction": res.detail.direction
};
}
}
const onWaiting = (res : UniEvent) => {
console.log(res.type);
if (data.autoTest) {
data.eventWaiting = {
"tagName": res.target?.tagName,
"type": res.type
};
}
}
const onError = (res : UniVideoErrorEvent) => {
console.log(res.type + " -> " + JSON.stringify(res.detail));
data.isError = true;
if (data.autoTest) {
data.eventError = {
"tagName": res.target?.tagName,
"type": res.type,
"errCode": res.detail.errCode
};
}
}
const onProgress = (res : UniVideoProgressEvent) => {
console.log(res.type + " -> " + JSON.stringify(res.detail));
if (data.autoTest) {
data.eventProgress = {
"tagName": res.target?.tagName,
"type": res.type,
"isBufferedValid": res.detail.buffered >= 0
};
}
}
const onFullScreenClick = (res : UniVideoFullScreenClickEvent) => {
console.log(res.type + " -> " + JSON.stringify(res.detail));
if (data.autoTest) {
data.eventFullscreenclick = {
"tagName": res.target?.tagName,
"type": res.type,
"screenX": Math.trunc(res.detail.screenX),
"screenY": Math.trunc(res.detail.screenY),
"screenWidth": Math.trunc(res.detail.screenWidth),
"screenHeight": Math.trunc(res.detail.screenHeight)
};
}
}
const onControlsToggle = (res : UniVideoControlsToggleEvent) => {
console.log(res.type + " -> " + JSON.stringify(res.detail));
if (data.autoTest) {
data.eventControlstoggle = {
"tagName": res.target?.tagName,
"type": res.type,
"show": res.detail.show
};
}
}
const onVideoParentTouchStart = (res : TouchEvent) => {
if (data.autoTest) {
data.eventParentTouchstart = {
"tagName": res.target?.tagName,
"currentTargetTagName": res.currentTarget?.tagName,
"type": res.type
};
}
}
const onVideoParentTouchMove = (res : TouchEvent) => {
if (data.autoTest) {
data.eventParentTouchmove = {
"tagName": res.target?.tagName,
"currentTargetTagName": res.currentTarget?.tagName,
"type": res.type
};
}
}
const onVideoParentTouchEnd = (res : TouchEvent) => {
if (data.autoTest) {
data.eventParentTouchend = {
"tagName": res.target?.tagName,
"currentTargetTagName": res.currentTarget?.tagName,
"type": res.type
};
}
}
// 自动化测试
const downloadSource = () => {
uni.downloadFile({
url: 'https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.mp4',
success: (res) => {
data.src = res.tempFilePath;
},
fail: (_) => {
data.isError = true;
}
})
}
const getWindowInfo = () : GetWindowInfoResult => {
return uni.getWindowInfo();
}
const getVideoRect = () : RectType | null => {
const element = uni.getElementById('video');
if (element == null) return null;
const rect = element.getBoundingClientRect();
return {
x: rect.x,
y: rect.y,
width: rect.width,
height: rect.height
};
}
// #ifdef APP-ANDROID
const hasSubComponent = () : boolean => {
const element = uni.getElementById('video')?.querySelector('.uni-video-slots');
if (element == null) return false;
return element.children.length > 0;
}
// #endif
const requestVerticalFullScreen = () => {
data.videoContext?.requestFullScreen({
direction: 0
} as RequestFullScreenOptions);
}
defineExpose({
data,
play,
pause,
downloadSource,
seek,
requestFullScreen,
exitFullScreen,
// #ifdef APP-ANDROID
hasSubComponent,
// #endif
requestVerticalFullScreen,
openDialogPageVideo,
closeDialogPageVideo,
getWindowInfo,
getVideoRect,
continuousSendDanmu,
getDialogPageVideoFullscreenBtnRect
})
</script>
<style>
.video {
width: 100%;
height: 200px;
}
.input {
height: 40px;
background: #FFF;
padding: 8px 13px;
}
.img-fast-backward {
width: 40px;
height: 40px;
top: 50%;
left: 12%;
transform: translate(-50%, -50%);
position: absolute;
}
.img-fast-forward {
width: 40px;
height: 40px;
top: 50%;
right: 12%;
transform: translate(50%, -50%);
position: absolute;
}
.input-send-danmu {
height: 40px;
padding: 8px 13px;
margin: 0 var(--status-bar-height);
bottom: 100px;
position: absolute;
background-color: rgba(0, 0, 0, 0.5);
color: #FFF;
}
.video-fullscreen_controls {
padding-left: var(--uni-safe-area-inset-left);
padding-right: var(--uni-safe-area-inset-right);
position: absolute;
left: 0;
right: 0;
bottom: 8px;
height: 50px;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.control-btn {
width: 50px;
height: 100%;
justify-content: center;
align-items: center;
margin: 0 15px;
}
.control-icon {
font-family: 'uni-video-icon';
font-size: 24px;
color: rgba(255, 255, 255, 0.8);
text-align: center;
}
</style>