Browse Source

webrtc: fix exception in browser when webrtcICEServers is empty (#1817) (#1821)

this fixes a regression introduced in v0.23.0.
pull/1824/head
Alessandro Ros 2 years ago committed by GitHub
parent
commit
6b8c65f5d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      internal/core/webrtc_publish_index.html
  2. 6
      internal/core/webrtc_read_index.html
  3. 18
      mediamtx.yml

4
internal/core/webrtc_publish_index.html

@ -111,7 +111,7 @@ const setState = (newState) => { @@ -111,7 +111,7 @@ const setState = (newState) => {
const restartPause = 2000;
const linkToIceServers = (links) => (
links.split(', ').map((link) => {
(links !== null) ? links.split(', ').map((link) => {
const m = link.match(/^<(.+?)>; rel="ice-server"(; username="(.*?)"; credential="(.*?)"; credential-type="password")?/i);
const ret = {
urls: [m[1]],
@ -124,7 +124,7 @@ const linkToIceServers = (links) => ( @@ -124,7 +124,7 @@ const linkToIceServers = (links) => (
}
return ret;
})
}) : []
);
const parseOffer = (offer) => {

6
internal/core/webrtc_read_index.html

@ -26,8 +26,8 @@ html, body { @@ -26,8 +26,8 @@ html, body {
const restartPause = 2000;
const linkToIceServers = (links) => (
links.split(', ').map((link) => {
const m = link.match(/^<(.+?)>; rel="ice-server"(; username="(.+?)"; credential="(.+?)"; credential-type="password")?/i);
(links !== null) ? links.split(', ').map((link) => {
const m = link.match(/^<(.+?)>; rel="ice-server"(; username="(.*?)"; credential="(.*?)"; credential-type="password")?/i);
const ret = {
urls: [m[1]],
};
@ -39,7 +39,7 @@ const linkToIceServers = (links) => ( @@ -39,7 +39,7 @@ const linkToIceServers = (links) => (
}
return ret;
})
}) : []
);
const parseOffer = (offer) => {

18
mediamtx.yml

@ -199,25 +199,27 @@ webrtcAllowOrigin: '*' @@ -199,25 +199,27 @@ webrtcAllowOrigin: '*'
# If the server receives a request from one of these entries, IP in logs
# will be taken from the X-Forwarded-For header.
webrtcTrustedProxies: []
# List of ICE servers, in format type:user:pass:host:port or type:host:port.
# List of ICE servers, in format type:user:password:host:port or type:host:port.
# type can be "stun", "turn" or "turns".
# STUN servers are used to get the public IP of both server and clients.
# TURN/TURNS servers are used as relay when a direct connection between server and clients is not possible.
# STUN servers are used to obtain the public IP of server and clients. They are
# needed when server and clients are on different LANs.
# TURN servers are needed when a direct connection between server and clients
# is not possible. All traffic is routed through the chosen TURN server.
# if user is "AUTH_SECRET", then authentication is secret based.
# the secret must be inserted into the pass field.
# the secret must be inserted into the password field.
webrtcICEServers: [stun:stun.l.google.com:19302]
# List of public IP addresses that are to be used as a host.
# This is used typically for servers that are behind 1:1 D-NAT.
webrtcICEHostNAT1To1IPs: []
# Address of a ICE UDP listener in format host:port.
# If filled, ICE traffic will come through a single UDP port,
# If filled, ICE traffic will pass through a single UDP port,
# allowing the deployment of the server inside a container or behind a NAT.
webrtcICEUDPMuxAddress:
# Address of a ICE TCP listener in format host:port.
# If filled, ICE traffic will come through a single TCP port,
# If filled, ICE traffic will pass through a single TCP port,
# allowing the deployment of the server inside a container or behind a NAT.
# At the moment, setting this parameter forces usage of the TCP protocol,
# which is not optimal for WebRTC.
# Setting this parameter forces usage of the TCP protocol, which is not
# optimal for WebRTC.
webrtcICETCPMuxAddress:
###############################################

Loading…
Cancel
Save