Moves require to top for the RTC module.

This commit is contained in:
hristoterezov 2014-12-22 11:03:21 +02:00
parent a1da42ff00
commit ec5e0f09ea
3 changed files with 30 additions and 29 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,3 @@
var RTC = require("./RTC.js");
////These lines should be uncommented when require works in app.js
//var RTCBrowserType = require("../../service/RTC/RTCBrowserType.js");
//var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");
@ -15,7 +14,7 @@ var RTC = require("./RTC.js");
*
* @constructor
*/
function MediaStream(data, sid, ssrc, eventEmmiter) {
function MediaStream(data, sid, ssrc, eventEmmiter, browser) {
this.sid = sid;
this.stream = data.stream;
this.peerjid = data.peerjid;
@ -24,15 +23,15 @@ function MediaStream(data, sid, ssrc, eventEmmiter) {
MediaStreamType.VIDEO_TYPE : MediaStreamType.AUDIO_TYPE;
this.muted = false;
eventEmmiter.emit(StreamEventTypes.EVENT_TYPE_REMOTE_CREATED, this);
if(browser == RTCBrowserType.RTC_BROWSER_FIREFOX)
{
if (!this.getVideoTracks)
this.getVideoTracks = function () { return []; };
if (!this.getAudioTracks)
this.getAudioTracks = function () { return []; };
}
}
if(RTC.getBrowserType() == RTCBrowserType.RTC_BROWSER_FIREFOX)
{
if (!MediaStream.prototype.getVideoTracks)
MediaStream.prototype.getVideoTracks = function () { return []; };
if (!MediaStream.prototype.getAudioTracks)
MediaStream.prototype.getAudioTracks = function () { return []; };
}
MediaStream.prototype.getOriginalStream = function()
{

View File

@ -1,5 +1,8 @@
var EventEmitter = require("events");
var RTCUtils = require("./RTCUtils.js");
var LocalStream = require("./LocalStream.js");
var DataChannels = require("./DataChannels");
var MediaStream = require("./MediaStream.js");
//These lines should be uncommented when require works in app.js
//var StreamEventTypes = require("../../service/RTC/StreamEventTypes.js");
//var XMPPEvents = require("../service/xmpp/XMPPEvents");
@ -22,7 +25,7 @@ var RTC = {
eventEmitter.removeListener(eventType, listener);
},
createLocalStream: function (stream, type) {
var LocalStream = require("./LocalStream.js");
var localStream = new LocalStream(stream, type, eventEmitter);
this.localStreams.push(localStream);
if(type == "audio")
@ -47,8 +50,8 @@ var RTC = {
}
},
createRemoteStream: function (data, sid, thessrc) {
var MediaStream = require("./MediaStream.js")
var remoteStream = new MediaStream(data, sid, thessrc, eventEmitter);
var remoteStream = new MediaStream(data, sid, thessrc, eventEmitter,
this.getBrowserType());
var jid = data.peerjid || connection.emuc.myroomjid;
if(!this.remoteStreams[jid]) {
this.remoteStreams[jid] = {};
@ -94,7 +97,6 @@ var RTC = {
this.rtcUtils.obtainAudioAndVideoPermissions();
},
onConferenceCreated: function(event) {
var DataChannels = require("./DataChannels");
DataChannels.bindDataChannelListener(event.peerconnection);
},
muteRemoteVideoStream: function (jid, value) {