2014-12-19 13:59:08 +00:00
|
|
|
////These lines should be uncommented when require works in app.js
|
2015-01-28 14:35:22 +00:00
|
|
|
var RTCBrowserType = require("../../service/RTC/RTCBrowserType.js");
|
|
|
|
var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
|
2014-12-19 13:59:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a MediaStream object for the given data, session id and ssrc.
|
|
|
|
* It is a wrapper class for the MediaStream.
|
|
|
|
*
|
|
|
|
* @param data the data object from which we obtain the stream,
|
|
|
|
* the peerjid, etc.
|
|
|
|
* @param sid the session id
|
|
|
|
* @param ssrc the ssrc corresponding to this MediaStream
|
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
*/
|
2015-01-19 16:54:41 +00:00
|
|
|
function MediaStream(data, sid, ssrc, browser) {
|
2014-12-22 14:08:49 +00:00
|
|
|
|
|
|
|
// XXX(gp) to minimize headaches in the future, we should build our
|
|
|
|
// abstractions around tracks and not streams. ORTC is track based API.
|
|
|
|
// Mozilla expects m-lines to represent media tracks.
|
|
|
|
//
|
|
|
|
// Practically, what I'm saying is that we should have a MediaTrack class
|
|
|
|
// and not a MediaStream class.
|
|
|
|
//
|
|
|
|
// Also, we should be able to associate multiple SSRCs with a MediaTrack as
|
|
|
|
// a track might have an associated RTX and FEC sources.
|
|
|
|
|
2014-12-19 13:59:08 +00:00
|
|
|
this.sid = sid;
|
|
|
|
this.stream = data.stream;
|
|
|
|
this.peerjid = data.peerjid;
|
|
|
|
this.ssrc = ssrc;
|
|
|
|
this.type = (this.stream.getVideoTracks().length > 0)?
|
|
|
|
MediaStreamType.VIDEO_TYPE : MediaStreamType.AUDIO_TYPE;
|
2015-01-20 15:56:00 +00:00
|
|
|
this.videoType = null;
|
2014-12-19 13:59:08 +00:00
|
|
|
this.muted = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MediaStream.prototype.getOriginalStream = function()
|
|
|
|
{
|
|
|
|
return this.stream;
|
|
|
|
}
|
|
|
|
|
|
|
|
MediaStream.prototype.setMute = function (value)
|
|
|
|
{
|
|
|
|
this.stream.muted = value;
|
|
|
|
this.muted = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = MediaStream;
|