| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- <template>
- <div class="video-controls-wrap">
- <div class="left">
- <div
- class="play"
- @click="changePlay"
- >
- <n-icon size="25">
- <Pause v-if="appStore.playing"></Pause>
- <Play v-else></Play>
- </n-icon>
- </div>
- <div
- class="refresh"
- @click="debounceRefresh"
- >
- <n-icon size="25">
- <RefreshSharp></RefreshSharp>
- </n-icon>
- </div>
- <div
- class="muted"
- @click="changeMuted"
- >
- <n-popover
- placement="top"
- trigger="hover"
- :flip="false"
- :style="{ padding: '4px 4px 24px 4px' }"
- :show-arrow="false"
- >
- <template #trigger>
- <n-icon size="25">
- <VolumeMuteOutline v-if="cacheStore.muted"></VolumeMuteOutline>
- <VolumeHighOutline v-else></VolumeHighOutline>
- </n-icon>
- </template>
- <div class="slider">
- <div class="txt">{{ cacheStore.volume }}</div>
- <n-slider
- :value="cacheStore.volume"
- :step="1"
- vertical
- :tooltip="false"
- @update-value="changeVolume"
- />
- </div>
- </n-popover>
- </div>
- </div>
- <div class="right">
- <div
- class="resolution"
- v-if="resolution"
- >
- {{ resolution }}
- </div>
- <div class="line">
- <span
- class="txt"
- @click="showLine = !showLine"
- >
- 线路
- </span>
- <div
- class="list"
- :class="{ show: showLine }"
- >
- <div
- class="iten"
- :class="{ active: appStore.liveLine === item }"
- v-for="item in LiveLineEnum"
- :key="item"
- @click="changeLiveLine(item)"
- >
- {{ item }}
- </div>
- </div>
- </div>
- <div class="speed">
- <span
- class="txt"
- @click="showSpeed = !showSpeed"
- >
- 倍速
- </span>
- <div
- class="list"
- :class="{ show: showSpeed }"
- @click="handleTip"
- >
- <div class="iten">2.0x</div>
- <div class="iten">1.5x</div>
- <div class="iten active">1.0x</div>
- <div class="iten">0.5x</div>
- </div>
- </div>
- <div class="full">
- <span
- class="txt"
- @click="emits('fullScreen')"
- >
- 全屏
- </span>
- </div>
- </div>
- </div>
- </template>
- <script lang="ts" setup>
- import {
- Pause,
- Play,
- RefreshSharp,
- VolumeHighOutline,
- VolumeMuteOutline,
- } from '@vicons/ionicons5';
- import { debounce } from 'billd-utils';
- import { ref } from 'vue';
- import { LiveLineEnum } from '@/interface';
- import { useAppStore } from '@/store/app';
- import { usePiniaCacheStore } from '@/store/cache';
- import { LiveRoomTypeEnum } from '@/types/ILiveRoom';
- withDefaults(
- defineProps<{
- resolution?: string;
- }>(),
- {}
- );
- const emits = defineEmits(['refresh', 'fullScreen']);
- const debounceRefresh = debounce(() => {
- emits('refresh');
- }, 500);
- const cacheStore = usePiniaCacheStore();
- const appStore = useAppStore();
- const showLine = ref(false);
- const showSpeed = ref(false);
- function handleTip() {
- window.$message.info('敬请期待!');
- }
- function changeMuted() {
- cacheStore.setMuted(!cacheStore.muted);
- }
- function changeVolume(v) {
- cacheStore.setVolume(v);
- }
- function changePlay() {
- appStore.playing = !appStore.playing;
- }
- function changeLiveLine(item: LiveLineEnum) {
- if (
- [
- LiveRoomTypeEnum.wertc_live,
- LiveRoomTypeEnum.wertc_meeting_one,
- LiveRoomTypeEnum.wertc_meeting_two,
- ].includes(appStore.liveRoomInfo?.type!) &&
- item !== LiveLineEnum.rtc
- ) {
- window.$message.info('不支持该线路!');
- return;
- }
- appStore.setLiveLine(item);
- }
- </script>
- <style lang="scss" scoped>
- .slider {
- display: flex;
- flex-wrap: wrap;
- justify-content: center;
- width: 24px;
- height: 80px;
- text-align: center;
- .txt {
- font-size: 12px;
- }
- }
- .video-controls-wrap {
- position: absolute;
- bottom: 0;
- left: 0;
- z-index: 50;
- display: flex;
- align-items: center;
- justify-content: space-between;
- box-sizing: border-box;
- padding: 0 20px 0 10px;
- width: 100%;
- height: 40px;
- background-image: linear-gradient(
- -180deg,
- rgba(0, 0, 0, 0),
- rgba(0, 0, 0, 0.7)
- );
- color: white;
- text-align: initial;
- user-select: none;
- .left {
- display: flex;
- align-items: center;
- .muted,
- .refresh,
- .play {
- display: flex;
- align-items: center;
- margin-right: 10px;
- cursor: pointer;
- }
- }
- .right {
- display: flex;
- align-items: center;
- .resolution {
- cursor: no-drop;
- }
- .resolution,
- .line,
- .speed,
- .full {
- position: relative;
- margin-right: 15px;
- &:hover {
- .list {
- display: block;
- }
- }
- .txt {
- cursor: pointer;
- }
- .list {
- position: absolute;
- top: 0;
- left: 50%;
- display: none;
- background-color: rgba($color: #000000, $alpha: 0.5);
- text-align: center;
- transform: translate(-50%, -100%);
- &.show {
- display: block;
- }
- .iten {
- padding: 6px 10px;
- &.active {
- color: $theme-color-gold;
- }
- &:not(:last-child) {
- margin-bottom: 4px;
- }
- &:hover {
- background-color: rgba($color: #ffffff, $alpha: 0.1);
- cursor: pointer;
- }
- }
- }
- }
- .full {
- margin-right: 0;
- }
- }
- }
- </style>
|