appendBuffer(segment) {
    // Start the internal "updating" state
    this.bufferUpdating_ = true;

    if (this.audioBuffer_ && this.audioBuffer_.buffered.length) {
      let audioBuffered = this.audioBuffer_.buffered;

      this.transmuxer_.postMessage({
        action: 'setAudioAppendStart',
        appendStart: audioBuffered.end(audioBuffered.length - 1)
      });
    }

    if (this.videoBuffer_) {
      this.transmuxer_.postMessage({
        action: 'alignGopsWith',
        gopsToAlignWith: gopsSafeToAlignWith(this.gopBuffer_,
                                             this.mediaSource_.player_,
                                             this.timeMapping_)
      });
    }

    this.transmuxer_.postMessage({
      action: 'push',
      // Send the typed-array of data as an ArrayBuffer so that
      // it can be sent as a "Transferable" and avoid the costly
      // memory copy
      data: segment.buffer,

      // To recreate the original typed-array, we need information
      // about what portion of the ArrayBuffer it was a view into
      byteOffset: segment.byteOffset,
      byteLength: segment.byteLength
    },
    [segment.buffer]);
    this.transmuxer_.postMessage({action: 'flush'});
  }
/**
   * Emulate the native mediasource function, but our function will
   * send all of the proposed segments to the transmuxer so that we
   * can transmux them before we append them to our internal
   * native source buffers in the correct format.
   *
   * @link https://developer.mozilla.org/en-US/docs/Web/API/SourceBuffer/appendBuffer
   * @param {Uint8Array} segment the segment to append to the buffer
   */
Emulate the native mediasource function, but our function will
send all of the proposed segments to the transmuxer so that we
can transmux them before we append them to our internal
native source buffers in the correct format.


Emulate the native mediasource function but our function will send all of the proposed segments to the transmuxer so that we can transmux them before we append them to our internal native source buffers in the correct format .
appendBuffer(segment) {
    this.bufferUpdating_ = true;
    if (this.audioBuffer_ && this.audioBuffer_.buffered.length) {
      let audioBuffered = this.audioBuffer_.buffered;
      this.transmuxer_.postMessage({
        action: 'setAudioAppendStart',
        appendStart: audioBuffered.end(audioBuffered.length - 1)
      });
    }
    if (this.videoBuffer_) {
      this.transmuxer_.postMessage({
        action: 'alignGopsWith',
        gopsToAlignWith: gopsSafeToAlignWith(this.gopBuffer_,
                                             this.mediaSource_.player_,
                                             this.timeMapping_)
      });
    }
    this.transmuxer_.postMessage({
      action: 'push',
      data: segment.buffer,
      byteOffset: segment.byteOffset,
      byteLength: segment.byteLength
    },
    [segment.buffer]);
    this.transmuxer_.postMessage({action: 'flush'});
  }
appendBuffer ( segment ) { this . bufferUpdating_ = true ; if ( this . audioBuffer_ && this . audioBuffer_ . buffered . length ) { let audioBuffered = this . audioBuffer_ . buffered ; this . transmuxer_ . postMessage ( { action : 'setAudioAppendStart' , appendStart : audioBuffered . end ( audioBuffered . length - 1 ) } ) ; } if ( this . videoBuffer_ ) { this . transmuxer_ . postMessage ( { action : 'alignGopsWith' , gopsToAlignWith : gopsSafeToAlignWith ( this . gopBuffer_ , this . mediaSource_ . player_ , this . timeMapping_ ) } ) ; } this . transmuxer_ . postMessage ( { action : 'push' , data : segment . buffer , byteOffset : segment . byteOffset , byteLength : segment . byteLength } , [ segment . buffer ] ) ; this . transmuxer_ . postMessage ( { action : 'flush' } ) ; }
Emulate the native mediasource function, but our function will
 send all of the proposed segments to the transmuxer so that we
 can transmux them before we append them to our internal
 native source buffers in the correct format.
Emulate the native mediasource function but our function will send all of the proposed segments to the transmuxer so that we can transmux them before we append them to our internal native source buffers in the correct format .
// Start the internal "updating" state // Send the typed-array of data as an ArrayBuffer so that // it can be sent as a "Transferable" and avoid the costly // memory copy // To recreate the original typed-array, we need information // about what portion of the ArrayBuffer it was a view into