Skip to content

Commit

Permalink
fix: few api tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
tarrencev committed Oct 13, 2020
1 parent da42ebd commit 425671a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class LocalStream extends MediaStream {
return stream.getTracks()[0];
}

publishTrack(track: MediaStreamTrack) {
private publishTrack(track: MediaStreamTrack) {
if (this.pc) {
if (track.kind === 'video' && this.constraints.simulcast) {
const encodings: RTCRtpEncodingParameters[] = [
Expand Down Expand Up @@ -222,6 +222,12 @@ export class LocalStream extends MediaStream {
this.publishTrack(track);
}
}

close() {
if (this.pc) {
this.pc.getSenders().forEach(async (sender: RTCRtpSender) => this.pc!.removeTrack(sender));
}
}
}

export interface RemoteStream extends MediaStream {
Expand All @@ -238,8 +244,8 @@ export interface RemoteStream extends MediaStream {
export function makeRemote(stream: MediaStream, api: RTCDataChannel): RemoteStream {
const remote = stream as RemoteStream;
remote.audio = true;
remote.video = 'high';
remote._videoPreMute = 'none';
remote.video = 'none';
remote._videoPreMute = 'high';

const select = () => {
const call = {
Expand Down

0 comments on commit 425671a

Please sign in to comment.