Ben Tappin · Nov 10, 2014 at 03:37 PM ·
HLS streams and resolvePlayAlias
I work on a music streaming service that streams nicely to a Flash client using RTMP/RTMPS. Recently we've been working on HLS to support devices/systems where Flash is not available.
The service uses tokens when requesting streams to stop unwanted visitors consuming streams and to ensure that streams are only accessible to the right people. To do this we have a stream handler that implements
IMediaStreamNameAliasProvider2. It validates the token (read: alias), provides the correct alias for the token to get the audio and deletes the token so it can't be used again.
Everything was working fine until we had to support HLS.
It seems that approximately 10 seconds before the end of the track there's another lookup for the (same) alias/token taking place. I'm guessing that it is because we're using m3u8 for HLS streams and it (Wowza?) is checking for details of the next item in the playlist -- I'm not sure. Our stream handler token check fails and the result is a
HTTPStreamerAdapterCupertinoStreamer.onPlaylist: java.lang.NullPointerException. Error log here:
Do I need to implement another interface or override another method (
HTTPStreamerAdapterCupertinoStreamer.onPlaylist maybe) to signal the end of the playlist? If not, is there another way around this problem that can be achieved by modifying our Wowza plugin rather than changing our token system?