2014-08-22 15:37:11 +00:00
|
|
|
/**
|
|
|
|
* Provides a wrapper class for the MediaStream.
|
|
|
|
*
|
|
|
|
* TODO : Add here the src from the video element and other related properties
|
|
|
|
* and get rid of some of the mappings that we use throughout the UI.
|
|
|
|
*/
|
|
|
|
var MediaStream = (function() {
|
|
|
|
/**
|
|
|
|
* Creates a MediaStream object for the given data, session id and ssrc.
|
|
|
|
*
|
|
|
|
* @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
|
|
|
|
*/
|
|
|
|
function MediaStreamProto(data, sid, ssrc) {
|
|
|
|
this.stream = data.stream;
|
|
|
|
this.peerjid = data.peerjid;
|
|
|
|
this.ssrc = ssrc;
|
|
|
|
this.session = connection.jingle.sessions[sid];
|
|
|
|
this.type = (this.stream.getVideoTracks().length > 0)
|
2014-10-31 11:47:12 +00:00
|
|
|
? MediaStream.VIDEO_TYPE : MediaStream.AUDIO_TYPE;
|
|
|
|
this.muted = false;
|
2014-08-22 15:37:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return MediaStreamProto;
|
2014-10-31 11:47:12 +00:00
|
|
|
})();
|
|
|
|
|
|
|
|
MediaStream.VIDEO_TYPE = 'Video';
|
|
|
|
MediaStream.AUDIO_TYPE = 'Audio';
|