perf: 优化视频组件

This commit is contained in:
奔跑的面条 2022-09-22 19:38:35 +08:00
parent a48bdd08ff
commit b9e3053fe3
6 changed files with 5 additions and 13 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -9,8 +9,6 @@ export const option = {
dataset: video,
// 循环播放
loop: true,
// 自动播放
autoplay: true,
// 静音
muted: true,
// 适应方式

View File

@ -9,9 +9,6 @@
</setting-item-box>
<setting-item-box name="控制">
<setting-item>
<n-checkbox v-model:checked="optionData.autoplay" size="small">自动播放</n-checkbox>
</setting-item>
<setting-item>
<n-checkbox v-model:checked="optionData.loop" size="small">循环播放</n-checkbox>
</setting-item>

View File

@ -1,5 +1,5 @@
import image from '@/assets/images/chart/informations/photo.png'
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d'
import image from '@/assets/images/chart/informations/video.png'
import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d'
import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d'
export const VideoConfig: ConfigType = {
@ -10,5 +10,6 @@ export const VideoConfig: ConfigType = {
category: ChatCategoryEnum.MORE,
categoryName: ChatCategoryEnumName.MORE,
package: PackagesCategoryEnum.INFORMATIONS,
chartFrame: ChartFrameEnum.ECHARTS,
image
}

View File

@ -7,8 +7,8 @@
preload="auto"
crossOrigin="anonymous"
playsinline
autoplay
:loop="option.loop"
:autoplay="option.autoplay"
:muted="option.muted"
:width="w"
:height="h"
@ -47,12 +47,8 @@ watch(
if (!vVideoRef.value) return
const video: any = vVideoRef.value
video.loop = option.loop
video.autoplay = option.autoplay
video.muted = option.muted
//
!option.autoplay && (video.pause(), (video.currentTime = 0))
option.autoplay && video.play()
video.play()
},
{
immediate: true,