mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 04:39:06 +00:00
frontend: allow configuration of another webrtc server url (#108)
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import Peer from "simple-peer";
|
import Peer from "simple-peer";
|
||||||
|
|
||||||
const WebRTC_SERVER_URL = "http://127.0.0.1:1250/offer";
|
const WEBRTC_SERVER_URL = process.env.NEXT_PUBLIC_WEBRTC_SERVER_URL || "http://127.0.0.1:1250/offer";
|
||||||
|
|
||||||
const useWebRTC = (stream) => {
|
const useWebRTC = (stream) => {
|
||||||
const [data, setData] = useState({
|
const [data, setData] = useState({
|
||||||
@@ -17,7 +17,7 @@ const useWebRTC = (stream) => {
|
|||||||
|
|
||||||
peer.on("signal", (data) => {
|
peer.on("signal", (data) => {
|
||||||
if ("sdp" in data) {
|
if ("sdp" in data) {
|
||||||
fetch(WebRTC_SERVER_URL, {
|
fetch(WEBRTC_SERVER_URL, {
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
sdp: data.sdp,
|
sdp: data.sdp,
|
||||||
type: data.type,
|
type: data.type,
|
||||||
|
|||||||
Reference in New Issue
Block a user