Skip to content

Commit

Permalink
Refactor WebRTC example and update werift version to 0.21.12
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyoshiaki committed Jan 26, 2025
1 parent fae307e commit 4894934
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions examples/ring/recv-via-webrtc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ import { CustomPeerConnection } from "./peer";

const example = async () => {
const ringApi = new RingApi({
// Replace with your refresh token
refreshToken: process.env.RING_REFRESH_TOKEN!,
debug: true,
}),
cameras = await ringApi.getCameras(),
camera = cameras[0];
// Replace with your refresh token
refreshToken: process.env.RING_REFRESH_TOKEN!,
debug: true,
});
const cameras = await ringApi.getCameras();
const camera = cameras[0];

if (!camera) {
console.log("No cameras found");
return;
}

const track = new MediaStreamTrack({ kind: "video" });
const receiver = new CustomPeerConnection() as any;
receiver.onVideoRtp.subscribe((rtp) => {
const ring = new CustomPeerConnection();
ring.onVideoRtp.subscribe((rtp) => {
track.writeRtp(rtp);
});
await camera.startLiveCall({
createPeerConnection: () => receiver,
createPeerConnection: () => ring,
});
const server = new Server({ port: 8888 });

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/webrtc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "werift",
"version": "0.21.11",
"version": "0.21.12",
"description": "WebRTC Implementation for TypeScript (Node.js)",
"keywords": [
"WebRTC",
Expand Down
2 changes: 1 addition & 1 deletion packages/webrtc/src/nonstandard/recorder/writer/webm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export class WebmFactory extends MediaWriter {
await Promise.all(this.rtpSources.map((r) => r.stop()));

if (!this.ended) {
await this.onEol.asPromise(5000);
await this.onEol.asPromise(5000).catch((e) => e);
}
this.unSubscribers.dispose();
}
Expand Down

0 comments on commit 4894934

Please sign in to comment.