mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-06-03 05:49:31 +00:00
f17622a1e1
This subproject adds a high-level web API compatible with GStreamer webrtcsrc and webrtcsink elements and the corresponding signaling server. It allows a perfect bidirectional communication between HTML5 WebRTC API and native GStreamer. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/946>
54 lines
2.1 KiB
JavaScript
54 lines
2.1 KiB
JavaScript
/*
|
|
* gstwebrtc-api
|
|
*
|
|
* Copyright (C) 2022 Igalia S.L. <info@igalia.com>
|
|
* Author: Loïc Le Page <llepage@igalia.com>
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
/**
|
|
* GStreamer WebRTC configuration.
|
|
* <p>You can override default values by defining configuration before receiving the <i>DOMContentLoaded</i> event.<br>
|
|
* Once the <i>DOMContentLoaded</i> event triggered, changing configuration will have no effect.</p>
|
|
* <p>For example:
|
|
* <pre>
|
|
* const signalingProtocol = window.location.protocol.startsWith("https") ? "wss" : "ws";
|
|
* window.gstWebRTCConfig = {
|
|
* meta: { name: `WebClient-${Date.now()}` },
|
|
* signalingServerUrl: `${signalingProtocol}://${window.location.host}/webrtc`
|
|
* };
|
|
* </pre></p>
|
|
* @typedef {object} gstWebRTCConfig
|
|
* @property {object} meta=null - Client free-form information that will be exchanged with all peers through the
|
|
* signaling <i>meta</i> property, its content depends on your application.
|
|
* @property {string} signalingServerUrl=ws://127.0.0.1:8443 - The WebRTC signaling server URL.
|
|
* @property {number} reconnectionTimeout=2500 - Timeout in milliseconds to reconnect to the signaling server in
|
|
* case of an unexpected disconnection.
|
|
* @property {object} webrtcConfig={iceServers...} - The WebRTC peer connection configuration passed to
|
|
* {@link external:RTCPeerConnection}. Default configuration only includes a list of free STUN servers
|
|
* (<i>stun[0-4].l.google.com:19302</i>).
|
|
*/
|
|
const defaultConfig = Object.freeze({
|
|
meta: null,
|
|
signalingServerUrl: "ws://127.0.0.1:8443",
|
|
reconnectionTimeout: 2500,
|
|
webrtcConfig: {
|
|
iceServers: [
|
|
{
|
|
urls: [
|
|
"stun:stun.l.google.com:19302",
|
|
"stun:stun1.l.google.com:19302",
|
|
"stun:stun2.l.google.com:19302",
|
|
"stun:stun3.l.google.com:19302",
|
|
"stun:stun4.l.google.com:19302"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
});
|
|
|
|
export { defaultConfig as default };
|