民营视频亚马逊CloudFront的红宝石流 [英] Private video streaming for Amazon CloudFront in ruby

查看:152
本文介绍了民营视频亚马逊CloudFront的红宝石流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何签署的网址在亚马逊的CloudFront的流式视频工作?

我使用 aws_cf_signer 的宝石,却无法得到签名的网址工作RTMP流mp4-文件。对于静态文件,如的text.txt它工作正常,但不是当我已经流分布。

例:

我有一个名为test.mp4文件,所以我如何才能签署的URL出signer.sign()

例如。 signed_url = signer.sign('RTMP://xyz.cloudfront.net/test',:结束=> Time.now + 3600)不产生工作URL。我测试用VLC播放网址和 rtmpdump

分布本身与博托这样创建的:

  

stream_dist = cf.create_streaming_distribution(产地=产地,   启用=真,               trusted_signers = [自我],               注释=考试分发)

解决方案

按照<一个href="http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/RestrictingAccessPrivateContent.html#CreatingSignedURL"相对=nofollow> AWS:限制 DOC最终用户访问,签署RTMP网址的格式与HTTP不同的:

  

通过HTTP,一个完整的URL唯一描述对象。您可以包括URL   在签名。流分发的内容,但是,不能总是   可以通过一个有效的URL描述。在流媒体分发,您只使用流   名创建一个签名。例如,如果您的数据流,包括签名是:

     

<$c$c>example/mp3_name.mp3?Expires=1258237200&Signature=TBD&Key-Pair-Id=PK12345EXAMPLE

     

有关资源值是:

     

例如/ mp3_name

     

有关流媒体分发,你不包括preFIX,如mp3:或MP4:,   该政策在资源名称。

     

此外,引用的MPEG文件时,你可能要忽略的文件扩展名   的URL封闭在签名。例如,您使用,而不是mp3_name.mp3 mp3_name。

我不知道aws_cf_signer宝石是否支持签署RTMP网址,很遗憾。如果你发现了,请让我知道!

How does signed URLs work for streamed videos in Amazon CloudFront?

I'm using aws_cf_signer gem, but can't get signed urls work for rtmp streamed mp4-file. For static files, like text.txt it works fine, but not when I have streaming distribution.

Example:

I have file named test.mp4 so how do I get signed url out of signer.sign()?

E.g. signed_url = signer.sign('rtmp://xyz.cloudfront.net/test', :ending => Time.now + 3600) does not produce working url. I have tested URLs with VLC player and rtmpdump

The distribution itself is created with boto like this:

stream_dist = cf.create_streaming_distribution(origin=origin, enabled=True, trusted_signers=["Self"], comment="test distribution")

解决方案

According to the AWS: Restricting End User Access doc, the format for signed RTMP urls is different from HTTP:

With HTTP, a full URL uniquely describes an object. You can include the URL in the signature. The content of a streaming distribution, however, cannot always be described by a valid URL. In a streaming distribution, you only use the stream name to create a signature. For example, if your stream including the signature is:

example/mp3_name.mp3?Expires=1258237200&Signature=TBD&Key-Pair-Id=PK12345EXAMPLE

The value for RESOURCE is:

example/mp3_name

For streaming distributions, you do not include a prefix, such as mp3: or mp4:, for the resource name in the policy.

Also, when referencing an MPEG file, you might have to omit the file extension for the URL enclosed in the signature. For example, you use mp3_name instead of mp3_name.mp3.

I'm not sure whether aws_cf_signer gem supports signing RTMP urls, unfortunately. If you find out, please let me know!

这篇关于民营视频亚马逊CloudFront的红宝石流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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