createRealSourceBuffers_() {
    let types = ['audio', 'video'];

    types.forEach((type) => {
      // Don't create a SourceBuffer of this type if we don't have a
      // codec for it
      if (!this[`${type}Codec_`]) {
        return;
      }

      // Do nothing if a SourceBuffer of this type already exists
      if (this[`${type}Buffer_`]) {
        return;
      }

      let buffer = null;

      // If the mediasource already has a SourceBuffer for the codec
      // use that
      if (this.mediaSource_[`${type}Buffer_`]) {
        buffer = this.mediaSource_[`${type}Buffer_`];
        // In multiple audio track cases, the audio source buffer is disabled
        // on the main VirtualSourceBuffer by the HTMLMediaSource much earlier
        // than createRealSourceBuffers_ is called to create the second
        // VirtualSourceBuffer because that happens as a side-effect of
        // videojs-contrib-hls starting the audioSegmentLoader. As a result,
        // the audioBuffer is essentially "ownerless" and no one will toggle
        // the `updating` state back to false once the `updateend` event is received
        //
        // Setting `updating` to false manually will work around this
        // situation and allow work to continue
        buffer.updating = false;
      } else {
        const codecProperty = `${type}Codec_`;
        const mimeType = `${type}/mp4;codecs="${this[codecProperty]}"`;

        buffer = makeWrappedSourceBuffer(this.mediaSource_.nativeMediaSource_, mimeType);

        this.mediaSource_[`${type}Buffer_`] = buffer;
      }

      this[`${type}Buffer_`] = buffer;

      // Wire up the events to the SourceBuffer
      ['update', 'updatestart', 'updateend'].forEach((event) => {
        buffer.addEventListener(event, () => {
          // if audio is disabled
          if (type === 'audio' && this.audioDisabled_) {
            return;
          }

          if (event === 'updateend') {
            this[`${type}Buffer_`].updating = false;
          }

          let shouldTrigger = types.every((t) => {
            // skip checking audio's updating status if audio
            // is not enabled
            if (t === 'audio' && this.audioDisabled_) {
              return true;
            }
            // if the other type if updating we don't trigger
            if (type !== t &&
                this[`${t}Buffer_`] &&
                this[`${t}Buffer_`].updating) {
              return false;
            }
            return true;
          });

          if (shouldTrigger) {
            return this.trigger(event);
          }
        });
      });
    });
  }
/**
   * Create our internal native audio/video source buffers and add
   * event handlers to them with the following conditions:
   * 1. they do not already exist on the mediaSource
   * 2. this VSB has a codec for them
   *
   * @private
   */
Create our internal native audio/video source buffers and add
event handlers to them with the following conditions:
1. they do not already exist on the mediaSource
2. this VSB has a codec for them

@private
Create our internal native audio / video source buffers and add event handlers to them with the following conditions : 1 . they do not already exist on the mediaSource 2 . this VSB has a codec for them @private
createRealSourceBuffers_() {
    let types = ['audio', 'video'];
    types.forEach((type) => {
      if (!this[`${type}Codec_`]) {
        return;
      }
      if (this[`${type}Buffer_`]) {
        return;
      }
      let buffer = null;
      if (this.mediaSource_[`${type}Buffer_`]) {
        buffer = this.mediaSource_[`${type}Buffer_`];
         Setting `updating` to false manually will work around this
         situation and allow work to continue
        buffer.updating = false;
      } else {
        const codecProperty = `${type}Codec_`;
        const mimeType = `${type}/mp4;codecs="${this[codecProperty]}"`;
        buffer = makeWrappedSourceBuffer(this.mediaSource_.nativeMediaSource_, mimeType);
        this.mediaSource_[`${type}Buffer_`] = buffer;
      }
      this[`${type}Buffer_`] = buffer;
       Wire up the events to the SourceBuffer
      ['update', 'updatestart', 'updateend'].forEach((event) => {
        buffer.addEventListener(event, () => {
           if audio is disabled
          if (type === 'audio' && this.audioDisabled_) {
            return;
          }
          if (event === 'updateend') {
            this[`${type}Buffer_`].updating = false;
          }
          let shouldTrigger = types.every((t) => {
             skip checking audio's updating status if audio
             is not enabled
            if (t === 'audio' && this.audioDisabled_) {
              return true;
            }
             if the other type if updating we don't trigger
            if (type !== t &&
                this[`${t}Buffer_`] &&
                this[`${t}Buffer_`].updating) {
              return false;
            }
            return true;
          });
          if (shouldTrigger) {
            return this.trigger(event);
          }
        });
      });
    });
  }
createRealSourceBuffers_ ( ) { let types = [ 'audio' , 'video' ] ; types . forEach ( ( type ) => { if ( ! this [ ` ${ type } ` ] ) { return ; } if ( this [ ` ${ type } ` ] ) { return ; } let buffer = null ; if ( this . mediaSource_ [ ` ${ type } ` ] ) { buffer = this . mediaSource_ [ ` ${ type } ` ] ; buffer . updating = false ; } else { const codecProperty = ` ${ type } ` ; const mimeType = ` ${ type } ${ this [ codecProperty ] } ` ; buffer = makeWrappedSourceBuffer ( this . mediaSource_ . nativeMediaSource_ , mimeType ) ; this . mediaSource_ [ ` ${ type } ` ] = buffer ; } this [ ` ${ type } ` ] = buffer ; [ 'update' , 'updatestart' , 'updateend' ] . forEach ( ( event ) => { buffer . addEventListener ( event , ( ) => { if ( type === 'audio' && this . audioDisabled_ ) { return ; } if ( event === 'updateend' ) { this [ ` ${ type } ` ] . updating = false ; } let shouldTrigger = types . every ( ( t ) => { if ( t === 'audio' && this . audioDisabled_ ) { return true ; } if ( type !== t && this [ ` ${ t } ` ] && this [ ` ${ t } ` ] . updating ) { return false ; } return true ; } ) ; if ( shouldTrigger ) { return this . trigger ( event ) ; } } ) ; } ) ; } ) ; }
Create our internal native audio/video source buffers and add
 event handlers to them with the following conditions:
 1. they do not already exist on the mediaSource
 2. this VSB has a codec for them
Create our internal native audio / video source buffers and add event handlers to them with the following conditions : 1 . they do not already exist on the mediaSource 2 . this VSB has a codec for them
// Don't create a SourceBuffer of this type if we don't have a // codec for it // Do nothing if a SourceBuffer of this type already exists // If the mediasource already has a SourceBuffer for the codec // use that // In multiple audio track cases, the audio source buffer is disabled // on the main VirtualSourceBuffer by the HTMLMediaSource much earlier // than createRealSourceBuffers_ is called to create the second // VirtualSourceBuffer because that happens as a side-effect of // videojs-contrib-hls starting the audioSegmentLoader. As a result, // the audioBuffer is essentially "ownerless" and no one will toggle // the `updating` state back to false once the `updateend` event is received // // Setting `updating` to false manually will work around this // situation and allow work to continue // Wire up the events to the SourceBuffer // if audio is disabled // skip checking audio's updating status if audio // is not enabled // if the other type if updating we don't trigger