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.4KB

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