Skip navigation
supervu@gmail.com
Currently Being Moderated

FLVPlayback source with query strings (parameters) doesn't load

Aug 31, 2010 8:36 AM

Flash version: CS4

AS version: AS3


------------------------------

 

I'm currently trying to use the FLVPlayback component and pass a source FLV that's living on a cloudfront webserver. The problem is that the cloudfront requires authentication in the form of query strings in the source FLV. For example:

 

import fl.video.*;

var mainMovie:FLVPlayback = new FLVPlayback();
mainMovie.source = "http://www.somedomainname.com/firmware.flv?dummyquery=22";

trace(addChild(mainMovie));

 

As soon as I take away the "dummyquery", it works fine. When I add a query string, it breaks (nothing loads).

 

Here is the error output I get:

 

[object FLVPlayback]
VideoError: 1005: Invalid xml: URL: "http://www.somedomainname.com/firmware.flv?dummyquery=22&FLVPlaybackVersion=2.1" No root node found; if url is for an flv it must have .flv extension and take no parameters
     at fl.video::SMILManager/http://www.adobe.com/2007/flash/flvplayback/internal::xmlLoadEventHandler()
     at flash.events::EventDispatcher/dispatchEventFunction()
     at flash.events::EventDispatcher/dispatchEvent()
     at flash.net::URLLoader/onComplete()

 

It adds on "&FLVPlaybackVersion=2.1" to the end.

 

I saw a different article that said I should add a dummy variable at the end like "&dummy=.flv" because I was told that Flash is basically looking for an .flv extension at the end and you can trick it, but it doesn't work because they add on additional code.

 

Does anyone know how to work around this?

 
Replies
  • Currently Being Moderated
    Aug 31, 2010 8:48 AM   in reply to supervu@gmail.com

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 31, 2010 9:27 AM   in reply to supervu@gmail.com

    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.

     
    |
    Mark as:
  • kglad
    72,253 posts
    Jul 21, 2002
    Currently Being Moderated
    Aug 31, 2010 9:32 AM   in reply to Andrei1

    (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.)

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 31, 2010 9:55 AM   in reply to supervu@gmail.com

    Here is an excerpt from Adobe article (http://www.adobe.com/devnet/flash/articles/flvplayback_fplayer9u3_prin t.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:
      http://www.foo.com/app?param1=value&param2=value
      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
     
    |
    Mark as:
  • Currently Being Moderated
    Nov 30, 2010 11:53 AM   in reply to supervu@gmail.com

    Hey supervu,

     

    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:

     

    http://domain.com/flv/22.flv  to be resolved as http://domain.com/API/resource.ashx?ID=22

     

    There is of course no flv folder in the root of my application...

     

    Here is my very simple URLRewriter class in vb.net:

     

     

     

    Imports Microsoft.VisualBasic
    Imports System
    Imports System.Web

    Public Class URLRewriter
        Implements IHttpModule

        Public Sub Init(ByVal inst As System.Web.HttpApplication) Implements System.Web.IHttpModule.Init
            AddHandler inst.BeginRequest, AddressOf Me.OnBeginRequest
        End Sub

        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 )
            End If


        End Sub

        Public Sub Dispose() Implements System.Web.IHttpModule.Dispose

        End Sub

    End Class

     

     

     

    and make sure you add this to your web.config.. this will cause URLRewriter to intercept all HTTP requests, and redirect as needed.

     

    <system.web>

         <httpModules>    

              <add name="URLRewriter" type="[Namespace].URLRewriter"/>
          </httpModules>

    </system.web>

     

    Hope this helps someone.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 29, 2011 2:32 AM   in reply to supervu@gmail.com

    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 2.5.0.26.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points