Skip to content

Commit 4f96f36

Browse files
committed
feat: https
1 parent c04170d commit 4f96f36

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

client/packages/rtc-web/src/hooks/useRoom.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,13 @@ export const useRoomConnect = (option: ConnectOption = {}) => {
166166
pc.ondatachannel = (e) => {
167167
const chanel = e.channel;
168168
if (chanel.label === 'datachanel') {
169-
chanel.onmessage = (e: any) => {
169+
chanel.onmessage = () => {
170170
// console.log('接受', e.data);
171171
};
172172
}
173173
};
174174

175-
pc.onconnectionstatechange = (e) => {
175+
pc.onconnectionstatechange = () => {
176176
if (pc.connectionState === 'connected') {
177177
// console.log('完成');
178178
completed.value = true;

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export const useMediaSetting = (
111111
};
112112
});
113113

114-
const { stream, stop, restart, start } = useUserMedia({
114+
const { stream, stop, restart, start, isSupported } = useUserMedia({
115115
constraints,
116116
});
117117

@@ -167,6 +167,7 @@ export const useMediaSetting = (
167167

168168
// 进入页面先连接
169169
const startGetMedia = () => {
170+
console.log(isSupported.value);
170171
return new Promise<MediaStream | undefined>((resolve) => {
171172
const watchEnableStop = watchEffect(async () => {
172173
if (
@@ -217,13 +218,13 @@ export const useMediaConnect = (
217218
async roomCreated() {
218219
console.log('ccccreated');
219220
stream = await startGetMedia();
221+
console.log(stream);
220222
},
221223
roomJoined: async (_, pc) => {
222224
let innerStream = stream;
223225
stream = undefined;
224226
if (!innerStream) {
225227
innerStream = await startGetMedia();
226-
console.log('jjjjjjoined');
227228
}
228229
if (pc && innerStream) {
229230
innerStream.getTracks().forEach((track) => {

client/packages/rtc-web/vite.config.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import eslintPlugin from 'vite-plugin-eslint';
44
import { resolve } from 'path';
55
import vueJsx from '@vitejs/plugin-vue-jsx';
66

7+
import fs from 'fs';
8+
79
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
810

911
const pathResolve = (path: string) => resolve(__dirname, path);
@@ -25,11 +27,16 @@ export default defineConfig({
2527
host: '0.0.0.0',
2628
proxy: {
2729
'/api': {
28-
target: 'http://localhost:9092/api',
30+
target: 'https://192.168.1.11:9092/api',
2931
changeOrigin: true,
3032
rewrite: (path) => path.replace(/^\/api/, ''),
33+
secure: false,
3134
},
3235
},
36+
https: {
37+
key: fs.readFileSync('./cert/localhost+1-key.pem'),
38+
cert: fs.readFileSync('./cert/localhost+1.pem'),
39+
},
3340
},
3441
plugins: [
3542
vue(),
@@ -40,5 +47,9 @@ export default defineConfig({
4047
// 指定symbolId格式
4148
symbolId: 'icon-[dir]-[name]',
4249
}),
50+
// basicSsl(),
51+
// mkcert({
52+
// source: 'coding',
53+
// }),
4354
],
4455
});

0 commit comments

Comments
 (0)