HTTP Live Support

From DevWiki

Revision as of 23:58, 3 November 2012 by Riegersn (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents


What is HLS

HTTP Live Streaming (also known as HLS) is an HTTP-based media streaming communications protocol implemented by Apple Inc. as part of their QuickTime X and iPhone software systems. The technology is based on the Emblaze Network Media Streaming technology that was first released on 1998. It works by breaking the overall stream into a sequence of small HTTP-based file downloads, each download loading one short chunk of an overall potentially unbounded transport stream. As the stream is played, the client may select from a number of different alternate streams containing the same material encoded at a variety of data rates, allowing the streaming session to adapt to the available data rate. At the start of the streaming session, it downloads an extended M3U playlist containing the metadata for the various sub-streams which are available.

Since its requests use only standard HTTP transactions, HTTP Live Streaming is capable of traversing any firewall or proxy server that lets through standard HTTP traffic, unlike UDP-based protocols such as RTP. This also allows a Content delivery network to easily be implemented for any given stream.[1]

Apple has documented HTTP Live Streaming and submitted the draft to the IETF. You can view it here.


Playlist Protocol

Boxee uses a custom protocol, 'playlist://', for passing HLS parameters to the player. Different parameters can be passed via this protocol to setup your stream.

Parameters
Parameter Description
quality Sets the bitrate quality for the given stream. (0, 1, A) Where A=Adaptive 1=High 0=Low.


Example

Below is a basic example.
Download this test application.

  1. import mc
  2. from urllib import quote_plus, urlencode
  3.  
  4. def playHlsStream(stream):
  5.    #set playlist stream bandwith, 0, 1, A (low, high, adaptive)
  6.    params = { 'quality': stream['quality'] }
  7.  
  8.    #build stream url
  9.    playlist_url = "playlist://%s?%s" % (quote_plus(stream['url']), urlencode(params))
  10.  
  11.    #build Boxee listitem and set properties
  12.    item = mc.ListItem(mc.ListItem.MEDIA_VIDEO_EPISODE)
  13.    item.SetPath(playlist_url)
  14.    item.SetLabel(stream['title'])
  15.    item.SetContentType('application/vnd.apple.mpegurl')
  16.  
  17.    #initialize the Boxee player and pass our listitem
  18.    mc.GetPlayer().Play(item)
  19.  
  20.  
  21. my_stream = {
  22.    'url':      'http://mysite.com/replace/with/your.m3u8',
  23.    'quality':  'A',
  24.    'title':    'My HLS Test Stream'
  25. }
  26.  
  27. playHlsStream(my_stream)
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox