jiti-meet/media_stream.js

30 lines
990 B
JavaScript

/**
* 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.VIDEO_TYPE = "Video";
this.AUDIO_TYPE = "Audio";
this.stream = data.stream;
this.peerjid = data.peerjid;
this.ssrc = ssrc;
this.session = connection.jingle.sessions[sid];
this.type = (this.stream.getVideoTracks().length > 0)
? this.VIDEO_TYPE : this.AUDIO_TYPE;
}
return MediaStreamProto;
})();