123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- var RTC = require("./RTCUtils");
-
- /**
- * Represents a single media track (either audio or video).
- * @constructor
- */
- function JitsiTrack(RTC, stream)
- {
- this.rtc = RTC;
- this.stream = stream;
- this.type = (this.stream.getVideoTracks().length > 0)?
- JitsiTrack.VIDEO : JitsiTrack.AUDIO;
- if(this.type == "audio") {
- this._getTracks = function () {
- return this.stream.getAudioTracks();
- }.bind(this);
- } else {
- this._getTracks = function () {
- return this.stream.getVideoTracks();
- }.bind(this);
- }
- }
-
- /**
- * JitsiTrack video type.
- * @type {string}
- */
- JitsiTrack.VIDEO = "video";
-
- /**
- * JitsiTrack audio type.
- * @type {string}
- */
- JitsiTrack.AUDIO = "audio";
-
- /**
- * Returns the type (audio or video) of this track.
- */
- JitsiTrack.prototype.getType = function() {
- return this.type;
- };
-
- /**
- * @returns {JitsiParticipant} to which this track belongs, or null if it is a local track.
- */
- JitsiTrack.prototype.getParitcipant = function() {
-
- };
-
- /**
- * Returns the RTCMediaStream from the browser (?).
- */
- JitsiTrack.prototype.getOriginalStream = function() {
- return this.stream;
- }
-
- /**
- * Mutes the track.
- */
- JitsiTrack.prototype.mute = function () {
- this._setMute(true);
- }
-
- /**
- * Unmutes the stream.
- */
- JitsiTrack.prototype.unmute = function () {
- this._setMute(false);
- }
-
- /**
- * Attaches the MediaStream of this track to an HTML container (?).
- * @param container the HTML container
- */
- JitsiTrack.prototype.attach = function (container) {
- RTC.attachMediaStream(container, this.stream);
- }
-
- /**
- * Removes the track from the passed HTML container.
- * @param container the HTML container
- */
- JitsiTrack.prototype.detach = function (container) {
- $(container).find(">video").remove();
- }
-
- /**
- * Stops sending the media track. And removes it from the HTML.
- * NOTE: Works for local tracks only.
- */
- JitsiTrack.prototype.stop = function () {
-
- this.detach();
- }
-
-
- /**
- * Starts sending the track.
- * NOTE: Works for local tracks only.
- */
- JitsiTrack.prototype.start = function() {
-
- }
-
- /**
- * Returns true if this is a video track and the source of the video is a
- * screen capture as opposed to a camera.
- */
- JitsiTrack.prototype.isScreenSharing = function(){
-
- }
-
- /**
- * Returns id of the track.
- * @returns {string} id of the track or null if this is fake track.
- */
- JitsiTrack.prototype.getId = function () {
- var tracks = this.stream.getTracks();
- if(!tracks || tracks.length === 0)
- return null;
- return tracks[0].id;
- };
-
- module.exports = JitsiTrack;
|