Question

i am developing an android application that contains a videoview that plays hls streaming from akamai CDN . the thing is the streaming url has a token authentication generated using Akamai API. the problem is that my video can't play this stream.

the below format plays normally
http://xxxxxxx-i.akamaihd.net/hls/live/#####/event1/Playlistaaa_1200.m3u8

the below format does not work for android (but it works for other development environments such as samsung smart TV):
http://xxxxxxx-i.akamaihd.net/hls/live/#####/event1/Playlistaaa_1200.m3u8??hdnea=st=1364547301~exp=1364547901~acl=/*~hmac=4baa8ad07af9f31c2d898bd205986e4c470a99b7573cc93918ce9caa234a8d03

Does anyone have any idea how to enable this for android or if there is any workaroud for this?

Regards

Was it helpful?

Solution

After checking with Akamai, the issue was solved and the problem was in the "/" character in the query string. the "/" should be replaced with "%2F"
Working URL :
http://xxxxx-i.akamaihd.net/hls/live/XXXX/event1/Playlist.m3u8?hdnea=st=1382080396~exp=1382685196~acl=%2F*~hmac=71794db8368c2498fea5fb62c381ce6e51a7ff4628c1225ddfe41411596b5d6e

Non working URL:
http://xxxxx-i.akamaihd.net/hls/live/XXXX/event1/Playlist.m3u8?hdnea=st=1382080396~exp=1382685196~acl=/*~hmac=71794db8368c2498fea5fb62c381ce6e51a7ff4628c1225ddfe41411596b5d6e

Accroding to akamai here are some comments:

  1. Android 2.x / 3.x device will not support akamai Token authentication service
  2. There are many errors in the way Android 4.x handle url's of the playlists/segments. If a "/" character is used as part of the query string for requesting the master.m3u8 file (for example, because we are using token auth), and bitrate playlists and segment url's are defined using relative url's, Android 4.x generates wrong absolute url's. This is because Android 4.x, for getting base url, takes the master.m3u8 url from the first character to the last "/" character, even when this character is part of the query string
  3. Android 4.x HLS implementation is very sensitive with wrong timestamps. Streams that works for iPhone, doesn't work in Android 4.x due to timestamps misalignments (PTS/DTS of H.264/AAC packets)

Note that this solution also worked for :

  • samsung smart TV player
  • LG smart TV Player
  • Western Digital player

OTHER TIPS

It really depends on which device - Android added a setCookie method - after HC. It allows you to start the process in a reasonable way.

Akamai has some flags that need to be changed to work w/ Android. As I recall it was just one checkbox.

Lastly, you can use a 3rd party player - like http://www.nexstreaming.com/ to properly handle HLS.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top