Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save svagionitis/5436603 to your computer and use it in GitHub Desktop.
Save svagionitis/5436603 to your computer and use it in GitHub Desktop.
Sequence Diagram For Loading an HLS stream (No errors) for http://www.websequencediagrams.com/
<div class="wsd" wsd_style="vs2010"><pre>
# No errors on demux and dcr
title Sequence Diagram For Loading an HLS stream (No errors and use of MPEG2TS containers)
participant "Higher Layer (HTML page, JS)" as HigherLayer
participant "HTMLMediaElement" as MediaPlayer
participant "Video pipeline(Remote server, Demux, Decoder)" as VideoPipeline
note right of MediaPlayer
networkState: NETWORK_EMPTY
readyState: HAVE_NOTHING
end note
HigherLayer->MediaPlayer: load()
note right of MediaPlayer
networkState: NETWORK_NO_SOURCE
end note
MediaPlayer->VideoPipeline: Can you fetch the media data from the remote server?
note right of MediaPlayer
networkState: NETWORK_LOADING
end note
MediaPlayer->HigherLayer: loadstart
MediaPlayer->HigherLayer: progress
note right of VideoPipeline
# For HLS specification see http://tools.ietf.org/html/draft-pantos-http-live-streaming-11
1. Successful connection to the remote server.
2. Get the first data from the remote server.
+--1. Get the Master or Media Playlist file.
+--2. Fetch the data from the first media segment.
3. Regarding metadata.
+--1. If in the Media Playlist file, in the tag EXT-X-STREAM-INF, \nthe RESOLUTION has been set then return this.
+--2. Else return a predefined fixed size (fullscreen or window)
end note
VideoPipeline->MediaPlayer: Ok the stream is ready. The metadata is returned. A couple of frames are returned.
note right of MediaPlayer
readyState: HAVE_METADATA
end note
MediaPlayer->HigherLayer: loadedmetadata
note right of MediaPlayer
readyState: HAVE_CURRENT_DATA
end note
MediaPlayer->HigherLayer: loadeddata
MediaPlayer->VideoPipeline: Now that I have the metadata, can you send me emough data for playback?
MediaPlayer->HigherLayer: progress
note right of VideoPipeline
Media Player retrieves more data from remote server until the buffer is full.
end note
VideoPipeline->MediaPlayer: Enough data returned for playback.
note right of MediaPlayer
networkState: NETWORK_IDLE
end note
MediaPlayer->HigherLayer: suspend
note right of MediaPlayer
readyState: HAVE_ENOUGH_DATA
end note
MediaPlayer->HigherLayer: canplay
MediaPlayer->HigherLayer: canplaythrough
HigherLayer->MediaPlayer: play()
</pre></div><script type="text/javascript" src="http://www.websequencediagrams.com/service.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment