I don't know how cloudfront authentication works but I doubt you can use FLVPlayback for urls structured this way. Chances are, you need to write your own player taking into account cloudfront NetConnection/NetStream routine.
Thanks for the quick reply.
If I take the source URL that's supposed to go in there, and paste it into a browser.. it gives me access to the file. So that's the only way I know that it works with cloudfront's authentication.
The authentication basically requires two queries: expiration, and signature.
Using that same URL and putting it into my FLVPlayback Component's source, it breaks because of the query strings.
Again, I don't believe you can use FLVPlayback for this purpose and you should look into writing your own streaming routine because, it seams, FLVPlayback's way of dealing with urls is not flexible enough.
(i think there is a way to append an identifying query string to the source parameter. check these forums for a similar issue within the past few weeks that, i believe, the op found a work-around.)
Aside from that, how do you customize a component? I downloaded the FLVPlayback 2.5 component from the Flash Media Server Software Tools page (http://www.adobe.com/products/flashmediaserver/tool_downloads/) and then installed it like it told me to:
Using Windows 7:
- I downloaded the file
- Unzipped it
- Placed it into this directory: C:\Program Files (x86)\Adobe\Adobe Flash CS4\Common\Configuration\Component Source\ActionScript 3.0\FLVPlayback\
- Edited the SMILManager.as to remove the code that appends the "&FLVPlaybackVersion" code
- Opened Flash
It still appends the code when I go to test the movie. Did I not install it correctly? Am I supposed to put it somewhere else? Do I need to tell flash to load a customized version? If so, how?
Here is an excerpt from Adobe article (http://www.adobe.com/devnet/flash/articles/flvplayback_fplayer9u3_print.html). It seems it explains xml error:
Because a video file can originate from a variety of locations and because a URL can specify an XML or SMIL file in addition to a video file, the FLVPlayback component analyzes the URL that you supply. After installing Flash Player 9 Update 3, the FLVPlayback component performs the following checks on the URL in this order:
- If you specify the RTMP, RTMPT, RTMPS, RTMPE, or RTMPTE protocol for streaming from Flash Media Server (FMS), the source URL is assumed to be streaming video from Flash Media Server
- If the URL does not include a query string, for example:
and the URL does not end in .txt, .xml or .smil, the source is assumed to be a video file
- If the URL cotains the string "/fms/fpad" then the source is assumed to be a FPAD XML file from Flash Media Server
- If none of the above is true, the FLVPlayback component assumes the source URL is a SMIL file
I figured it out. I'm just posting here so that other people have the solution to this.
I have been following this article:
And inside it, there's a section that talks about using the FLVPlayback component with URLs containing query strings (parameters).
Be very careful of the line change.. it actually changes "<" to ">".
Also, you can copy the component .as files straight from your Program files:
C:\Program Files (x86)\Adobe\Adobe Flash CS4\Common\Configuration\Component Source\ActionScript 3.0\FLVPlayback\fl
......and copy that whole folder into the directory of your project.You can then customize those .as files as needed.
When you update those .as files, it will compile during compilation of your FLA.
I know you already found a workaround to make this work, just figured I'd post an alternative to editing the FLVPlayback compoent. I also am retrieving an FLV file via a .Net ASHX file. To keep both worlds happy, I used a URLRewriter module to translate for me... this one translates what I am using for the FLVPlayback component source:
There is of course no flv folder in the root of my application...
Here is my very simple URLRewriter class in vb.net:
Public Class URLRewriter
Public Sub Init(ByVal inst As System.Web.HttpApplication) Implements System.Web.IHttpModule.Init
AddHandler inst.BeginRequest, AddressOf Me.OnBeginRequest
Public Sub OnBeginRequest(ByVal app As Object, ByVal e As EventArgs)
Dim inst As HttpApplication = CType(app, HttpApplication)
Dim req_path As String = inst.Context.Request.Path
Dim trans_path As String = ""
Dim search As String = "/flv/"
Dim pos As Integer = req_path.IndexOf("/flv/")
If pos > -1 Then
Dim key as string = req_path.Substring(pos + search.Length, (req_path.LastIndexOf(".flv") - (pos + search.Length)))
HttpContext.Current.Response.Redirect("~/API/resource.ashx?ID=" & key )
Public Sub Dispose() Implements System.Web.IHttpModule.Dispose
and make sure you add this to your web.config.. this will cause URLRewriter to intercept all HTTP requests, and redirect as needed.
<add name="URLRewriter" type="[Namespace].URLRewriter"/>
Hope this helps someone.
I'm having the same problem and I've tried to solve it the same way. But it does't seem to work.
No READY-event is fired. I added a STATE_CHANGE listener, the event is fired and the event.state is VideoState.CONNECTION_ERROR...
Has the behaviour perhaps changed in one of the latest Flash versions? I'm using FLVPlayback version 22.214.171.124.