# Class: MasterPlaylistController

## MasterPlaylistController

#### new MasterPlaylistController()

the master playlist controller controller all interactons between playlists and segmentloaders. At this time this mainly involves a master playlist and a series of audio playlists if they are available

Source:
  - master-playlist-controller.js, line 265

### Extends

- videojs.EventTarget

### Methods

#### activeAudioGroup()

Returns the audio group for the currently active primary media playlist.

Source:
  - master-playlist-controller.js, line 835

#### activeSubtitleGroup_()

Returns the subtitle group for the currently active primary media playlist.

Source:
  - master-playlist-controller.js, line 850

#### blacklistCurrentPlaylist(erroropt)

Blacklists a playlist when an error occurs for a set amount of time making it unavailable for selection by the rendition selection algorithm and then forces a new playlist (rendition) selection.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`error` | Object | <optional> | an optional error that may include the playlist to blacklist

Source:
  - master-playlist-controller.js, line 1300

#### bufferLowWaterLine() → {Number}

Calculates the desired buffer low water line based on current time

Source:
  - master-playlist-controller.js, line 1691

##### Returns:

Desired buffer low water line in seconds

Type
  Number

#### dispose()

dispose of the MasterPlaylistController and everything that it controls

Source:
  - master-playlist-controller.js, line 1536

#### duration() → {TimeRange}

get the current duration

Source:
  - master-playlist-controller.js, line 1420

##### Returns:

the duration

Type
  TimeRange

#### getActiveAudioTrack_()

Returns the currently active track or the default track if none are active

Source:
  - master-playlist-controller.js, line 924

#### goalBufferLength() → {Number}

Calculates the desired forward buffer length based on current time

Source:
  - master-playlist-controller.js, line 1677

##### Returns:

Desired forward buffer length in seconds

Type
  Number

#### load()

Call load on our SegmentLoaders

Source:
  - master-playlist-controller.js, line 821

#### master() → {Object}

return the master playlist object if we have one

Source:
  - master-playlist-controller.js, line 1556

##### Returns:

the master playlist object that we parsed

Type
  Object

#### media() → {Object}

return the currently selected playlist

Source:
  - master-playlist-controller.js, line 1565

##### Returns:

the currently selected playlist object that we parsed

Type
  Object

#### mediaGroupChanged()

Determine the correct audio renditions based on the active AudioTrack and initialize a PlaylistLoader and SegmentLoader if necessary. This method is only called when the media-group changes and performs non-destructive 'resync' of the SegmentLoader(s) since the playlist has likely changed

Source:
  - master-playlist-controller.js, line 897

#### pauseLoading()

Pause all segment loaders

Source:
  - master-playlist-controller.js, line 1349

#### play()

Begin playback.

Source:
  - master-playlist-controller.js, line 1147

#### resetAudioLoaders_()

Destructive reset of the mainSegmentLoader (when audio is muxed) or audioSegmentLoader (when audio is demuxed) to prepare them to start loading new data right at currentTime

Source:
  - master-playlist-controller.js, line 960

#### resyncAudioLoaders_()

Non-destructive resync of the audioSegmentLoader (when audio is demuxed) to prepare to continue appending new audio data at the end of the current buffered region

Source:
  - master-playlist-controller.js, line 975

#### seekable() → {TimeRange}

check the seekable range

Source:
  - master-playlist-controller.js, line 1437

##### Returns:

the seekable range

Type
  TimeRange

#### setCurrentTime(currentTime) → {TimeRange}

set the current time on all segment loaders

##### Parameters:

Name | Type | Description
--- | --- | ---
`currentTime` | TimeRange | the current time to set

Source:
  - master-playlist-controller.js, line 1365

##### Returns:

the current time

Type
  TimeRange

#### setupAudio()

Determine the correct audio rendition based on the active AudioTrack and initialize a PlaylistLoader and SegmentLoader if necessary. This method is called once automatically before playback begins to enable the default audio track and should be invoked again if the track is changed. Performs destructive 'reset' on the SegmentLoaders(s) to ensure we start loading audio as close to currentTime as possible

Source:
  - master-playlist-controller.js, line 913

#### setupAudioPlaylistLoader_()

Setup a new audioPlaylistLoader and start the audioSegmentLoader to begin loading demuxed audio

Source:
  - master-playlist-controller.js, line 988

#### setupFirstPlay()

Seek to the latest media position if this is a live video and the player and video are loaded and initialized.

Source:
  - master-playlist-controller.js, line 1175

#### setupSubtitles()

Determine the correct subtitle playlist based on the active SubtitleTrack and initialize a PlaylistLoader and SegmentLoader if necessary. This method is called once automatically before playback begins to enable the default subtitle track and should be invoked again if the track is changed.

Source:
  - master-playlist-controller.js, line 1045

#### stopAudioLoaders_()

Destroy the PlaylistLoader and pause the SegmentLoader specifically for audio when switching audio tracks

Source:
  - master-playlist-controller.js, line 946

#### stuckAtPlaylistEnd_(playlist) → {boolean}

Check if a playlist has stopped being updated

##### Parameters:

Name | Type | Description
--- | --- | ---
`playlist` | Object | the media playlist object

Source:
  - master-playlist-controller.js, line 1259

##### Returns:

whether the playlist has stopped being updated or not

Type
  boolean

#### updateDuration()

Update the player duration

Source:
  - master-playlist-controller.js, line 1506