[webrtc-pc] Section 5.4.1: Hold Examples

aboba has just created a new issue for 
https://github.com/w3c/webrtc-pc:

== Section 5.4.1: Hold Examples ==
The hold examples in Section 5.4.1 have some potential issues: 

EXAMPLE 3
To send music to a peer and cease rendering received audio:
// Assume we have an audio transceiver and a music track named 
musicTrack
audio.sender.replaceTrack(musicTrack);
// Set the direction to send-only (requires negotiation)
audio.setDirection("sendonly");

[BA] The above example starts playing music immediately, but only 
stops rendering the received track after negotiation (e.g. before 
negotiation, audio.currentDirection is still "sendrecv").   Recommend:
 

// Assume we have an audio transceiver and a music track named 
musicTrack
audio.sender.replaceTrack(musicTrack);
// Stop rendering audio
audio.receiver.track.enabled = "false"; 
// Set the direction to send-only (requires negotiation)
audio.setDirection("sendonly");

EXAMPLE 4
To stop sending audio to a peer:
var params = audio.sender.getParameters();
params.encodings[0].active = false;
audio.sender.setParameters(params);

[BA] This might make more sense: 

To respond to a remote peer's "sendonly" offer:
// Start sending silence
audio.sender.track.enabled = "false"; 
// Set the direction to recv-only (requires negotiation)
audio.setDirection("recvonly"); 

EXAMPLE 5
To re-enable sending audio captured from a microphone as well as 
rendering of received audio:
//assume we have an audio transceiver and a microphone track named 
micTrack
audio.sender.replaceTrack(micTrack);
// Set the direction to sendrecv (requires negotiation)
audio.setDirection("sendrecv");

[BA] A better explanation of the above might be:
To remove Music On Hold. 

EXAMPLE 6
To re-enable sending audio to a peer:
var params = audio.sender.getParameters();
params.encodings[0].active = true;
audio.sender.setParameters(params);

A better example might be: 

To respond to being taken off hold
// Stop sending silence
audio.sender.track.enabled = "true"; 
// Set the direction sendrecv (requires negotiation)
audio.setDirection("sendrecv"); 





Please view or discuss this issue at 
https://github.com/w3c/webrtc-pc/issues/952 using your GitHub account

Received on Tuesday, 29 November 2016 00:31:48 UTC