node-datachannel 0.2.0 → 0.2.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/CMakeLists.txt +2 -2
- package/README.md +0 -8
- package/examples/README.md +2 -24
- package/examples/media/README.md +22 -0
- package/examples/media/media.js +6 -5
- package/package.json +2 -2
package/CMakeLists.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
cmake_minimum_required(VERSION 3.15)
|
|
2
2
|
cmake_policy(SET CMP0091 NEW)
|
|
3
|
-
project(node_datachannel VERSION 0.2.
|
|
3
|
+
project(node_datachannel VERSION 0.2.1)
|
|
4
4
|
|
|
5
5
|
include_directories(${CMAKE_JS_INC})
|
|
6
6
|
|
|
@@ -27,7 +27,7 @@ include(FetchContent)
|
|
|
27
27
|
FetchContent_Declare(
|
|
28
28
|
libdatachannel
|
|
29
29
|
GIT_REPOSITORY https://github.com/paullouisageneau/libdatachannel.git
|
|
30
|
-
GIT_TAG "v0.16.
|
|
30
|
+
GIT_TAG "v0.16.4"
|
|
31
31
|
)
|
|
32
32
|
|
|
33
33
|
option(NO_MEDIA "Disable media transport support in libdatachannel" OFF)
|
package/README.md
CHANGED
|
@@ -256,10 +256,6 @@ Send Message as binary
|
|
|
256
256
|
|
|
257
257
|
Query data-channel
|
|
258
258
|
|
|
259
|
-
**availableAmount: () => Number**
|
|
260
|
-
|
|
261
|
-
Get available data amount
|
|
262
|
-
|
|
263
259
|
**bufferedAmount: () => Number**
|
|
264
260
|
|
|
265
261
|
Get current buffered amount level
|
|
@@ -284,10 +280,6 @@ Closed callback
|
|
|
284
280
|
|
|
285
281
|
Error callback
|
|
286
282
|
|
|
287
|
-
**onAvailable: (cb: () => void) => void**
|
|
288
|
-
|
|
289
|
-
Available callback
|
|
290
|
-
|
|
291
283
|
**onBufferedAmountLow: (cb: () => void) => void**
|
|
292
284
|
|
|
293
285
|
Buffer level low callback
|
package/examples/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Examples
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# client-server
|
|
4
4
|
* You can use client-server example project to test WebRTC Data Channels with WebSocket signaling.
|
|
5
5
|
* It uses same logic of [libdatachannel/examples/client](https://github.com/paullouisageneau/libdatachannel/tree/master/examples) project.
|
|
6
6
|
* Contains an equivalent implementation for a node.js signaling server
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
## How to Use?
|
|
9
9
|
* Prepare Project
|
|
10
10
|
* cd examples/client-server
|
|
11
11
|
* npm i
|
|
@@ -19,25 +19,3 @@
|
|
|
19
19
|
* Enter answerer ID
|
|
20
20
|
|
|
21
21
|
> You can also use [libdatachannel/examples/client](https://github.com/paullouisageneau/libdatachannel/tree/master/examples) project's client & signaling server
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
## media
|
|
25
|
-
|
|
26
|
-
### Example Webcam from Browser to Port 5000
|
|
27
|
-
This is an example copy/paste demo to send your webcam from your browser and out port 5000 through the demo application.
|
|
28
|
-
|
|
29
|
-
### How to use
|
|
30
|
-
Open main.html in your browser (you must open it either as HTTPS or as a domain of http://localhost).
|
|
31
|
-
|
|
32
|
-
Start the application and copy it's offer into the text box of the web page.
|
|
33
|
-
|
|
34
|
-
Copy the answer of the webpage back into the application.
|
|
35
|
-
|
|
36
|
-
You will now see RTP traffic on `localhost:5000` of the computer that the application is running on.
|
|
37
|
-
|
|
38
|
-
Use the following gstreamer demo pipeline to display the traffic
|
|
39
|
-
(you might need to wave your hand in front of your camera to force an I-frame).
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
$ gst-launch-1.0 udpsrc address=127.0.0.1 port=5000 caps="application/x-rtp" ! queue ! rtph264depay ! video/x-h264,stream-format=byte-stream ! queue ! avdec_h264 ! queue ! autovideosink
|
|
43
|
-
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
# media
|
|
4
|
+
|
|
5
|
+
## Example Webcam from Browser to Port 5000
|
|
6
|
+
This is an example copy/paste demo to send your webcam from your browser and out port 5000 through the demo application.
|
|
7
|
+
|
|
8
|
+
## How to use
|
|
9
|
+
Open main.html in your browser (you must open it either as HTTPS or as a domain of http://localhost).
|
|
10
|
+
|
|
11
|
+
Start the application and copy it's offer into the text box of the web page.
|
|
12
|
+
|
|
13
|
+
Copy the answer of the webpage back into the application.
|
|
14
|
+
|
|
15
|
+
You will now see RTP traffic on `localhost:5000` of the computer that the application is running on.
|
|
16
|
+
|
|
17
|
+
Use the following gstreamer demo pipeline to display the traffic
|
|
18
|
+
(you might need to wave your hand in front of your camera to force an I-frame).
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
$ gst-launch-1.0 udpsrc address=127.0.0.1 port=5000 caps="application/x-rtp" ! queue ! rtph264depay ! video/x-h264,stream-format=byte-stream ! queue ! avdec_h264 ! queue ! autovideosink
|
|
22
|
+
```
|
package/examples/media/media.js
CHANGED
|
@@ -19,15 +19,16 @@ peerConnection.onStateChange((state) => {
|
|
|
19
19
|
console.log('State: ', state);
|
|
20
20
|
});
|
|
21
21
|
peerConnection.onGatheringStateChange((state) => {
|
|
22
|
-
console.log('GatheringState: ', state);
|
|
22
|
+
// console.log('GatheringState: ', state);
|
|
23
23
|
|
|
24
24
|
if(state == 'complete'){
|
|
25
25
|
let desc = peerConnection.localDescription();
|
|
26
|
-
|
|
26
|
+
console.log('');
|
|
27
|
+
console.log('## Please copy the offer below to the web page:');
|
|
27
28
|
console.log(JSON.stringify(desc));
|
|
28
29
|
console.log('\n\n');
|
|
29
|
-
console.log('Expect RTP video traffic on localhost:5000');
|
|
30
|
-
rl.question('Please copy/paste the answer provided by the browser: \n', (sdp) => {
|
|
30
|
+
console.log('## Expect RTP video traffic on localhost:5000');
|
|
31
|
+
rl.question('## Please copy/paste the answer provided by the browser: \n', (sdp) => {
|
|
31
32
|
let sdpObj = JSON.parse(sdp);
|
|
32
33
|
peerConnection.setRemoteDescription(sdpObj.sdp, sdpObj.type);
|
|
33
34
|
console.log(track.isOpen())
|
|
@@ -40,7 +41,7 @@ peerConnection.onGatheringStateChange((state) => {
|
|
|
40
41
|
let video = new nodeDataChannel.Video('video','RecvOnly');
|
|
41
42
|
video.addH264Codec(96);
|
|
42
43
|
video.setBitrate(3000);
|
|
43
|
-
|
|
44
|
+
|
|
44
45
|
let track = peerConnection.addTrack(video);
|
|
45
46
|
let session = new nodeDataChannel.RtcpReceivingSession();
|
|
46
47
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-datachannel",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "libdatachannel node bindings",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"url": "https://github.com/paullouisageneau"
|
|
40
40
|
}
|
|
41
41
|
],
|
|
42
|
-
"license": "
|
|
42
|
+
"license": "LGPL",
|
|
43
43
|
"gypfile": true,
|
|
44
44
|
"bugs": {
|
|
45
45
|
"url": "https://github.com/murat-dogan/node-datachannel/issues"
|