RealityBoy c7ab236e10
perf: 将本地图标全部按需引入,首屏加载减少 61 个图标资源,首屏加载再次变快 (#389)
* perf: 优化图标,将本地图标按需引入,首屏加载减少 `61` 个图标资源,首屏加载再次变快
2022-11-30 12:39:12 +08:00

59 lines
1.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script setup lang="ts">
import { onMounted } from "vue";
import Player from "xgplayer/dist/simple_player";
import volume from "xgplayer/es/controls/volume";
import { deviceDetection } from "@pureadmin/utils";
import screenShot from "xgplayer/es/controls/screenShot";
import playbackRate from "xgplayer/es/controls/playbackRate";
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
import VideoPlay from "@iconify-icons/ep/video-play";
defineOptions({
name: "Video"
});
onMounted(() => {
new Player({
id: "mse",
// 默认静音
volume: 0,
autoplay: false,
screenShot: true,
url: "https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/mp4/xgplayer-demo-720p.mp4",
poster:
"https://s2.pstatp.com/cdn/expire-1-M/byted-player-videos/1.0.0/poster.jpg",
fluid: deviceDetection(),
controlPlugins: [volume, playbackRate, screenShot],
//传入倍速可选数组
playbackRate: [0.5, 0.75, 1, 1.5, 2]
});
});
</script>
<template>
<el-card>
<template #header>
<div class="card-header">
<span class="font-medium">
视频组件采用开源的
<el-link
href="https://v2.h5player.bytedance.com"
target="_blank"
:icon="useRenderIcon(VideoPlay)"
style="font-size: 16px; margin: 0 4px 5px"
>
西瓜播放器
</el-link>
</span>
</div>
</template>
<div id="mse" />
</el-card>
</template>
<style scoped>
#mse {
flex: auto;
}
</style>