简体   繁体   English

MediaPlayer:将签名的URI放入setDataSource android

[英]MediaPlayer : Put Signed URI into setDataSource android

I'm working on an Android app, and a part of it is about Streaming some videos from the server. 我正在开发一个Android应用程序,其中一部分是关于从服务器流式传输一些视频的。 Well all I have for now is pretty functional using normal video URIs. 好了,我现在使用普通的视频URI可以正常运行。

The thing is that all the requests / responses going and coming between the App and the server are Signed with an Private/Public keys (for security reasons). 事实是,在应用程序和服务器之间进行的所有请求/响应都使用私钥/公钥签名(出于安全原因)。

when it's about images / text I can just build an InputStream and then display it's content, but for the case of the video player I've built it's different since it's based on URIs : 当涉及图像/文本时,我可以只构建一个InputStream然后显示其内容,但是对于视频播放器,我已经构建了它,因为它基于URI:

setDataSource (context, Uri.parse(url));

Now the best I can do is to get the signed HttpRequest and try to retrieve from it the signature and the URI to be sent using my VideoPlayer. 现在,我能做的最好的事情就是获取signed HttpRequest并尝试从中检索使用我的VideoPlayer发送的签名和URI。

So, is there any way to get the URI and the signature from that signed HttpHeaders ? 因此,有什么方法可以从已signed HttpHeaders获取URI和签名吗?

EDIT : This is what the request headers looks like when I do want to retrieve a video : 编辑:这是我确实想检索视频时请求标头的样子:

GET https://api.example.com/videos/a3jk-APgzh
lYfbkjC3GvFSku6/M5Ex // this is the public key 
2014-08-02T22:05:22Z

and the response : 和响应:

Calculated: eZH5NbeH8RsSFziDi4uffoD8if4Spyz3I0UcI
[Timestamp]=>2014-08-02T22:05:22Z
[Authorization]=> lYfbkjC3GvFSku6/M5Ex:eZH5NbeH8RsSFzfG6J6ZRsyz3I0UcI=
[ACCEPT]=>application/json

Now, I'm supposed to fill the signed URI of the video in setDataSource from this response. 现在,我应该从该响应中将视频的签名URI填充到setDataSource

How can I achieve that ? 我该如何实现?

Thank you. 谢谢。

If you are signing your request, you must include the corresponding security token in it by adding a token in the header. 如果要签署请求,则必须通过在标头中添加令牌来在其中包含相应的安全令牌。

When you obtain temporary security credentials, the response includes temporary security credentials and a session token. 当您获得临时安全凭证时,响应将包括临时安全凭证和会话令牌。 You provide the session token value as a token in the header when you send requests like the following: 发送如下所示的请求时,可以在标题中提供会话令牌值作为令牌:

GET /photos/puppy.jpg HTTP/1.1
Host: myWebsite.com
Date: Sat, 02 Aug 2014 19:37:58 +0000

Authorization: TYPE AKIAIOSFODNN7EXAMPLE:frJIUN8DYpKDtOLCwo//yllqDzg=

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM