modified lib-jitsi-meet dev repo
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

JitsiRemoteTrack.js 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. var JitsiTrack = require("./JitsiTrack");
  2. var StreamEventTypes = require("../../service/RTC/StreamEventTypes");
  3. /**
  4. * Represents a single media track (either audio or video).
  5. * @param RTC the rtc instance.
  6. * @param data object with the stream and some details about it(participant id, video type, etc.)
  7. * @param sid sid for the Media Stream
  8. * @param ssrc ssrc for the Media Stream
  9. * @param eventEmitter the event emitter
  10. * @constructor
  11. */
  12. function JitsiRemoteTrack(RTC, data, sid, ssrc, eventEmitter) {
  13. JitsiTrack.call(this, RTC, data.stream);
  14. this.rtc = RTC;
  15. this.sid = sid;
  16. this.stream = data.stream;
  17. this.peerjid = data.peerjid;
  18. this.videoType = data.videoType;
  19. this.ssrc = ssrc;
  20. this.muted = false;
  21. this.eventEmitter = eventEmitter;
  22. var self = this;
  23. if(this.stream)
  24. this.stream.onended = function () {
  25. eventEmitter.emit(StreamEventTypes.EVENT_TYPE_REMOTE_ENDED, self);
  26. }
  27. }
  28. JitsiRemoteTrack.prototype = Object.create(JitsiTrack.prototype);
  29. JitsiRemoteTrack.prototype.constructor = JitsiRemoteTrack;
  30. /**
  31. * Sets current muted status and fires an events for the change.
  32. * @param value the muted status.
  33. */
  34. JitsiRemoteTrack.prototype.setMute = function (value) {
  35. this.stream.muted = value;
  36. this.muted = value;
  37. this.eventEmitter.emit(StreamEventTypes.TRACK_MUTE_CHANGED, this);
  38. };
  39. /**
  40. * Returns the current muted status of the track.
  41. * @returns {boolean|*|JitsiRemoteTrack.muted} <tt>true</tt> if the track is muted and <tt>false</tt> otherwise.
  42. */
  43. JitsiRemoteTrack.prototype.isMuted = function () {
  44. return this.muted;
  45. }
  46. /**
  47. * Returns the participant id which owns the track.
  48. * @returns {string} the id of the participants.
  49. */
  50. JitsiRemoteTrack.prototype.getParitcipantId = function() {
  51. return Strophe.getResourceFromJid(this.peerjid);
  52. };
  53. delete JitsiRemoteTrack.prototype.stop;
  54. delete JitsiRemoteTrack.prototype.start;
  55. module.exports = JitsiRemoteTrack;