webrtc-streamer 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +316 -240
- package/docs/api.md +11 -0
- package/html/admin.html +2 -2
- package/html/help.html +3 -3
- package/html/index.html +2 -2
- package/html/{janusvideoroom.json → janusconfig.js} +0 -0
- package/html/janustest.html +2 -2
- package/html/janusvideoroom.html +10 -21
- package/html/jitsiroom.html +1 -1
- package/html/jitsitest.html +2 -2
- package/html/libs/adapter.min.js +40 -6
- package/html/libs/blazeface +17 -0
- package/html/libs/lib-jitsi-meet.min.js +2 -25
- package/html/map.html +1 -1
- package/html/sendstream.html +17 -22
- package/html/tensorflow.js +45 -12
- package/html/webrtc-streamer-algo-element.js +1 -0
- package/html/webrtc-streamer-element.html +1 -0
- package/html/webrtc-streamer-element.js +23 -9
- package/html/webrtc-streamer-footer-element.js +1 -1
- package/html/{webrtcstreamer.json → webrtcconfig.js} +0 -0
- package/html/webrtcstreamer.html +1 -1
- package/html/webrtcstreamer.js +34 -40
- package/html/whipclient.html +76 -0
- package/html/{xmppvideoroom.json → xmppconfig.js} +0 -0
- package/html/xmppvideoroom.html +2 -2
- package/libv4l2cpp/README.md +6 -6
- package/libv4l2cpp/inc/V4l2Access.h +8 -9
- package/libv4l2cpp/inc/V4l2Capture.h +2 -2
- package/libv4l2cpp/inc/V4l2Device.h +20 -12
- package/libv4l2cpp/inc/V4l2MmapDevice.h +2 -2
- package/libv4l2cpp/inc/V4l2Output.h +4 -4
- package/libv4l2cpp/main.cpp +118 -0
- package/libv4l2cpp/src/V4l2Capture.cpp +4 -4
- package/libv4l2cpp/src/V4l2Device.cpp +7 -7
- package/libv4l2cpp/src/V4l2MmapDevice.cpp +2 -2
- package/libv4l2cpp/src/V4l2Output.cpp +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,296 +1,372 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
|
|
2
|
+
# WebRTC-Streamer
|
|
3
|
+
<a href="https://wiki.friendlyelec.com/wiki/index.php/NanoPi_NEO_Air"><img alt="A picture of a Nano PI NEO Air" src="images/nanopi.jpg" width="500"></a>
|
|
4
|
+
|
|
5
|
+
[](https://circleci.com/gh/mpromonet/webrtc-streamer)
|
|
6
|
+
[](https://cirrus-ci.com/github/mpromonet/webrtc-streamer)
|
|
3
7
|
[](https://snapcraft.io/webrtc-streamer)
|
|
4
|
-
[](https://github.com/mpromonet/webrtc-streamer/actions/workflows/cpp-linux.yml)
|
|
5
|
-
[](https://github.com/mpromonet/webrtc-streamer/actions/workflows/cpp-windows.yml)
|
|
6
|
-
[](https://github.com/mpromonet/webrtc-streamer/actions/workflows/cpp-macos.yml)
|
|
7
8
|
|
|
8
|
-
[](https://github.com/mpromonet/webrtc-streamer/actions/workflows/cpp-linux.yml)
|
|
10
|
+
[](https://github.com/mpromonet/webrtc-streamer/actions/workflows/cpp-windows.yml)
|
|
11
|
+
[](https://github.com/mpromonet/webrtc-streamer/actions/workflows/cpp-macos.yml)
|
|
9
12
|
|
|
10
13
|
[](https://github.com/mpromonet/webrtc-streamer/releases/latest)
|
|
11
14
|
[](https://github.com/mpromonet/webrtc-streamer/releases/latest)
|
|
12
15
|
[](https://hub.docker.com/r/mpromonet/webrtc-streamer/)
|
|
13
16
|
|
|
14
|
-
[](https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/)
|
|
15
18
|
[](https://gitpod.io/#https://github.com/mpromonet/webrtc-streamer)
|
|
16
19
|
|
|
17
|
-
WebRTC
|
|
18
|
-
===============
|
|
19
|
-
|
|
20
|
-
[](http://wiki.friendlyarm.com/wiki/index.php/NanoPi_NEO_Air)
|
|
21
|
-
|
|
22
|
-
WebRTC-streamer is an experiment to stream video capture devices and RTSP sources through WebRTC using simple mechanism.
|
|
23
|
-
|
|
24
|
-
It embeds a HTTP server that implements API and serves a simple HTML page that use them through AJAX.
|
|
25
|
-
|
|
26
|
-
The WebRTC signaling is implemented through HTTP requests:
|
|
27
|
-
|
|
28
|
-
- /api/call : send offer and get answer
|
|
29
|
-
- /api/hangup : close a call
|
|
30
|
-
|
|
31
|
-
- /api/addIceCandidate : add a candidate
|
|
32
|
-
- /api/getIceCandidate : get the list of candidates
|
|
33
|
-
|
|
34
|
-
The list of HTTP API is available using /api/help.
|
|
35
|
-
|
|
36
|
-
Nowdays there is builds on [CircleCI](https://circleci.com/gh/mpromonet/webrtc-streamer), [CirrusCI](https://cirrus-ci.com/github/mpromonet/webrtc-streamer) and [GitHub CI](https://github.com/mpromonet/webrtc-streamer/actions) :
|
|
37
|
-
* for x86_64 on Ubuntu Bionic
|
|
38
|
-
* for armv7 crosscompiled (this build is running on Raspberry Pi2 and NanoPi NEO)
|
|
39
|
-
* for armv6+vfp crosscompiled (this build is running on Raspberry PiB and should run on a Raspberry Zero)
|
|
40
|
-
* for arm64 crosscompiled
|
|
41
|
-
* Windows x64 build with clang
|
|
42
|
-
* MacOS
|
|
43
|
-
|
|
44
|
-
The webrtc stream name could be :
|
|
45
|
-
* an alias defined using -n argument then the corresponding -u argument will be used to create the capturer
|
|
46
|
-
* an "rtsp://" url that will be openned using an RTSP capturer based on live555
|
|
47
|
-
* an "file://" url that will be openned using an MKV capturer based on live555
|
|
48
|
-
* an "screen://" url that will be openned by webrtc::DesktopCapturer::CreateScreenCapturer
|
|
49
|
-
* an "window://" url that will be openned by webrtc::DesktopCapturer::CreateWindowCapturer
|
|
50
|
-
* an "v4l2://" url that will capture H264 frames and store it using webrtc::VideoFrameBuffer::Type::kNative type (obviously not supported on Windows)
|
|
51
|
-
* a capture device name
|
|
52
|
-
|
|
53
|
-
Dependencies :
|
|
54
|
-
-------------
|
|
55
|
-
It is based on :
|
|
56
|
-
* [WebRTC Native Code Package](http://www.webrtc.org) for WebRTC
|
|
57
|
-
* [civetweb HTTP server](https://github.com/civetweb/civetweb) for HTTP server
|
|
58
|
-
* [live555](http://www.live555.com/liveMedia) for RTSP/MKV source
|
|
59
|
-
|
|
60
|
-
Build
|
|
61
|
-
===============
|
|
62
|
-
Install the Chromium depot tools (for WebRTC).
|
|
63
|
-
-------
|
|
64
|
-
pushd ..
|
|
65
|
-
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
|
66
|
-
export PATH=$PATH:`realpath depot_tools`
|
|
67
|
-
popd
|
|
68
|
-
|
|
69
|
-
Download WebRTC
|
|
70
|
-
-------
|
|
71
|
-
mkdir ../webrtc
|
|
72
|
-
pushd ../webrtc
|
|
73
|
-
fetch --no-history webrtc
|
|
74
|
-
popd
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
Build WebRTC Streamer
|
|
78
|
-
-------
|
|
79
|
-
cmake . && make
|
|
80
|
-
|
|
81
|
-
It is possible to specify cmake parameters WEBRTCROOT & WEBRTCDESKTOPCAPTURE :
|
|
82
|
-
- $WEBRTCROOT/src should contains source (default is $(pwd)/../webrtc)
|
|
83
|
-
- WEBRTCDESKTOPCAPTURE enabling desktop capture if available (default is ON)
|
|
84
|
-
|
|
85
|
-
Usage
|
|
86
|
-
===============
|
|
87
|
-
./webrtc-streamer [-H http port] [-S[embeded stun address]] -[v[v]] [url1]...[urln]
|
|
88
|
-
./webrtc-streamer [-H http port] [-s[external stun address]] -[v[v]] [url1]...[urln]
|
|
89
|
-
./webrtc-streamer -V
|
|
90
|
-
-v[v[v]] : verbosity
|
|
91
|
-
-V : print version
|
|
20
|
+
Experimentation to stream WebRTC media sources like capture devices, screen capture, mkv files and RTSP sources using simple signaling.
|
|
92
21
|
|
|
93
|
-
|
|
94
|
-
-w webroot : path to get files
|
|
95
|
-
-c sslkeycert : path to private key and certificate for HTTPS
|
|
96
|
-
-N nbthreads : number of threads for HTTP server
|
|
97
|
-
-A passwd : password file for HTTP server access
|
|
98
|
-
-D authDomain : authentication domain for HTTP server access (default:mydomain.com)
|
|
22
|
+
## Artefacts
|
|
99
23
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
-t[username:password@]turn_address : use an external TURN relay server (default:disabled)
|
|
103
|
-
-T[username:password@]turn_address : start embeded TURN server (default:disabled)
|
|
104
|
-
|
|
105
|
-
-a[audio layer] : spefify audio capture layer to use (default:0)
|
|
106
|
-
-q[filter] : spefify publish filter (default:.*)
|
|
107
|
-
-o : use null codec (keep frame encoded)
|
|
24
|
+
* packages are available from https://github.com/mpromonet/webrtc-streamer/releases/latest
|
|
25
|
+
* container image are available from https://hub.docker.com/r/mpromonet/webrtc-streamer
|
|
108
26
|
|
|
109
|
-
-C config.json : load urls from JSON config file
|
|
110
|
-
-R [Udp port range min:max] : Set the webrtc udp port range (default 0:65535)
|
|
111
27
|
|
|
112
|
-
|
|
113
|
-
[url] : url to register in the source list
|
|
28
|
+
## Usage
|
|
114
29
|
|
|
115
|
-
|
|
30
|
+
```roff
|
|
31
|
+
./webrtc-streamer [-H http port] [-S[embeded stun address]] -[v[v]] [urls...]
|
|
32
|
+
./webrtc-streamer [-H http port] [-s[external stun address]] -[v[v]] [urls...]
|
|
33
|
+
./webrtc-streamer -V
|
|
34
|
+
-v[v[v]] : verbosity
|
|
35
|
+
-V : print version
|
|
36
|
+
-C config.json : load urls from JSON config file
|
|
37
|
+
-n name -u videourl -U audiourl : register a name for a video url and an audio url
|
|
38
|
+
[url] : url to register in the source list
|
|
116
39
|
|
|
117
|
-
|
|
40
|
+
-H [hostname:]port : HTTP server binding (default 0.0.0.0:8000)
|
|
41
|
+
-w webroot : path to get files
|
|
42
|
+
-c sslkeycert : path to private key and certificate for HTTPS
|
|
43
|
+
-N nbthreads : number of threads for HTTP server
|
|
44
|
+
-A passwd : password file for HTTP server access
|
|
45
|
+
-D authDomain : authentication domain for HTTP server access (default:mydomain.com)
|
|
118
46
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
[
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
* https://webrtc-streamer.herokuapp.com/webrtcstreamer.html?rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov
|
|
131
|
-
* https://webrtc-streamer.herokuapp.com/webrtcstreamer.html?Bunny
|
|
132
|
-
|
|
133
|
-
An example displaying grid of WebRTC Streams is available using option "layout=<lines>x<columns>"
|
|
134
|
-
[](https://webrtc-streamer.herokuapp.com/?layout=2x4)
|
|
135
|
-
|
|
136
|
-
[Live Demo](https://webrtc-streamer.herokuapp.com/?layout=2x4)
|
|
137
|
-
|
|
138
|
-
Using embedded STUN/TURN server behind a NAT:
|
|
139
|
-
===============
|
|
140
|
-
|
|
141
|
-
It is possible start embeded ICE server and publish its url using:
|
|
142
|
-
|
|
143
|
-
./webrtc-streamer -S0.0.0.0:3478 -s$(curl -s ifconfig.me):3478
|
|
144
|
-
./webrtc-streamer -s- -T0.0.0.0:3478 -tturn:turn@$(curl -s ifconfig.me):3478
|
|
145
|
-
./webrtc-streamer -S0.0.0.0:3478 -s$(curl -s ifconfig.me):3478 -T0.0.0.0:3479 -tturn:turn@$(curl -s ifconfig.me):3479
|
|
146
|
-
The command `curl -s ifconfig.me` is getting the public IP, it could also given as a static parameter.
|
|
147
|
-
|
|
148
|
-
In order to configure the NAT rules using the upnp feature of the router, it is possible to use [upnpc](https://manpages.debian.org/unstable/miniupnpc/upnpc.1.en.html) like this:
|
|
47
|
+
-S[stun_address] : start embeded STUN server bind to address (default 0.0.0.0:3478)
|
|
48
|
+
-s[stun_address] : use an external STUN server (default:stun.l.google.com:19302 , -:means no STUN)
|
|
49
|
+
-T[username:password@]turn_address : start embeded TURN server (default:disabled)
|
|
50
|
+
-t[username:password@]turn_address : use an external TURN relay server (default:disabled)
|
|
51
|
+
-R [Udp port range min:max] : Set the webrtc udp port range (default 0:65535)
|
|
52
|
+
-W webrtc_trials_fields : Set the webrtc trials fields (default:WebRTC-FrameDropper/Disabled/)
|
|
53
|
+
-a[audio layer] : spefify audio capture layer to use (default:0)
|
|
54
|
+
-q[filter] : spefify publish filter (default:.*)
|
|
55
|
+
-o : use null codec (keep frame encoded)
|
|
56
|
+
```
|
|
149
57
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
58
|
+
Arguments of '-H' are forwarded to option
|
|
59
|
+
[`listening_ports`](https://github.com/civetweb/civetweb/blob/master/docs/UserManual.md#listening_ports-8080)
|
|
60
|
+
of civetweb, allowing use of the civetweb syntax like `-H8000,9000` or
|
|
61
|
+
`-H8080r,8443s`.
|
|
62
|
+
|
|
63
|
+
Using `-o` allows storing compressed frame data from the backend stream using
|
|
64
|
+
`webrtc::VideoFrameBuffer::Type::kNative`. This hacks the stucture
|
|
65
|
+
`webrtc::VideoFrameBuffer` storing data in a override of the i420 buffer. This
|
|
66
|
+
allows forwarding H264 frames from V4L2 device or RTSP stream to WebRTC stream.
|
|
67
|
+
It uses less CPU, but has less features (resize, codec, and bandwidth are
|
|
68
|
+
disabled).
|
|
160
69
|
|
|
161
|
-
|
|
162
|
-
<head>
|
|
163
|
-
<script src="libs/adapter.min.js" ></script>
|
|
164
|
-
<script src="webrtcstreamer.js" ></script>
|
|
165
|
-
<script>
|
|
166
|
-
var webRtcServer = null;
|
|
167
|
-
window.onload = function() {
|
|
168
|
-
webRtcServer = new WebRtcStreamer("video",location.protocol+"//"+window.location.hostname+":8000");
|
|
169
|
-
webRtcServer.connect("rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov");
|
|
170
|
-
}
|
|
171
|
-
window.onbeforeunload = function() { webRtcServer.disconnect(); }
|
|
172
|
-
</script>
|
|
173
|
-
</head>
|
|
174
|
-
<body>
|
|
175
|
-
<video id="video" />
|
|
176
|
-
</body>
|
|
177
|
-
</html>
|
|
70
|
+
Options for the WebRTC stream name:
|
|
178
71
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
72
|
+
- an alias defined using `-n` argument then the corresponding `-u` argument will
|
|
73
|
+
be used to create the capturer
|
|
74
|
+
- an "rtsp://" url that will be opened using an RTSP capturer based on live555
|
|
75
|
+
- an "file://" url that will be opened using an MKV capturer based on live555
|
|
76
|
+
- an "screen://" url that will be opened by
|
|
77
|
+
`webrtc::DesktopCapturer::CreateScreenCapturer`
|
|
78
|
+
- an "window://" url that will be opened by
|
|
79
|
+
`webrtc::DesktopCapturer::CreateWindowCapturer`
|
|
80
|
+
- an "v4l2://" url that will capture
|
|
81
|
+
[H264](https://en.wikipedia.org/wiki/Advanced_Video_Coding) frames and store
|
|
82
|
+
it using webrtc::VideoFrameBuffer::Type::kNative type (not supported on
|
|
83
|
+
Windows)
|
|
84
|
+
- a capture device name
|
|
182
85
|
|
|
183
|
-
|
|
184
|
-
<head>
|
|
185
|
-
<script type="module" src="webrtc-streamer-element.js"></script>
|
|
186
|
-
</head>
|
|
187
|
-
<body>
|
|
188
|
-
<webrtc-streamer url="rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"></webrtc-streamer>
|
|
189
|
-
</body>
|
|
190
|
-
</html>
|
|
86
|
+
#### Examples
|
|
191
87
|
|
|
192
|
-
|
|
88
|
+
```sh
|
|
89
|
+
./webrtc-streamer rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov
|
|
90
|
+
```
|
|
193
91
|
|
|
194
|
-
|
|
92
|
+
[](https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/)
|
|
195
93
|
|
|
196
|
-
[
|
|
94
|
+
[Live Demo](https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/)
|
|
197
95
|
|
|
198
|
-
|
|
96
|
+
We can access to the WebRTC stream using
|
|
97
|
+
[webrtcstreamer.html](https://github.com/mpromonet/webrtc-streamer-html/blob/master/webrtcstreamer.html).
|
|
98
|
+
For instance:
|
|
199
99
|
|
|
200
|
-
|
|
100
|
+
- [webrtcstreamer.html?rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov](https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/webrtcstreamer.html?rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov)
|
|
101
|
+
- [webrtcstreamer.html?Bunny](https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/webrtcstreamer.html?Bunny)
|
|
201
102
|
|
|
202
|
-
|
|
103
|
+
An example displaying grid of WebRTC Streams is available using option
|
|
104
|
+
`layout=<lines>x<columns>`
|
|
105
|
+
[](https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/?layout=2x4)
|
|
203
106
|
|
|
204
|
-
[Live Demo](https://
|
|
107
|
+
[Live Demo (?layout=2x4)](https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/?layout=2x4)
|
|
205
108
|
|
|
206
|
-
|
|
207
|
-
===============
|
|
109
|
+
## Using docker image
|
|
208
110
|
|
|
209
|
-
|
|
111
|
+
You can start the application using the docker image:
|
|
210
112
|
|
|
211
|
-
|
|
113
|
+
```sh
|
|
114
|
+
docker run -p 8000:8000 -it mpromonet/webrtc-streamer
|
|
115
|
+
```
|
|
212
116
|
|
|
117
|
+
You can expose V4L2 devices from your host using:
|
|
213
118
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
119
|
+
```sh
|
|
120
|
+
docker run --device=/dev/video0 -p 8000:8000 -it mpromonet/webrtc-streamer
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The container entry point is the webrtc-streamer application, then you can:
|
|
124
|
+
|
|
125
|
+
- view all commands
|
|
126
|
+
```sh
|
|
127
|
+
docker run -p 8000:8000 -it mpromonet/webrtc-streamer --help
|
|
128
|
+
```
|
|
129
|
+
- run the container registering a RTSP url:
|
|
130
|
+
|
|
131
|
+
```sh
|
|
132
|
+
docker run -p 8000:8000 -it mpromonet/webrtc-streamer -n raspicam -u rtsp://pi2.local:8554/unicast
|
|
133
|
+
```
|
|
134
|
+
- run the container giving config.json file:
|
|
135
|
+
|
|
136
|
+
```sh
|
|
137
|
+
docker run -p 8000:8000 -v $PWD/config.json:/app/config.json mpromonet/webrtc-streamer
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Using embedded STUN/TURN server behind a NAT
|
|
141
|
+
|
|
142
|
+
It is possible to start an embeded [STUN](https://en.wikipedia.org/wiki/STUN)
|
|
143
|
+
and [TURN](https://en.wikipedia.org/wiki/Traversal_Using_Relays_around_NAT)
|
|
144
|
+
server and publish its URL:
|
|
217
145
|
|
|
218
|
-
|
|
146
|
+
```sh
|
|
147
|
+
./webrtc-streamer -S0.0.0.0:3478 -s$(curl -s ifconfig.me):3478
|
|
148
|
+
./webrtc-streamer -s- -T0.0.0.0:3478 -tturn:turn@$(curl -s ifconfig.me):3478
|
|
149
|
+
./webrtc-streamer -S0.0.0.0:3478 -s$(curl -s ifconfig.me):3478 -T0.0.0.0:3479 -tturn:turn@$(curl -s ifconfig.me):3479
|
|
150
|
+
```
|
|
219
151
|
|
|
220
|
-
|
|
152
|
+
The command `curl -s ifconfig.me` is getting the public IP, it could also given
|
|
153
|
+
as a static parameter.
|
|
221
154
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
var janus = new JanusVideoRoom("https://janus.conf.meetecho.com/janus", null);
|
|
227
|
-
janus.join(1234, "rtsp://pi2.local:8554/unicast","pi2");
|
|
228
|
-
janus.join(1234, "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov","media");
|
|
229
|
-
</script>
|
|
230
|
-
</head>
|
|
231
|
-
</html>
|
|
155
|
+
In order to configure the NAT rules using the upnp feature of the router, it is
|
|
156
|
+
possible to use
|
|
157
|
+
[upnpc](https://manpages.debian.org/unstable/miniupnpc/upnpc.1.en.html) like
|
|
158
|
+
this:
|
|
232
159
|
|
|
233
|
-
|
|
160
|
+
```sh
|
|
161
|
+
upnpc -r 8000 tcp 3478 tcp 3478 udp
|
|
162
|
+
```
|
|
234
163
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
This way the communication between [Janus API](https://janus.conf.meetecho.com/docs/JS.html) and [WebRTC Streamer API](https://webrtc-streamer.herokuapp.com/help) is implemented in Javascript running in browser.
|
|
238
|
-
|
|
239
|
-
The same logic could be implemented in NodeJS using the same JS API :
|
|
240
|
-
|
|
241
|
-
global.request = require('then-request');
|
|
242
|
-
var JanusVideoRoom = require('./html/janusvideoroom.js');
|
|
243
|
-
var janus = new JanusVideoRoom("http://192.168.0.15:8088/janus", "http://192.168.0.15:8000")
|
|
244
|
-
janus.join(1234,"mmal service 16.1","video")
|
|
164
|
+
Adapting with the HTTP port, STUN port, TURN port.
|
|
245
165
|
|
|
246
|
-
|
|
247
|
-
===============
|
|
248
|
-
A simple way to publish WebRTC stream to a [Jitsi](https://meet.jit.si) Video Room is to use the [XMPPVideoRoom](http://htmlpreview.github.io/?https://github.com/mpromonet/webrtc-streamer-html/blob/master/jsdoc/XMPPVideoRoom.html) interface
|
|
166
|
+
## HTML Embedding
|
|
249
167
|
|
|
250
|
-
|
|
168
|
+
Instead of using the internal HTTP server, it is easy to display a WebRTC stream
|
|
169
|
+
in a HTML page served by another HTTP server. The URL of the WebRTC-streamer to
|
|
170
|
+
use should be given creating the
|
|
171
|
+
[WebRtcStreamer](http://htmlpreview.github.io/?https://github.com/mpromonet/webrtc-streamer-html/blob/master/jsdoc/WebRtcStreamer.html)
|
|
172
|
+
instance:
|
|
251
173
|
|
|
252
|
-
|
|
174
|
+
```js
|
|
175
|
+
var webRtcServer = new WebRtcStreamer(<video tag>, <webrtc-streamer url>);
|
|
176
|
+
```
|
|
253
177
|
|
|
254
|
-
|
|
255
|
-
<head>
|
|
256
|
-
<script src="libs/strophe.min.js" ></script>
|
|
257
|
-
<script src="libs/strophe.muc.min.js" ></script>
|
|
258
|
-
<script src="libs/strophe.disco.min.js" ></script>
|
|
259
|
-
<script src="libs/strophe.jingle.sdp.js"></script>
|
|
260
|
-
<script src="libs/jquery-3.5.1.min.js"></script>
|
|
261
|
-
<script src="xmppvideoroom.js" ></script>
|
|
262
|
-
<script>
|
|
263
|
-
var xmpp = new XMPPVideoRoom("meet.jit.si", null);
|
|
264
|
-
xmpp.join("testroom", "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov","Bunny");
|
|
265
|
-
</script>
|
|
266
|
-
</head>
|
|
267
|
-
</html>
|
|
178
|
+
A short sample HTML page using webrtc-streamer running locally on port 8000:
|
|
268
179
|
|
|
269
|
-
|
|
180
|
+
```html
|
|
181
|
+
<html>
|
|
182
|
+
<head>
|
|
183
|
+
<script src="libs/adapter.min.js" ></script>
|
|
184
|
+
<script src="webrtcstreamer.js" ></script>
|
|
185
|
+
<script>
|
|
186
|
+
var webRtcServer = null;
|
|
187
|
+
window.onload = function() {
|
|
188
|
+
webRtcServer = new WebRtcStreamer("video",location.protocol+"//"+window.location.hostname+":8000");
|
|
189
|
+
webRtcServer.connect("rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov");
|
|
190
|
+
}
|
|
191
|
+
window.onbeforeunload = function() { webRtcServer.disconnect(); }
|
|
192
|
+
</script>
|
|
193
|
+
</head>
|
|
194
|
+
<body>
|
|
195
|
+
<video id="video" />
|
|
196
|
+
</body>
|
|
197
|
+
</html>
|
|
198
|
+
```
|
|
270
199
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
200
|
+
## Using WebComponents
|
|
201
|
+
|
|
202
|
+
WebRTC-streamer provides its own
|
|
203
|
+
[Web Components](https://www.webcomponents.org/) as an alternative way to
|
|
204
|
+
display a WebRTC stream in an HTML page. For example:
|
|
205
|
+
|
|
206
|
+
```html
|
|
207
|
+
<html>
|
|
208
|
+
<head>
|
|
209
|
+
<script type="module" src="webrtc-streamer-element.js"></script>
|
|
210
|
+
</head>
|
|
211
|
+
<body>
|
|
212
|
+
<webrtc-streamer url="rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"></webrtc-streamer>
|
|
213
|
+
</body>
|
|
214
|
+
</html>
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
[Live Demo](https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/Bunny.html)
|
|
218
|
+
|
|
219
|
+
Using the webcomponent with a stream selector:
|
|
220
|
+
|
|
221
|
+
[](https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/webrtc-streamer-element.html)
|
|
222
|
+
|
|
223
|
+
[Live Demo](https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/webrtc-streamer-element.html)
|
|
224
|
+
|
|
225
|
+
Using the webcomponent over google map:
|
|
226
|
+
|
|
227
|
+
[](https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/map.html)
|
|
228
|
+
|
|
229
|
+
[Live Demo](https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/map.html)
|
|
274
230
|
|
|
275
|
-
|
|
231
|
+
## Object detection using tensorflow.js
|
|
232
|
+
|
|
233
|
+
[](https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/tensorflow.html)
|
|
234
|
+
|
|
235
|
+
[Live Demo](https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/tensorflow.html)
|
|
236
|
+
|
|
237
|
+
## Connect to Janus Gateway Video Room
|
|
238
|
+
|
|
239
|
+
A simple way to publish WebRTC stream to a
|
|
240
|
+
[Janus Gateway](https://janus.conf.meetecho.com) Video Room is to use the
|
|
241
|
+
[JanusVideoRoom](http://htmlpreview.github.io/?https://github.com/mpromonet/webrtc-streamer-html/blob/master/jsdoc/JanusVideoRoom.html)
|
|
242
|
+
interface
|
|
243
|
+
|
|
244
|
+
```js
|
|
245
|
+
var janus = new JanusVideoRoom(<janus url>, <webrtc-streamer url>)
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
A short sample to publish WebRTC streams to Janus Video Room could be:
|
|
249
|
+
|
|
250
|
+
```html
|
|
251
|
+
<html>
|
|
252
|
+
<head>
|
|
253
|
+
<script src="janusvideoroom.js" ></script>
|
|
254
|
+
<script>
|
|
255
|
+
var janus = new JanusVideoRoom("https://janus.conf.meetecho.com/janus", null);
|
|
256
|
+
janus.join(1234, "rtsp://pi2.local:8554/unicast","pi2");
|
|
257
|
+
janus.join(1234, "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov","media");
|
|
258
|
+
</script>
|
|
259
|
+
</head>
|
|
260
|
+
</html>
|
|
261
|
+
```
|
|
276
262
|
|
|
277
|
-
|
|
263
|
+
[](https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/janusvideoroom.html)
|
|
264
|
+
|
|
265
|
+
[Live Demo](https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/janusvideoroom.html)
|
|
266
|
+
|
|
267
|
+
This way the communication between
|
|
268
|
+
[Janus API](https://janus.conf.meetecho.com/docs/JS.html) and
|
|
269
|
+
[WebRTC Streamer API](https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/help)
|
|
270
|
+
is implemented in Javascript running in browser.
|
|
271
|
+
|
|
272
|
+
The same logic could be implemented in NodeJS using the same JS API:
|
|
273
|
+
|
|
274
|
+
```js
|
|
275
|
+
global.request = require("then-request");
|
|
276
|
+
var JanusVideoRoom = require("./html/janusvideoroom.js");
|
|
277
|
+
var janus = new JanusVideoRoom(
|
|
278
|
+
"http://192.168.0.15:8088/janus",
|
|
279
|
+
"http://192.168.0.15:8000",
|
|
280
|
+
);
|
|
281
|
+
janus.join(1234, "mmal service 16.1", "video");
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Connect to Jitsi
|
|
285
|
+
|
|
286
|
+
A simple way to publish WebRTC stream to a [Jitsi](https://meet.jit.si) Video
|
|
287
|
+
Room is to use the
|
|
288
|
+
[XMPPVideoRoom](http://htmlpreview.github.io/?https://github.com/mpromonet/webrtc-streamer-html/blob/master/jsdoc/XMPPVideoRoom.html)
|
|
289
|
+
interface
|
|
278
290
|
|
|
279
|
-
|
|
291
|
+
```js
|
|
292
|
+
var xmpp = new XMPPVideoRoom(<xmpp server url>, <webrtc-streamer url>)
|
|
293
|
+
```
|
|
280
294
|
|
|
281
|
-
|
|
295
|
+
A short sample to publish WebRTC streams to a Jitsi Video Room could be:
|
|
282
296
|
|
|
283
|
-
|
|
297
|
+
```html
|
|
298
|
+
<html>
|
|
299
|
+
<head>
|
|
300
|
+
<script src="libs/strophe.min.js" ></script>
|
|
301
|
+
<script src="libs/strophe.muc.min.js" ></script>
|
|
302
|
+
<script src="libs/strophe.disco.min.js" ></script>
|
|
303
|
+
<script src="libs/strophe.jingle.sdp.js"></script>
|
|
304
|
+
<script src="libs/jquery-3.5.1.min.js"></script>
|
|
305
|
+
<script src="xmppvideoroom.js" ></script>
|
|
306
|
+
<script>
|
|
307
|
+
var xmpp = new XMPPVideoRoom("meet.jit.si", null);
|
|
308
|
+
xmpp.join("testroom", "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov","Bunny");
|
|
309
|
+
</script>
|
|
310
|
+
</head>
|
|
311
|
+
</html>
|
|
312
|
+
```
|
|
284
313
|
|
|
285
|
-
|
|
314
|
+
[Live Demo](https://webrtcstreamer.agreeabletree-365b9a90.canadacentral.azurecontainerapps.io/xmppvideoroom.html)
|
|
286
315
|
|
|
287
|
-
|
|
316
|
+
## Build
|
|
288
317
|
|
|
289
|
-
|
|
318
|
+
### Dependencies
|
|
290
319
|
|
|
291
|
-
|
|
320
|
+
This package depends on the following packages:
|
|
292
321
|
|
|
293
|
-
|
|
322
|
+
- [WebRTC Native Code Package](http://www.webrtc.org) for WebRTC
|
|
323
|
+
- [civetweb HTTP server](https://github.com/civetweb/civetweb) for HTTP server
|
|
324
|
+
- [live555](http://www.live555.com/liveMedia) for RTSP/MKV source
|
|
294
325
|
|
|
326
|
+
The following steps are required to build the project, and will install the
|
|
327
|
+
dependencies above:
|
|
295
328
|
|
|
329
|
+
1. Install the Chromium depot tools
|
|
296
330
|
|
|
331
|
+
```sh
|
|
332
|
+
pushd ..
|
|
333
|
+
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
|
334
|
+
export PATH=$PATH:`realpath depot_tools`
|
|
335
|
+
popd
|
|
336
|
+
```
|
|
337
|
+
2. Download WebRTC
|
|
338
|
+
|
|
339
|
+
```sh
|
|
340
|
+
mkdir ../webrtc
|
|
341
|
+
pushd ../webrtc
|
|
342
|
+
fetch --no-history webrtc
|
|
343
|
+
popd
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
3. Build WebRTC Streamer
|
|
347
|
+
|
|
348
|
+
```sh
|
|
349
|
+
cmake . && make
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
It is possible to specify cmake parameters `WEBRTCROOT` &
|
|
353
|
+
`WEBRTCDESKTOPCAPTURE`:
|
|
354
|
+
|
|
355
|
+
- `$WEBRTCROOT/src` should contains source (default is $(pwd)/../webrtc)
|
|
356
|
+
- `WEBRTCDESKTOPCAPTURE` enabling desktop capture if available (default is ON)
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
## Pipelines
|
|
360
|
+
|
|
361
|
+
There is pipelines on [CircleCI](https://circleci.com/gh/mpromonet/webrtc-streamer),
|
|
362
|
+
[CirrusCI](https://cirrus-ci.com/github/mpromonet/webrtc-streamer), or
|
|
363
|
+
[GitHub CI](https://github.com/mpromonet/webrtc-streamer/actions), for the
|
|
364
|
+
following architectures:
|
|
365
|
+
|
|
366
|
+
- x86_64 on Ubuntu
|
|
367
|
+
- armv7 crosscompiled (this build is running on Raspberry Pi2 and NanoPi NEO)
|
|
368
|
+
- armv6+vfp crosscompiled (this build is running on Raspberry PiB and should run
|
|
369
|
+
on a Raspberry Zero)
|
|
370
|
+
- arm64 crosscompiled
|
|
371
|
+
- Windows x64 build with clang
|
|
372
|
+
- MacOS
|
package/docs/api.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# api
|
|
2
|
+
|
|
3
|
+
The WebRTC signaling is implemented through HTTP requests:
|
|
4
|
+
|
|
5
|
+
- /api/call : send offer and get answer
|
|
6
|
+
- /api/hangup : close a call
|
|
7
|
+
|
|
8
|
+
- /api/addIceCandidate : add a candidate
|
|
9
|
+
- /api/getIceCandidate : get the list of candidates
|
|
10
|
+
|
|
11
|
+
The list of HTTP API is available using /api/help.
|
package/html/admin.html
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<html>
|
|
2
2
|
<head>
|
|
3
3
|
<script src="libs/ag-grid.min.js"></script>
|
|
4
|
-
<script src="
|
|
4
|
+
<script src="webrtcconfig.js" ></script>
|
|
5
5
|
<script src="webrtcstreamer.js" ></script>
|
|
6
6
|
<style type="text/css">
|
|
7
7
|
.cell {
|
|
@@ -111,7 +111,7 @@ footer {
|
|
|
111
111
|
getPeerConnectionList();
|
|
112
112
|
window.setInterval(()=> { getPeerConnectionList(); }, 2000);
|
|
113
113
|
fetch(webrtcConfig.url + "/api/version")
|
|
114
|
-
.then( (response) => response.
|
|
114
|
+
.then( (response) => response.text() )
|
|
115
115
|
.then( (response) => onVersion( response ))
|
|
116
116
|
fetch('api/log')
|
|
117
117
|
.then( (response) => response.text() )
|