function CMCDController(hls) {
    var _this = this;

    this.hls = void 0;
    this.config = void 0;
    this.media = void 0;
    this.sid = void 0;
    this.cid = void 0;
    this.useHeaders = false;
    this.initialized = false;
    this.starved = false;
    this.buffering = true;
    this.audioBuffer = void 0;
    this.videoBuffer = void 0;

    this.onWaiting = function () {
      if (_this.initialized) {
        _this.starved = true;
      }

      _this.buffering = true;
    };

    this.onPlaying = function () {
      if (!_this.initialized) {
        _this.initialized = true;
      }

      _this.buffering = false;
    };

    this.applyPlaylistData = function (context) {
      try {
        _this.apply(context, {
          ot: _types_cmcd__WEBPACK_IMPORTED_MODULE_1__["CMCDObjectType"].MANIFEST,
          su: !_this.initialized
        });
      } catch (error) {
        _utils_logger__WEBPACK_IMPORTED_MODULE_3__["logger"].warn('Could not generate manifest CMCD data.', error);
      }
    };

    this.applyFragmentData = function (context) {
      try {
        var fragment = context.frag;
        var level = _this.hls.levels[fragment.level];

        var ot = _this.getObjectType(fragment);

        var data = {
          d: fragment.duration * 1000,
          ot: ot
        };

        if (ot === _types_cmcd__WEBPACK_IMPORTED_MODULE_1__["CMCDObjectType"].VIDEO || ot === _types_cmcd__WEBPACK_IMPORTED_MODULE_1__["CMCDObjectType"].AUDIO || ot == _types_cmcd__WEBPACK_IMPORTED_MODULE_1__["CMCDObjectType"].MUXED) {
          data.br = level.bitrate / 1000;
          data.tb = _this.getTopBandwidth(ot);
          data.bl = _this.getBufferLength(ot);
        }

        _this.apply(context, data);
      } catch (error) {
        _utils_logger__WEBPACK_IMPORTED_MODULE_3__["logger"].warn('Could not generate segment CMCD data.', error);
      }
    };

    this.hls = hls;
    var config = this.config = hls.config;
    var cmcd = config.cmcd;

    if (cmcd != null) {
      config.pLoader = this.createPlaylistLoader();
      config.fLoader = this.createFragmentLoader();
      this.sid = cmcd.sessionId || CMCDController.uuid();
      this.cid = cmcd.contentId;
      this.useHeaders = cmcd.useHeaders === true;
      this.registerListeners();
    }
  }
Controller to deal with Common Media Client Data (CMCD)
@see https://cdn.cta.tech/cta/media/media/resources/standards/pdfs/cta-5004-final.pdf