I am pretty new to Flash Media Server, but on my current project I have been charged with setting it up. Today, I ran into a thoroughly unpleasant problem, possibly a bug, which I thought I would share.
I set up our simple FMS application, which merely streams video from a three-directory-deep file structure. This means our Flash front end must,
a. connect to an instance of the application, say: rtmp://mydomain.com/myApp/_definst_
b. request the stream of an FLV resource, such as:
flv:ab/cd/ef/vwxyz
.
Note the explicit use of the default application instance _definst_
, and also the odd reshuffling of the FLV path. This is how you’re supposed to do it [apparently] and it worked just fine. Hoorah.
After running some successful tests with a simple front end using NetConnection, I am told that our Flash front end (actually Flex) will be using a skinned FLVPlayback component. This component doesn’t ask you to split the resource into these two pieces; it takes a single, complete stream URL. The above example would mean passing in: rtmp://mydomain.com/myApp/_definst_/ab/cd/ef/vwxyz.flv
Note we still keep the instance name, and the flv extension is optional.
This worked just fine on our dev server, and when we deployed to a live server it seemed to be ok too. Hoorah x 2!
Anyhow, I’ll get to the “but”.
After gong live, we received reports of videos not playing, and were unable to replicate the problem at will. Eventually I noticed in the log files that FMS was throwing 404s. On closer inspection, the 404s were for resources prefixed with our application instance name _definst_
. The successful 200 responses were requested correctly as ab/cd/ef/vwxyz
, but the failures were referenced as _definst_/ab/cd/ef/vwxyz
. Most alarmingly these were sometimes for the same resources, and even from the same client.
It looks like under certain [unknown] circumstances, the application and the resource are not getting correctly split out of the full URL. I do not know at what point this error creeps in. I also don’t know what FLVPlayback does internally to make the stream request from the full URL you pass in. All I know is that the error appears arbitrarily, and has proved impossible to raise on purpose. Possibly a bug in FLVPlayback, or a bug in Flash Media Server?
Solution
A real solution I have not found, so I did a very dirty hack.
As I have failed to avoid the 404s, I turned the bad paths into valid paths by sym-linking the FLV directory back to itself with the name _definst_
, as follows:
cd /path/to/flvs ln -s . _definst_
Job done, but I’m not happy about it. Anyone able to offer a real solution, please post a comment!