Interfacing with CDNs

33 views
Skip to first unread message

Gabe

unread,
Aug 3, 2011, 9:26:02 PM8/3/11
to dripls-dev
Hi Ludo,

Thanks for this - I think it'll be very useful when testing clients. I
just took a skim through the code and I don't see an obvious way to
configure CDNs or content sources - is this something I'd have to
implement on my own fork, or am I missing that?

Thanks!

Gabe Russell

Ludo Antonov

unread,
Aug 3, 2011, 10:07:23 PM8/3/11
to dripl...@googlegroups.com
Hi Gabe,
 
yes it is definitely possible to do this. Though a few lines of code need to be written.

The way to achieve is by extending conf/data.py ( https://github.com/hulu/dripls/blob/master/dripls/conf/data.py) . Basically when you make the request to DripLS, the service will call :

 def pull_master_m3u8(self, cid, kwargs):

and will let you  do the extra steps that are needed ( authentication, decryption, etc) to fetch the master m3u8 playlist from a content source. Note that the GET params of the DripLS request are also passed to the function. This is so that you can specify extra parameters that your backend service understands ( this might include fallback cdns, preferred bit-rate, etc). An original request like ( http://dripls-host/master.m3u8?authkey=sample&cid=wt&r=650k.s0~e404) can be transformed to contain extra params that pull_master_m3u8 will grab and use for the fetching of the master m3u8 playlist from the HLS backend service. For example ( http://dripls-host/master.m3u8?authkey=sample&cid=wt&r=650k.s0~e404&cdn=akamai,level5&preferred_bitrate=650000&etc,etc). Of course you'd need to implement the processing of these extra params.

If your content provider service does not support this level of extensibility, you have a couple of options. 1) you can process the retrieved master playlist in pull_master_m3u8 and do the filtering there, or 2) you can use a rule to disable a cdn ( r=akamai.*~e404) ,will simply replace all akamai playlists with a 404 link so that the player would not be able to play them and will ignore them.

Hope this helps. 

Ludo

Gabe

unread,
Aug 4, 2011, 2:25:08 AM8/4/11
to dripls-dev
I'll give it a go - thanks!

-Gabe

On Aug 3, 7:07 pm, Ludo Antonov <ludo.anto...@gmail.com> wrote:
> Hi Gabe,
>
> yes it is definitely possible to do this. Though a few lines of code need to be written.
>
> The way to achieve is by extending conf/data.py (https://github.com/hulu/dripls/blob/master/dripls/conf/data.py) . Basically when you make the request to DripLS, the service will call :
>
>  def pull_master_m3u8(self, cid, kwargs):
>
> and will let you  do the extra steps that are needed ( authentication, decryption, etc) to fetch the master m3u8 playlist from a content source. Note that the GET params of the DripLS request are also passed to the function. This is so that you can specify extra parameters that your backend service understands ( this might include fallback cdns, preferred bit-rate, etc). An original request like (http://dripls-host/master.m3u8?authkey=sample&cid=wt&r=650k.s0~e404) can be transformed to contain extra params that pull_master_m3u8 will grab and use for the fetching of the master m3u8 playlist from the HLS backend service. For example (http://dripls-host/master.m3u8?authkey=sample&cid=wt&r=650k.s0~e404&c...). Of course you'd need to implement the processing of these extra params.

Ludo Antonov

unread,
Aug 6, 2011, 2:32:05 AM8/6/11
to dripl...@googlegroups.com
Hi Gabe,

Also, I realized it will be helpful to have a simple way to out-of-the-box be able to point at a remote m3u8 to fetch. I just pushed a small change to the github master. If you do not need complicated authentication and have a readily available m3u8 somewhere, you can use :

"http://<dripls-host>/master.m3u8?cid=url&cid_url=<backend_m3u8_url>&r=[rules]"

The above will fetch cid_url and use it as the master m3u8 for which to apply the rule-set.

Ludo

Gabe

unread,
Aug 6, 2011, 8:39:58 PM8/6/11
to dripls-dev
Hi Ludo,

Perfect! Very handy for experimenting with shaped streams while taking
the CDN out of the equation.

Thanks,

Gabe

On Aug 5, 11:32 pm, Ludo Antonov <ludo.anto...@gmail.com> wrote:
> Hi Gabe,
>
Reply all
Reply to author
Forward
0 new messages