在 Android 中使用签名 URL 从 Amazon S3 + CloudFront 播放 m3u8 [英] Playing m3u8 from Amazon S3 + CloudFront with Signed URL in Android

查看:41
本文介绍了在 Android 中使用签名 URL 从 Amazon S3 + CloudFront 播放 m3u8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够访问带有签名 URL 的播放列表文件 (.m3u8).但问题是,要访问播放列表中的流文件(.ts),每个文件的 URL 也需要签名.

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.

例如:

我可以使用签名 URL 访问 playlist.m3u8 http://abcdefg.cloudfront.net/media/playlist.m3u8?Expires=xxxxxxxx&Policy=yyyyyyyyyyyyy&Signature=zzzzzzzzzzzzzzz&Key-kkkkkkair-Id=kkkkkkkkpair/p>

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

但是里面的每个 ts 文件也应该像

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

我必须为播放列表中的每个 .ts 文件签署每个 URL.

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

不幸的是,我没有看到任何媒体播放器可以在获取 ts 文件之前处理 URL 参数的附加.

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"
}

推荐答案

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

Simply sign the URLs in the playlist.

仅此而已.

这篇关于在 Android 中使用签名 URL 从 Amazon S3 + CloudFront 播放 m3u8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆