5

我目前正在处理从 Level3 CDN 保护 rtmp 流。

文档可以在这里找到: https ://rapidshare.com/files/1450549534/Token_Components.html (看起来您需要登录才能查看,因此我托管在rapidshare上。原始网址是: https:// mediaportal.level3.com/mediaWeb/help/Content/ServicesDocs-Streaming/StreamingTokenAuth/TokenComponents.htm

向下滚动到按需流输入/输出示例(对于 MP4 文件)

我正在尝试重现该示例并获得具有相同值的相同 url。我为此写了一个小函数:

function flimmithash($file) {
    $streamer = 'pmsales';
    $host = 'pmsalesfs.fplive.net'; 
    $start_time = '20080101120000'; 
    $end_time = '20101231235900'; 
    $customer_secret = 'Secret'; // in the documentation there is also secret with a non capital s, i tried both

    $resouce_path = "/$streamer/$file";                                                     echo "resouce_path: $resouce_path <br>\n";
    $message = "$resouce_path?start_time=$start_time&end_time=$end_time#$customer_secret";  echo "message: $message <br>\n";
    $digest = md5($message);                                                                echo "digest: $digest <br>\n";
    $tokenvalue = "start_time=$start_time&end_time=$end_time&digest=$digest";               echo "tokenvalue: $tokenvalue <br>\n";
    $token = base64_encode($tokenvalue);                                                    echo "token: $token <br>\n";
    $url = "rtmp://$host/$streamer?token=".($token)."/mp4:$file";                           echo "url: $url <br>\n";        
    return $url;
}
echo "url: ".flimmithash('support/lvlt300kbps.mp4')."<br>\n"; 

我使用与示例中完全相同的值,但无法获得相同的摘要。

我使用 md5,因为它匹配长度。我还尝试了使用大写和非大写的 secret 。

您可以在此处访问示例脚本:https ://rapidshare.com/files/2581196874/Appendix.html (原文:https ://mediaportal.level3.com/mediaWeb/help/Content/ServicesDocs-Streaming/StreamingTokenAuth/Appendix-示例脚本.htm )

但是绝对没有使用md5,他们使用sha1。但是 sha1 比示例中的摘要长。

当然,我尝试用我的值填充这两个版本,但都没有奏效。

所以我的问题是:任何人都可以重现该示例和/或告诉我摘要或更改我的功能以根据该示例工作吗?

4

1 回答 1

2

他们的例子是不正确的。他们给出的摘要是针对文件的/support/lvlt300kbps.flv,可以使用 md5 为该文件名轻松生成,使用小写字母secret作为共享密钥。您可以在他们的文档中看到它与上面的 FLV 示例中给出的摘要相同。

于 2011-05-20T16:43:45.980 回答