| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 | @startumlheader PlaylistLoader sequencestitle PlaylistLoader sequences: Main Manifest and Alternate AudioParticipant "PlaylistController" as PC #redParticipant "MainPlaylistLoader" as MPL #blueParticipant "mainSegmentLoader" as SL #blueParticipant "AudioPlaylistLoader" as APL #greenParticipant "audioSegmentLoader" as ASL #greenParticipant "external server" as ext #brownParticipant "m3u8Parser" as parser #orangeParticipant "mediaGroups" as MG #purpleParticipant Tech #lightblue== Initialization ==PC -> MPL : construct MainPlaylistLoaderPC -> MPL: load()MPL -> MPL : start()== Requesting Main Manifest ==MPL -> ext: xhr request for main manifestext -> MPL : response with main manifestMPL -> parser: parse main manifestparser -> MPL: object representing manifestnote over MPL #lightblue: trigger 'loadedplaylist'== Requesting Video Manifest ==note over MPL #lightblue: handling loadedplaylistMPL -> MPL : media()MPL -> ext : request child manifestext -> MPL: child manifest returnedMPL -> parser: parse child manifestparser -> MPL: object representing the child manifestnote over MPL #lightblue: trigger 'loadedplaylist'note over MPL #lightblue: handleing 'loadedplaylist'MPL -> SL: playlist()MPL -> SL: load()== Requesting Video Segments ==note over MPL #lightblue: trigger 'loadedmetadata'note over MPL #lightblue: handling 'loadedmetadata'opt vod and preload !== 'none'  MPL -> SL: playlist()  MPL -> SL: load()endMPL -> MG: setupMediaGroups()== Initializing Media Groups, Choosing Active Tracks ==MG -> APL: create child playlist loader for alt audioMG -> MG: activeGroup and audio variant selectedMG -> MG: enable activeTrack, onTrackChanged()MG -> SL: reset mainSegmentLoader== Requesting Alternate Audio Manifest ==MG -> MG: startLoaders()MG -> APL: load()APL -> APL: start()APL -> ext: request alt audio media manifestbreak finish pending tasks  MG -> Tech: add audioTracks  MPL -> PC: setupSourceBuffers()  MPL -> PC: setupFirstPlay()  loop on monitorBufferTick    SL -> ext: requests media segments    ext -> SL: response with media segment bytes  endendext -> APL: responds with child manifestAPL -> parser: parse child manifestparser -> APL: object representing child manifest returned== Requesting Alternate Audio Segments ==note over APL #lightblue: trigger 'loadedplaylist'note over APL #lightblue: handling 'loadedplaylist'APL -> ASL: playlist()note over APL #lightblue: trigger 'loadedmetadata'note over APL #lightblue: handling 'loadedmetadata'APL -> ASL: playlist()APL -> ASL: load()loop audioSegmentLoader.load()  ASL -> ext: requests media segments  ext -> ASL: response with media segment bytesend@enduml
 |