# Class: SegmentLoader

## SegmentLoader

#### new SegmentLoader(options)

An object that manages segment loading and appending.

##### Parameters:

Name | Type | Description
--- | --- | ---
`options` | Object | required and optional options

Source:
  - segment-loader.js, line 120

### Extends

- videojs.EventTarget

### Methods

#### abort()

abort anything that is currently doing on with the SegmentLoader and reset to a default state

Source:
  - segment-loader.js, line 205

#### checkBuffer_(buffered, playlist, currentTime, hasPlayed, expired, timeCorrection) → {Object}

Determines what segment request should be made, given current playback state.

##### Parameters:

Name | Type | Description
--- | --- | ---
`buffered` | TimeRanges | the state of the buffer
`playlist` | Object | the playlist object to fetch segments from
`currentTime` | Number | the playback position in seconds
`hasPlayed` | Boolean | if the player has played before
`expired` | Number | the seconds expired off the playlist
`timeCorrection` | Number | correction value to add to current time when when determining media index to use

Source:
  - segment-loader.js, line 371

##### Returns:

a segment info object that describes the request that should be made or null if no request is necessary

Type
  Object

#### clearBuffer()

clear anything that is currently in the buffer and throw it away

Source:
  - segment-loader.js, line 823

#### dispose()

dispose of the SegmentLoader and reset to the default state

Source:
  - segment-loader.js, line 192

#### error(error) → {Error}

set an error on the segment loader and null out any pending segements

##### Parameters:

Name | Type | Description
--- | --- | ---
`error` | Error | the error to set on the SegmentLoader

Source:
  - segment-loader.js, line 226

##### Returns:

the error that was set or that is currently set

Type
  Error

#### expired(expired)

setter for expired time on the SegmentLoader

##### Parameters:

Name | Type | Description
--- | --- | ---
`expired` | Number | the exired time to set

Source:
  - segment-loader.js, line 313

#### init_()

Once all the starting parameters have been specified, begin operation. This method should only be invoked from the INIT state.

Source:
  - segment-loader.js, line 439

#### load()

load a playlist and start to fill the buffer

Source:
  - segment-loader.js, line 238

#### mimeType(mimeType)

create/set the following mimetype on the SourceBuffer through a SourceUpdater

##### Parameters:

Name | Type | Description
--- | --- | ---
`mimeType` | String | the mime type string to use

Source:
  - segment-loader.js, line 323

#### pause()

Prevent the loader from fetching additional segments. If there is a segment request outstanding, it will finish processing before the loader halts. A segment loader can be unpaused by calling load().

Source:
  - segment-loader.js, line 291

#### paused()

Returns whether the segment loader is fetching additional segments when given the opportunity. This property can be modified through calls to pause() and load().

Source:
  - segment-loader.js, line 304

#### playlist(media)

set a playlist on the segment loader

##### Parameters:

Name | Type | Description
--- | --- | ---
`media` | PlaylistLoader | the playlist to set on the segment loader

Source:
  - segment-loader.js, line 270