You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MediaStream.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ////These lines should be uncommented when require works in app.js
  2. var RTCBrowserType = require("../../service/RTC/RTCBrowserType.js");
  3. var MediaStreamType = require("../../service/RTC/MediaStreamTypes");
  4. /**
  5. * Creates a MediaStream object for the given data, session id and ssrc.
  6. * It is a wrapper class for the MediaStream.
  7. *
  8. * @param data the data object from which we obtain the stream,
  9. * the peerjid, etc.
  10. * @param sid the session id
  11. * @param ssrc the ssrc corresponding to this MediaStream
  12. *
  13. * @constructor
  14. */
  15. function MediaStream(data, sid, ssrc, browser) {
  16. // XXX(gp) to minimize headaches in the future, we should build our
  17. // abstractions around tracks and not streams. ORTC is track based API.
  18. // Mozilla expects m-lines to represent media tracks.
  19. //
  20. // Practically, what I'm saying is that we should have a MediaTrack class
  21. // and not a MediaStream class.
  22. //
  23. // Also, we should be able to associate multiple SSRCs with a MediaTrack as
  24. // a track might have an associated RTX and FEC sources.
  25. this.sid = sid;
  26. this.stream = data.stream;
  27. this.peerjid = data.peerjid;
  28. this.ssrc = ssrc;
  29. this.type = (this.stream.getVideoTracks().length > 0)?
  30. MediaStreamType.VIDEO_TYPE : MediaStreamType.AUDIO_TYPE;
  31. this.videoType = null;
  32. this.muted = false;
  33. }
  34. MediaStream.prototype.getOriginalStream = function()
  35. {
  36. return this.stream;
  37. }
  38. MediaStream.prototype.setMute = function (value)
  39. {
  40. this.stream.muted = value;
  41. this.muted = value;
  42. }
  43. module.exports = MediaStream;