Skip to content

Commit

Permalink
Clarify example on example with media before signaling
Browse files Browse the repository at this point in the history
As per discussion in #1708:
* Change the title to 'with incoming media before signaling'
* Change the intro to add 'This code shows the receiving side'
* Remove the 'selfView' code

close #1708
  • Loading branch information
dontcallmedom committed Aug 12, 2019
1 parent f665b4d commit 9241779
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions webrtc.html
Expand Up @@ -11810,11 +11810,11 @@ <h3>Advanced Peer-to-peer Example with Warm-up</h3>
</div>
</section>
<section>
<h3>Peer-to-peer Example with media before signaling</h3>
<h3>Peer-to-peer Example with incoming media before signaling</h3>
<div>
<p>The answerer may wish to send media in parallel with sending the
answer, and the offerer may wish to render the media before the answer
arrives.</p>
arrives. This code shows the receiving side.</p>
<pre class="example highlight">
const signaling = new SignalingChannel();
const configuration = {iceServers: [{urls: 'stuns:stun.example.org'}]};
Expand All @@ -11839,16 +11839,6 @@ <h3>Peer-to-peer Example with media before signaling</h3>
console.error(err);
}
};

try {
// get a local stream, show it in a self-view and add it to be sent
const stream = await navigator.mediaDevices.getUserMedia({audio: true, video: true});
selfView.srcObject = stream;
// Render the media even before ontrack fires.
remoteView.srcObject = new MediaStream(pc.getReceivers().map((r) =&gt; r.track));
} catch (err) {
console.error(err);
}
};

signaling.onmessage = async (event) =&gt; {
Expand Down

0 comments on commit 9241779

Please sign in to comment.