# Class: SourceUpdater

## SourceUpdater

#### new SourceUpdater(mediaSource, mimeType)

A queue of callbacks to be serialized and applied when a MediaSource and its associated SourceBuffers are not in the updating state. It is used by the segment loader to update the underlying SourceBuffers when new data is loaded, for instance.

##### Parameters:

Name | Type | Description
--- | --- | ---
`mediaSource` | MediaSource | the MediaSource to create the SourceBuffer from
`mimeType` | String | the desired MIME type of the underlying SourceBuffer

Source:
  - source-updater.js, line 6

### Methods

#### abort(done)

Aborts the current segment and resets the segment parser.

##### Parameters:

Name | Type | Description
--- | --- | ---
`done` | function | function to call when done

Source:
  - source-updater.js, line 60
See:
  - http://w3c.github.io/media-source/#widl-SourceBuffer-abort-void

#### appendBuffer(bytes, done)

Queue an update to append an ArrayBuffer.

##### Parameters:

Name | Type | Description
--- | --- | ---
`bytes` | ArrayBuffer |
`done` | function | the function to call when done

Source:
  - source-updater.js, line 73
See:
  - http://www.w3.org/TR/media-source/#widl-SourceBuffer-appendBuffer-void-ArrayBuffer-data

#### buffered()

Indicates what TimeRanges are buffered in the managed SourceBuffer.

Source:
  - source-updater.js, line 84
See:
  - http://www.w3.org/TR/media-source/#widl-SourceBuffer-buffered

#### dispose()

dispose of the source updater and the underlying sourceBuffer

Source:
  - source-updater.js, line 166

#### duration(duration)

Queue an update to set the duration.

##### Parameters:

Name | Type | Description
--- | --- | ---
`duration` | Double | what to set the duration to

Source:
  - source-updater.js, line 97
See:
  - http://www.w3.org/TR/media-source/#widl-MediaSource-duration

#### queueCallback_()

que a callback to run

Source:
  - source-updater.js, line 143

#### remove(start, end)

Queue an update to remove a time range from the buffer.

##### Parameters:

Name | Type | Description
--- | --- | ---
`start` | Number | where to start the removal
`end` | Number | where to end the removal

Source:
  - source-updater.js, line 110
See:
  - http://www.w3.org/TR/media-source/#widl-SourceBuffer-remove-void-double-start-unrestricted-double-end

#### runCallback_()

run a queued callback

Source:
  - source-updater.js, line 151

#### timestampOffset() → {Number}

Set/get the timestampoffset on the SourceBuffer

Source:
  - source-updater.js, line 130

##### Returns:

the timestamp offset

Type
  Number

#### updating() → {Boolean}

wether the underlying sourceBuffer is updating or not

Source:
  - source-updater.js, line 121

##### Returns:

the updating status of the SourceBuffer

Type
  Boolean