text: 'use strict';
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.default = undefined;
  
  var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
  
  var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  
  var _createClass2 = require('babel-runtime/helpers/createClass');
  
  var _createClass3 = _interopRequireDefault(_createClass2);
  
  var _constants = require('../constants');
  
  var _loggerProxy = require('../common/logs/logger-proxy');
  
  var _loggerProxy2 = _interopRequireDefault(_loggerProxy);
  
  var _util = require('./util');
  
  var _util2 = _interopRequireDefault(_util);
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  /**
   * @class MediaProperties
   */
  var MediaProperties = function () {
  
    /**
     * @param {Object} [options] -- to auto construct
     * @returns {MediaProperties}
     */
    function MediaProperties() {
      var _this = this;
  
      var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      (0, _classCallCheck3.default)(this, MediaProperties);
      this.namespace = _constants.MEETINGS;
  
      this.peerConnection = _util2.default.createPeerConnection();
      this.mediaDirection = options.mediaDirection;
      this.videoTrack = options.videoTrack;
      this.audioTrack = options.audioTrack;
      this.shareTrack = options.shareTrack;
      this.remoteShare = options.remoteShare;
      this.remoteAudioTrack = options.remoteAudioTrack;
      this.remoteVideoTrack = options.remoteVideoTrack;
      this.localQualityLevel = options.localQualityLevel || _constants.QUALITY_LEVELS.HIGH;
      this.remoteQualityLevel = options.remoteQualityLevel || _constants.QUALITY_LEVELS.HIGH;
      this.mediaSettings = {};
      this.videoDeviceId = null;
  
      // deprecated after v1.89.3, remove when feasible.
      // backwards compatible code.
      Object.defineProperty(this, 'remoteStream', {
        set: function set(stream) {
          var audio = stream.getAudioTracks();
          var video = stream.getVideoTracks();
  
          _this.remoteAudioTrack = audio.length && audio[0];
          _this.remoteVideoTrack = video.length && video[0];
        },
        get: function get() {
          _loggerProxy2.default.logger.warn('Media:properties#remoteStream --> [DEPRECATION WARNING]: remoteStream (getter) has been deprecated after v1.89.3 (use remoteAudioTrack, remoteVideoTrack instead)');
  
          // return if set or create a stream for backwards compatibility
          return _util2.default.createMediaStream([_this.remoteAudioTrack, _this.remoteVideoTrack]);
        }
      });
    }
  
    /**
     * Retrieves the preferred video input device
     * @returns {Object|null}
     */
  
  
    (0, _createClass3.default)(MediaProperties, [{
      key: 'getVideoDeviceId',
      value: function getVideoDeviceId() {
        return this.videoDeviceId || null;
      }
    }, {
      key: 'setMediaDirection',
      value: function setMediaDirection(mediaDirection) {
        this.mediaDirection = mediaDirection;
      }
    }, {
      key: 'setMediaSettings',
      value: function setMediaSettings(type, values) {
        this.mediaSettings[type] = values;
      }
    }, {
      key: 'setMediaPeerConnection',
      value: function setMediaPeerConnection(peerConnection) {
        this.peerConnection = peerConnection;
      }
    }, {
      key: 'setLocalVideoTrack',
      value: function setLocalVideoTrack(videoTrack) {
        this.videoTrack = videoTrack;
      }
    }, {
      key: 'setLocalAudioTrack',
      value: function setLocalAudioTrack(audioTrack) {
        this.audioTrack = audioTrack;
      }
    }, {
      key: 'setLocalQualityLevel',
      value: function setLocalQualityLevel(localQualityLevel) {
        this.localQualityLevel = localQualityLevel;
      }
    }, {
      key: 'setLocalShareTrack',
      value: function setLocalShareTrack(shareTrack) {
        this.shareTrack = shareTrack;
      }
    }, {
      key: 'setRemoteQualityLevel',
      value: function setRemoteQualityLevel(remoteQualityLevel) {
        this.remoteQualityLevel = remoteQualityLevel;
      }
  
      /**
       * @deprecated after v1.89.3
       * @param {remoteStream} remoteStream Sets remote media stream
       * @returns {null}
       * Use setRemoteAudioTrack, setRemoteVideoTrack
       * and setRemoteShareTrack.
       */
  
    }, {
      key: 'setRemoteStream',
      value: function setRemoteStream(remoteStream) {
        _loggerProxy2.default.logger.warn('Media:properties#setRemoteStream --> [DEPRECATION WARNING]: setRemoteStream has been deprecated after v1.89.3 (use setRemoteAudioTrack, setRemoteVideoTrack instead)');
        // calls setter
        this.remoteStream = remoteStream;
      }
    }, {
      key: 'setRemoteShare',
      value: function setRemoteShare(remoteShare) {
        this.remoteShare = remoteShare;
      }
  
      /**
       * Sets the remote audio track
       * @param {MediaTrack} remoteAudioTrack MediaTrack to save
       * @returns {void}
       */
  
    }, {
      key: 'setRemoteAudioTrack',
      value: function setRemoteAudioTrack(remoteAudioTrack) {
        this.remoteAudioTrack = remoteAudioTrack;
      }
  
      /**
       * Sets the remote video track
       * @param {MediaTrack} remoteVideoTrack MediaTrack to save
       * @returns {void}
       */
  
    }, {
      key: 'setRemoteVideoTrack',
      value: function setRemoteVideoTrack(remoteVideoTrack) {
        this.remoteVideoTrack = remoteVideoTrack;
      }
  
      /**
       * Stores the preferred video input device
       * @param {string} deviceId Preferred video input device
       * @returns {void}
       */
  
    }, {
      key: 'setVideoDeviceId',
      value: function setVideoDeviceId(deviceId) {
        this.videoDeviceId = deviceId;
      }
    }, {
      key: 'unsetPeerConnection',
      value: function unsetPeerConnection() {
        this.peerConnection = null;
      }
    }, {
      key: 'reInitiatePeerconnection',
      value: function reInitiatePeerconnection() {
        this.peerConnection = _util2.default.createPeerConnection();
      }
    }, {
      key: 'unsetLocalVideoTrack',
      value: function unsetLocalVideoTrack() {
        this.videoTrack = null;
      }
    }, {
      key: 'unsetLocalShareTrack',
      value: function unsetLocalShareTrack() {
        this.shareTrack = null;
      }
    }, {
      key: 'unsetLocalAudioTrack',
      value: function unsetLocalAudioTrack() {
        this.audioTrack = null;
      }
  
      /**
       * Removes remote stream from class instance
       * @deprecated after v1.89.3
       * @returns {void}
       */
  
    }, {
      key: 'unsetRemoteStream',
      value: function unsetRemoteStream() {
        _loggerProxy2.default.logger.warn('Media:properties#unsetRemoteStream --> [DEPRECATION WARNING]: unsetRemoteStream has been deprecated after v1.89.3 (use unsetRemoteTracks instead)');
        // unsets audio and video only
        this.unsetRemoteMedia();
      }
  
      /**
       * Removes both remote audio and video from class instance
       * @returns {void}
       */
  
    }, {
      key: 'unsetRemoteMedia',
      value: function unsetRemoteMedia() {
        this.remoteAudioTrack = null;
        this.remoteVideoTrack = null;
      }
    }, {
      key: 'unsetRemoteShare',
      value: function unsetRemoteShare() {
        this.remoteShare = null;
      }
    }, {
      key: 'unsetLocalVideoTracks',
      value: function unsetLocalVideoTracks() {
        this.unsetLocalVideoTrack();
        this.unsetLocalShareTrack();
      }
  
      /**
       * Removes remote stream and remote share from class instance
       * @deprecated after v1.89.3
       * @returns {void}
       */
  
    }, {
      key: 'unsetRemoteStreams',
      value: function unsetRemoteStreams() {
        _loggerProxy2.default.logger.warn('Media:properties#unsetRemoteStreams --> [DEPRECATION WARNING]: unsetRemoteStreams has been deprecated after v1.89.3 (use unsetRemoteTracks instead)');
        this.unsetRemoteStream();
        this.unsetRemoteShare();
      }
  
      /**
       * Unsets all remote tracks
       * @returns {void}
       */
  
    }, {
      key: 'unsetRemoteTracks',
      value: function unsetRemoteTracks() {
        this.unsetRemoteMedia();
        this.unsetRemoteShare();
      }
    }, {
      key: 'unsetShareStreams',
      value: function unsetShareStreams() {
        this.unsetLocalShareTrack();
        this.unsetRemoteShare();
      }
  
      /**
       * Removes both local and remote video stream from class instance
       * @deprecated after v1.89.3
       * @returns {void}
       */
  
    }, {
      key: 'unsetMediaStreams',
      value: function unsetMediaStreams() {
        _loggerProxy2.default.logger.warn('Media:properties#unsetMediaStreams --> [DEPRECATION WARNING]: unsetMediaStreams has been deprecated after v1.89.3 (use unsetMediaTracks instead)');
        this.unsetLocalVideoTrack();
        this.unsetRemoteStream();
      }
  
      /**
       * Removes both local and remote video stream from class instance
       * @returns {void}
       */
  
    }, {
      key: 'unsetMediaTracks',
      value: function unsetMediaTracks() {
        this.unsetLocalVideoTrack();
        this.unsetRemoteMedia();
      }
    }]);
    return MediaProperties;
  }();
  
  exports.default = MediaProperties;
  //# sourceMappingURL=properties.js.map
  