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()