Skip to content

Commit 4dce9f3

Browse files
committed
fix: 样式
1 parent 441c847 commit 4dce9f3

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

client/packages/rtc-web/src/views/video/hooks/useVideoCall.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
import { useUserMedia, useDevicesList } from '@vueuse/core';
2-
import { Ref, computed, ref, shallowRef, watch, watchEffect } from 'vue';
2+
import {
3+
Ref,
4+
computed,
5+
onBeforeUnmount,
6+
ref,
7+
shallowRef,
8+
watch,
9+
watchEffect,
10+
} from 'vue';
311

412
export type VideoShareOption = {
513
audio?: Ref<MediaDeviceInfo | undefined>;
@@ -89,6 +97,8 @@ export const useVideoShare = (option: VideoShareOption = {}) => {
8997
ideal: 30,
9098
max: 60,
9199
},
100+
width: { ideal: 1920 },
101+
height: { ideal: 1280 },
92102
}
93103
: false;
94104
return {
@@ -140,8 +150,12 @@ export const useVideoShare = (option: VideoShareOption = {}) => {
140150
audioTracks.value = stream.value.getAudioTracks();
141151
videoTracks.value = stream.value.getVideoTracks();
142152
}
143-
switchTrackEnable('audio', false);
144-
switchTrackEnable('video', false);
153+
if (!videoEnabled.value) {
154+
switchTrackEnable('video', false);
155+
}
156+
if (!audioEnabled.value) {
157+
switchTrackEnable('audio', false);
158+
}
145159
mediaLoaded.value = true;
146160
}
147161
}
@@ -159,6 +173,10 @@ export const useVideoShare = (option: VideoShareOption = {}) => {
159173
}
160174
});
161175

176+
onBeforeUnmount(() => {
177+
stop();
178+
});
179+
162180
return {
163181
video,
164182
setSinkId,

client/packages/rtc-web/src/views/video/video-room.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ const deviceChange = (device: MediaDeviceInfo) => {
7474
<video
7575
id="video-call"
7676
ref="video"
77-
class="flex-1"
77+
style="
78+
height: calc(100% - 80px);
79+
width: 100%;
80+
background-color: #1f1f1f;
81+
"
7882
playsinline
7983
controls
8084
autoplay

client/packages/rtc-web/src/views/video/video.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
<script lang="ts" setup>
22
import { useRoomConnect, useCreateRoom } from '@/hooks/useRoom';
3-
import { useRouter } from 'vue-router';
43
import { BackPreviousLevel, BackTitle } from '@/components/back';
54
import VideoRoom from './video-room.vue';
65
import { useNow, useDateFormat } from '@vueuse/core';
6+
import { resetUrl } from '@/utils';
77
88
defineOptions({
99
name: 'VideoView',
1010
});
1111
12-
const router = useRouter();
13-
1412
const { roomId } = useCreateRoom();
1513
1614
useRoomConnect();
1715
18-
const handleBackLevel = () => router.replace('/');
16+
const handleBackLevel = () => resetUrl();
1917
2018
const formatted = useDateFormat(useNow(), 'YYYY-MM-DD HH:mm:ss');
2119
</script>

0 commit comments

Comments
 (0)