@gjsify/webrtc 0.4.43 → 0.5.0
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 +45 -0
- package/package.json +8 -8
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# @gjsify/webrtc
|
|
2
|
+
|
|
3
|
+
Full W3C WebRTC implementation for GJS backed by GStreamer's `webrtcbin`. Provides `RTCPeerConnection`, `RTCDataChannel` (string and binary), `RTCRtpSender`/`Receiver`/`Transceiver`, `MediaStream`, `MediaStreamTrack`, `getUserMedia` (PipeWire/PulseAudio/V4L2 fallback chain), `RTCDTMFSender`, `RTCCertificate`, `RTCStatsReport`, and `RTCIceCandidate`.
|
|
4
|
+
|
|
5
|
+
Part of the [gjsify](https://github.com/gjsify/gjsify) project — Node.js and Web APIs for GJS (GNOME JavaScript).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
gjsify install @gjsify/webrtc
|
|
11
|
+
|
|
12
|
+
# npm or yarn also work (e.g. adding it to an existing project):
|
|
13
|
+
npm install @gjsify/webrtc
|
|
14
|
+
yarn add @gjsify/webrtc
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { RTCPeerConnection, RTCSessionDescription, getUserMedia } from '@gjsify/webrtc';
|
|
21
|
+
|
|
22
|
+
const pc = new RTCPeerConnection({
|
|
23
|
+
iceServers: [{ urls: 'stun:stun.l.google.com:19302' }],
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Add a local media track
|
|
27
|
+
const stream = await getUserMedia({ video: true, audio: true });
|
|
28
|
+
for (const track of stream.getTracks()) {
|
|
29
|
+
pc.addTrack(track, stream);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Create and set an SDP offer
|
|
33
|
+
const offer = await pc.createOffer();
|
|
34
|
+
await pc.setLocalDescription(offer);
|
|
35
|
+
|
|
36
|
+
pc.onicecandidate = (event) => {
|
|
37
|
+
if (event.candidate) {
|
|
38
|
+
// Send event.candidate to the remote peer via your signalling channel
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/webrtc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "W3C WebRTC API for GJS using GStreamer webrtcbin as the peer-connection backend",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
"peer-connection"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@gjsify/buffer": "^0.
|
|
65
|
-
"@gjsify/dom-events": "^0.
|
|
66
|
-
"@gjsify/dom-exception": "^0.
|
|
67
|
-
"@gjsify/webrtc-native": "^0.
|
|
64
|
+
"@gjsify/buffer": "^0.5.0",
|
|
65
|
+
"@gjsify/dom-events": "^0.5.0",
|
|
66
|
+
"@gjsify/dom-exception": "^0.5.0",
|
|
67
|
+
"@gjsify/webrtc-native": "^0.5.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@girs/gjs": "4.0.4",
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
"@girs/gst-1.0": "1.28.1-4.0.4",
|
|
74
74
|
"@girs/gstsdp-1.0": "1.0.0-4.0.4",
|
|
75
75
|
"@girs/gstwebrtc-1.0": "1.0.0-4.0.4",
|
|
76
|
-
"@gjsify/cli": "^0.
|
|
77
|
-
"@gjsify/unit": "^0.
|
|
78
|
-
"@types/node": "^25.9.
|
|
76
|
+
"@gjsify/cli": "^0.5.0",
|
|
77
|
+
"@gjsify/unit": "^0.5.0",
|
|
78
|
+
"@types/node": "^25.9.2",
|
|
79
79
|
"typescript": "^6.0.3"
|
|
80
80
|
},
|
|
81
81
|
"gjsify": {
|