Skip to content

Commit

Permalink
Make Simulcast API public (#861)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcague authored Apr 19, 2017
1 parent 7abd4f8 commit a07da5f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
14 changes: 13 additions & 1 deletion doc/client_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,21 @@ room.publish(localStream, {maxVideoBW:300}, function(id, error){
} else {
console.log("Published stream", id);
}
});
});
```

### Publish Simulcast Streams

You can enable Simulcast in the publisher by adding the next option:

```
room.publish(localStream, {simulcast: {numSpatialLayers: 2}});
```

Being `numSpatialLayers` the max number of spatial layers the publisher will send.

**Note:** Simulcast only works with Google Chrome and it's not compatible with Licode's recording yet.

## Subscribe to a remote stream

It subscribes to a remote stream in the room.
Expand Down
7 changes: 3 additions & 4 deletions erizo_controller/erizoClient/src/Room.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,10 @@ Erizo.Room = function (spec) {
options.minVideoBW = spec.defaultVideoBW;
}

// TODO(javier): remove dangling once Simulcast is stable
options._simulcast = options._simulcast || false;
options.simulcast = options.simulcast || options._simulcast || false;

// 1- If the stream is not local or it is a failed stream we do nothing.
if (stream && stream.local && !stream.failed &&
if (stream && stream.local && !stream.failed &&
that.localStreams[stream.getID()] === undefined) {

// 2- Publish Media Stream to Erizo-Controller
Expand Down Expand Up @@ -575,7 +574,7 @@ Erizo.Room = function (spec) {
maxVideoBW: options.maxVideoBW,
limitMaxAudioBW: spec.maxAudioBW,
limitMaxVideoBW: spec.maxVideoBW,
simulcast: options._simulcast,
simulcast: options.simulcast,
audio: stream.hasAudio(),
video: stream.hasVideo()});

Expand Down
2 changes: 1 addition & 1 deletion extras/basic_example/public/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ window.onload = function () {
room.addEventListener('room-connected', function (roomEvent) {
var options = {metadata: {type: 'publisher'}};
var enableSimulcast = getParameterByName('simulcast');
if (enableSimulcast) options._simulcast = {numSpatialLayers: 2};
if (enableSimulcast) options.simulcast = {numSpatialLayers: 2};

var onlySubscribe = getParameterByName('onlySubscribe');
if (!onlySubscribe) room.publish(localStream, options);
Expand Down

0 comments on commit a07da5f

Please sign in to comment.