Skip to content

Commit

Permalink
Desktop: Add onEnded to capture options
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny-signal authored Oct 7, 2024
1 parent 862c7bf commit 5a9b445
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/node/ringrtc/VideoSupport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class GumVideoCaptureOptions {
preferredDeviceId?: string;
screenShareSourceId?: string;
mediaStream?: MediaStream;
onEnded?: () => void;
}

interface GumConstraints extends MediaStreamConstraints {
Expand Down Expand Up @@ -343,6 +344,8 @@ export class GumVideoCapturer {
return;
}

const captureOptions = this.captureOptions;

if (track.readyState === 'ended') {
this.stopCapturing();
RingRTC.logError(
Expand Down Expand Up @@ -403,6 +406,7 @@ export class GumVideoCapturer {
RingRTC.logError(`spawnSender(): ${e}`);
} finally {
reader.releaseLock();
captureOptions?.onEnded?.();
}
this.spawnedSenderRunning = false;
})();
Expand Down

0 comments on commit 5a9b445

Please sign in to comment.