Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

JitsiRemoteTrack.js 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. var JitsiTrack = require("./JitsiTrack");
  2. var JitsiTrackEvents = require("../../JitsiTrackEvents");
  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) {
  13. JitsiTrack.call(this, RTC, data.stream,
  14. function () {
  15. this.eventEmitter.emit(JitsiTrackEvents.TRACK_STOPPED);
  16. }.bind(this));
  17. this.rtc = RTC;
  18. this.sid = sid;
  19. this.stream = data.stream;
  20. this.peerjid = data.peerjid;
  21. this.videoType = data.videoType;
  22. this.ssrc = ssrc;
  23. this.muted = false;
  24. if((this.type === JitsiTrack.AUDIO && data.audiomuted)
  25. || (this.type === JitsiTrack.VIDEO && data.videomuted)) {
  26. this.muted = true;
  27. }
  28. }
  29. JitsiRemoteTrack.prototype = Object.create(JitsiTrack.prototype);
  30. JitsiRemoteTrack.prototype.constructor = JitsiRemoteTrack;
  31. /**
  32. * Sets current muted status and fires an events for the change.
  33. * @param value the muted status.
  34. */
  35. JitsiRemoteTrack.prototype.setMute = function (value) {
  36. if(this.muted === value)
  37. return;
  38. this.stream.muted = value;
  39. this.muted = value;
  40. this.eventEmitter.emit(JitsiTrackEvents.TRACK_MUTE_CHANGED);
  41. };
  42. /**
  43. * Returns the current muted status of the track.
  44. * @returns {boolean|*|JitsiRemoteTrack.muted} <tt>true</tt> if the track is muted and <tt>false</tt> otherwise.
  45. */
  46. JitsiRemoteTrack.prototype.isMuted = function () {
  47. return this.muted;
  48. };
  49. /**
  50. * Returns the participant id which owns the track.
  51. * @returns {string} the id of the participants.
  52. */
  53. JitsiRemoteTrack.prototype.getParticipantId = function() {
  54. return Strophe.getResourceFromJid(this.peerjid);
  55. };
  56. /**
  57. * Return false;
  58. */
  59. JitsiRemoteTrack.prototype.isLocal = function () {
  60. return false;
  61. };
  62. delete JitsiRemoteTrack.prototype.stop;
  63. delete JitsiRemoteTrack.prototype.start;
  64. module.exports = JitsiRemoteTrack;