@marianmeres/webrtc 1.2.1 → 1.2.3
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 +4 -2
- package/dist/webrtc-manager.js +11 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -461,7 +461,7 @@ deno task test
|
|
|
461
461
|
|
|
462
462
|
### Interactive Example
|
|
463
463
|
|
|
464
|
-
The `example/` directory contains a working demo of two peers communicating via WebRTC data channels:
|
|
464
|
+
The `example/` directory contains a working demo of two peers communicating via WebRTC data channels and audio streams:
|
|
465
465
|
|
|
466
466
|
```bash
|
|
467
467
|
# Build the example bundle
|
|
@@ -477,12 +477,14 @@ Then open `http://localhost:8000/` in your browser.
|
|
|
477
477
|
- `index.html` - Parent page with two side-by-side iframes, acts as signaling relay via `postMessage`
|
|
478
478
|
- `peer1.html` - The "offerer" peer (click "Connect" to initiate)
|
|
479
479
|
- `peer2.html` - The "answerer" peer (waits for connection)
|
|
480
|
+
- `peer.js` - Shared utilities (factory, beep generation, logging)
|
|
480
481
|
|
|
481
482
|
This example demonstrates:
|
|
482
483
|
- P2P connection establishment without a signaling server (uses `postMessage` between iframes)
|
|
483
|
-
- SDP offer/answer exchange
|
|
484
|
+
- SDP offer/answer exchange with bidirectional audio setup
|
|
484
485
|
- ICE candidate exchange
|
|
485
486
|
- Data channel creation and message passing
|
|
487
|
+
- **Audio streaming via WebRTC media tracks** (click "Send Beep" to transmit generated audio)
|
|
486
488
|
- State change monitoring
|
|
487
489
|
|
|
488
490
|
## License
|
package/dist/webrtc-manager.js
CHANGED
|
@@ -527,6 +527,7 @@ export class WebRtcManager {
|
|
|
527
527
|
return false;
|
|
528
528
|
}
|
|
529
529
|
try {
|
|
530
|
+
// deno-lint-ignore no-explicit-any
|
|
530
531
|
channel.send(data);
|
|
531
532
|
return true;
|
|
532
533
|
}
|
|
@@ -711,6 +712,16 @@ export class WebRtcManager {
|
|
|
711
712
|
}
|
|
712
713
|
}
|
|
713
714
|
// deno-lint-ignore no-explicit-any
|
|
715
|
+
#log(...args) {
|
|
716
|
+
if (this.#config.debug) {
|
|
717
|
+
this.#logger.log("[WebRtcManager]", ...args);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
// deno-lint-ignore no-explicit-any
|
|
721
|
+
#warn(...args) {
|
|
722
|
+
this.#logger.warn("[WebRtcManager]", ...args);
|
|
723
|
+
}
|
|
724
|
+
// deno-lint-ignore no-explicit-any
|
|
714
725
|
#error(error) {
|
|
715
726
|
this.#logger.error("[WebRtcManager]", error);
|
|
716
727
|
this.#dispatch(WebRtcFsmEvent.ERROR);
|