Skip to content

Commit

Permalink
Fix hasAudio and hasVideo to return always a boolean. (#1012)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcague authored Aug 21, 2017
1 parent eea593b commit 0cd22e5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
5 changes: 1 addition & 4 deletions erizo_controller/erizoClient/src/Room.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,7 @@ const Room = (altIo, altConnection, specInput) => {
limitMaxAudioBW: spec.maxAudioBW,
limitMaxVideoBW: spec.maxVideoBW,
iceServers: that.iceServers };
if (isRemote) {
connectionOpts.audio = connectionOpts.audio && connectionOpts.audio !== undefined;
connectionOpts.video = connectionOpts.video && connectionOpts.audio !== undefined;
} else {
if (!isRemote) {
connectionOpts.simulcast = options.simulcast;
}
return connectionOpts;
Expand Down
6 changes: 3 additions & 3 deletions erizo_controller/erizoClient/src/Stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ const Stream = (altConnection, specInput) => {
};

// Indicates if the stream has audio activated
that.hasAudio = () => spec.audio;
that.hasAudio = () => spec.audio !== false && spec.audio !== undefined;

// Indicates if the stream has video activated
that.hasVideo = () => spec.video;
that.hasVideo = () => spec.video !== false && spec.video !== undefined;

// Indicates if the stream has data activated
that.hasData = () => spec.data;
that.hasData = () => spec.data !== false && spec.data !== undefined;

// Indicates if the stream has screen activated
that.hasScreen = () => spec.screen;
Expand Down
17 changes: 17 additions & 0 deletions spine/NativeStream.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

const Erizo = require('./erizofc');

exports.Stream = (altConnection, specInput) => {
const spec = specInput;
spec.videoInfo = spec.video;
spec.audioInfo = spec.audio;
spec.dataInfo = spec.data;
const that = Erizo.Stream(altConnection, spec);

that.hasVideo = () => spec.videoInfo;
that.hasAudio = () => spec.audioInfo;
that.hasData = () => spec.dataInfo;

return that;
};
3 changes: 2 additions & 1 deletion spine/simpleNativeConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; // We need this for testing wit
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest,
nodeUrl = require ('url'),
Erizo = require('./erizofc'),
NativeStream = require ('./NativeStream.js'),
NativeStack = require ('./NativeStack.js');

const newIo = require('socket.io-client');
Expand Down Expand Up @@ -80,7 +81,7 @@ exports.ErizoSimpleNativeConnection = function (spec, callback, error){
subscribeToStreams(roomEvent.streams);
if (spec.publishConfig){
log.info('Will publish with config', spec.publishConfig);
localStream = Erizo.Stream(fakeConnection, spec.publishConfig);
localStream = NativeStream.Stream(fakeConnection, spec.publishConfig);
room.publish(localStream, spec.publishConfig, function(id, message){
if (id === undefined){
log.error('ERROR when publishing', message);
Expand Down

0 comments on commit 0cd22e5

Please sign in to comment.