2.0 KiB
2.0 KiB
Playlist Loader
Purpose
The PlaylistLoader (PL) is responsible for requesting m3u8s, parsing them and keeping track of the media "playlists" associated with the manifest. The PL is used with a [SegmentLoader] to load ts or fmp4 fragments from an HLS source.
Basic Responsibilities
- To request an m3u8.
- To parse a m3u8 into a format videojs-http-streaming can understand.
- To allow selection of a specific media stream.
- To refresh a live m3u8 for changes.
Design
States
HAVE_NOTHINGthe state before the m3u8 is received and parsed.HAVE_MAIN_MANIFESTthe state before a media manifest is parsed and setup but after the main manifest has been parsed and setup.HAVE_METADATAthe state after a media stream is setup.SWITCHING_MEDIAthe intermediary state we go though while changing to a newly selected media playlistHAVE_CURRENT_METADATAa temporary state after requesting a refresh of the live manifest and before receiving the update
API
load()this will either start or kick the loader during playback.start()this will start the PL and request the m3u8.media()this will return the currently active media stream or set a new active media stream.
Events
loadedplaylistsignals the setup of a main playlist, representing the HLS source as a whole, from the m3u8; or a media playlist, representing a media stream.loadedmetadatasignals initial setup of a media stream.playlistunchangedsignals that no changes have been made to a m3u8.mediaupdatetimeoutsignals that a live m3u8 and media stream must be refreshed.mediachangingsignals that the currently active media stream is going to be changed.mediachangesignals that the new media stream has been updated.
