Skip to content

Commit 3afa413

Browse files
authored
Merge pull request #8 from fippo/simplify-receiver
use trackevent.receiver instead of searching for it
2 parents beda867 + 2e13acf commit 3afa413

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

explainer.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,6 @@ senderStreams.readable
124124
<pre>
125125
let pc = new RTCPeerConnection({forceEncodedVideoInsertableStreams: true});
126126
pc.ontrack = e => {
127-
let receivers = pc.getReceivers();
128-
let videoReceiver = null;
129-
for (const r of receivers) {
130-
if (r.track.kind == 'video')
131-
videoReceiver = r;
132-
}
133-
if (!videoReceiver)
134-
return;
135-
136127
let receiverTransform = new TransformStream({
137128
start() {},
138129
flush() {},
@@ -154,7 +145,7 @@ pc.ontrack = e => {
154145
},
155146
});
156147

157-
let receiverStreams = videoReceiver.createEncodedVideoStreams();
148+
let receiverStreams = e.receiver.createEncodedVideoStreams();
158149
receiverStreams.readable
159150
.pipeThrough(receiverTransform)
160151
.pipeTo(receiverStreams.writable);

0 commit comments

Comments
 (0)