我目前正在处理保护来自level3 cdn的rtmp流。
文档可在以下位置找到:
https://rapidshare.com/files/1450549534/Token_Components.html
(看起来您需要登录才能查看,因此我在RapidShare上重新托管。原始URL是:
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,因为它和长度匹配。我还尝试了资本和非资本的秘密。
您可以在此处转到示例脚本:https://rapidshare.com/files/2581196874/Appendix.html(原始:https://mediaportal.level3.com/mediaWeb/help/Content/ServicesDocs-Streaming/StreamingTokenAuth/Appendix-SampleScripts.htm
但绝对没有使用md5,他们使用sha1。但是sha1比示例中的摘要要长。
当然,我试图用我的值填充这两个版本,但都没有成功。
所以我的问题是:有谁能复制这个例子和/或告诉我摘要,或改变我的函数来根据这个例子工作吗?

最佳答案

他们的例子是错误的。它们给出的摘要是针对文件/support/lvlt300kbps.flv的,可以很容易地用md5为该文件名生成,使用小写的secret作为共享机密。您可以看到它与flv示例中给出的摘要完全相同。

07-24 22:16