使用PHP为AWS生成签名的RTMP URL

I've created a PHP function that generates a signed URL for AWS. I've used it for all kinds of http content.

I now need to use it to generate a signed RTMP link. I saw in the docs, that I am supposed to just use the folder/filename without extension.

Given my bucket structure is dms/myfile.mp4 I pass, dms/myfile into my PHP function and it generates the hashed URL. The hashed URL looks like this:

dms/myfile?Expires=1409073611&Signature=Iw2Df~JXc4psMp0f8qQz8WtxCbW54ErcN--CwCEGo7yf8Fg1wH-qFY9AjCvsV04w0piWoRzlYgEh6uz6tOaCwiEBZPn41FYFStvq3VXh34s1bEi4HQEDh0~nCXW5RZaUnHGcFWzK25HddmfY-4Yvw5fIHaIxMwIv9HZ3yIo0S~HqKO2h0ZKnf4sJ6vDeiVQ3Lx73bKJQV2kISIybu7QyUGQTH0XLWCAz5hq-zVuz~xbqcHqO27~sVdSXhPw4jLDGDnnhp6oXWF-SV-0eK8QImu1saWlCxr3bWVA1MTrNExw0LsTbjJGLA1Vsd74CzI6mVR8V6NjX82ZONAcVPAs4QQ__&Key-Pair-Id=APKAI3ZSOLRDPPSNWPDA

In my AS3 code, I successfully connect to the RTMP distribution server and then I attempt to play the dynamic streaming item as:

mp4:dms/myfile?Expires=1409073611&Signature=Iw2Df~JXc4psMp0f8qQz8WtxCbW54ErcN--CwCEGo7yf8Fg1wH-qFY9AjCvsV04w0piWoRzlYgEh6uz6tOaCwiEBZPn41FYFStvq3VXh34s1bEi4HQEDh0~nCXW5RZaUnHGcFWzK25HddmfY-4Yvw5fIHaIxMwIv9HZ3yIo0S~HqKO2h0ZKnf4sJ6vDeiVQ3Lx73bKJQV2kISIybu7QyUGQTH0XLWCAz5hq-zVuz~xbqcHqO27~sVdSXhPw4jLDGDnnhp6oXWF-SV-0eK8QImu1saWlCxr3bWVA1MTrNExw0LsTbjJGLA1Vsd74CzI6mVR8V6NjX82ZONAcVPAs4QQ__&Key-Pair-Id=APKAI3ZSOLRDPPSNWPDA

Note the 'mp4' before the signed URL

For some reason when I attempt to play the video, I get the error

Failed to play dms/myfile; stream not found.

Anyone know what I am doing wrong here? I can assure you the file does exist.

Their are couple of reasons behind this error

  1. If the file is mp4 then use mp4:{file_name_without_extension}?signed_url
  2. If the file is flv then use {file_name_with_extension}?signed_url
  3. If you are creating time based signed url then time may be over when you are accessing the url. You need to increase the time Or need to check your server time because time may be cause.
  4. Check file exists and you are using same RTMP network for accessing the bucket where file exists.
  5. Also while creating RTMP network you should used Restrict Viewer Access (Use Signed URLs) - Yes