From 130a2b04f17c4c4f66f1bb306b218a8b70f1175f Mon Sep 17 00:00:00 2001
From: wangyu <727842003@qq.com>
Date: Mon, 18 Dec 2023 09:43:58 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?=
=?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0server=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
index.html | 2 +-
src/components/JanusVideo/JanusVideo.vue | 6 +++++-
src/core/janus/index.js | 12 ++++--------
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/index.html b/index.html
index 99f583a..d9ebd58 100644
--- a/index.html
+++ b/index.html
@@ -4,7 +4,7 @@
-
Vite App
+ Janus WebRTC 视频播放
diff --git a/src/components/JanusVideo/JanusVideo.vue b/src/components/JanusVideo/JanusVideo.vue
index 93c9b41..686091e 100644
--- a/src/components/JanusVideo/JanusVideo.vue
+++ b/src/components/JanusVideo/JanusVideo.vue
@@ -6,7 +6,7 @@ const { play, stop, streams, stream, status, error } = useJanus({ autoplay: true
const selected = ref(null)
-const watch = () => play(selected.value);
+const watch = () => play(selected.value)
@@ -32,22 +32,26 @@ const watch = () => play(selected.value);
.video-wrapper {
padding: 20px;
text-align: center;
+
select {
width: 100%;
height: 40px;
margin-bottom: 20px;
}
+
.control {
display: flex;
justify-content: center;
align-items: center;
}
+
button {
width: 100px;
height: 30px;
margin-right: 20px;
margin-bottom: 20px;
}
+
video {
max-width: 1000px;
min-width: 800px;
diff --git a/src/core/janus/index.js b/src/core/janus/index.js
index f1d5acd..28432d6 100644
--- a/src/core/janus/index.js
+++ b/src/core/janus/index.js
@@ -6,13 +6,7 @@ export {
Janus
}
-const log = {
- info(...msg) {
- Janus.log(...msg)
- }
-}
-
-const config = {
+const defaultConfig = {
server: 'http://10.211.55.6:8088/janus'
}
@@ -207,7 +201,9 @@ export function useJanus(options) {
const start = async () => {
try {
- janus = await connect(config)
+ janus = await connect({
+ server: options.server || defaultConfig.server
+ })
streaming = await plugin(janus, StreamPlugin())
if (options.autoplay) {
await fetchStreams()