Playing m3u8 from Amazon S3 + CloudFront with Signed URL in Android

fin*_*tic 6 android amazon-s3 audio-streaming amazon-cloudfront

I was able to access the playlist file (.m3u8) with signed URL. But the problem is, to access the stream files (.ts) within the playlist, the URL of each file needs to be signed too.

For Example:

I can access playlist.m3u8 with signed URL http://abcdefg.cloudfront.net/media/playlist.m3u8?Expires=xxxxxxxx&Policy=yyyyyyyyyyyyy&Signature=zzzzzzzzzzzzzz&Key-Pair-Id=kkkkkkkkkkkkkkkkk

#EXTM3U
#EXT-X-TARGETDURATION:10
#EXTINF:13
playlist-00000.ts
#EXTINF:12,
playlist-00001.ts
#EXTINF:12,
playlist-00002.ts
Run Code Online (Sandbox Code Playgroud)

But each ts file inside it should also be accessed like

http://abcdefg.cloudfront.net/media/playlist-00000.ts?Expires=xxxxxxxx&Policy=yyyyyyyyyyyyy&Signature=zzzzzzzzzzzzzz&Key-Pair-Id=kkkkkkkkkkkkkkkkk

I have to sign every single URL for each .ts files in the playlist.

Unfortunately, I don't see any media player that could handle the appending of the parameters for the URL before it gets the ts files.

If possible, I need a callback from the player like this:

public String onStreamFileReadyForPlaying(String pathToTsFile)
{
     //I could append the parameters here
     return pathToTsFile + "?Expires=xxxxxxxx&Policy=yyyyyyyyyyyyy&Signature=zzzzzzzzzzzzzz&Key-Pair-Id=kkkkkkkkkkkkkkkkk"
}
Run Code Online (Sandbox Code Playgroud)

Bra*_*rad 3

只需对播放列表中的 URL 进行签名即可。

这里的所有都是它的。