Code well my friends...


SOLUTION: Flex VideoPlayer, VideoDisplay, Media Server and the Query String

Query string variables never seem to make it to the media server from the VideoPlayer component. Here's why...

The Situation

The problem here is how the media servers expect to get the 'application' and the 'file name' you will be streaming. The query string variables must be passed to the application. But when the VideoPlayer component takes the source you give it and passes it to the server, it passes the query string variables with the file name. Here is an example of a typical RTMP destination with some vars when setting the 'source' property for the VideoPlayer component:


The media server would expect to see this:

Application: "rtmp://host/appname?session=51900220"
File: "mp4:sample.mp4"

But the VideoPlayer component is actually sending this:

Application: "rtmp://host/appname"
File: "mp4:sample.mp4?session=51900220"


Watch for the query string at the 'Play' event!

The real problem here is that the media server isn't able to properly present you with the query string when the VideoPlayer is making the connection to the server, because it doesn't care about the file name at that point. Typically you will be watching for the query string at the 'connect' event so you can authenticate the connection. But not until the 'play' event does the server see the query string. At this point, you can now see the query string, handle it and promptly 'disconnect' the client if needed.


This was a major stumbling block for me. But as I got through it, it made sense. You can always use a NetConnection and a custom Video Player to get the query string variables at the 'connect' event. But the VideoPlayer component is fully skinned and ready to go, so why not try to use it. Now go make your code sizzle!