Plugin Developer Discussion

Discussion for FogBugz Plugin developers

Embedding swf objects

Hi,

I just don't seem to be able to embed a swf object in a page and get it to run.

Doesn't matter what I try, IE7 sees the an <object> tag OK and shows its correct dimensions, but the swf isn't loaded.

Same goes for Safari (Mac connected to FB7 server), it sees the <embed> tag, right colour and size again, and the developer console shows that the movie is downloaded, but it just isn't played.

My page display is pretty simple:

public string PageDisplay()
{
    return string.Format(@"
        <object classid=""clsid:D27CDB6E-AE6D-11cf-96B8-444553540000""
            id=""FBPluginTest"" width=""350"" height=""150""
            codebase=""http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"">
            <param name=""movie"" value=""{0}"" />
            <param name=""quality"" value=""high"" />
            <param name=""bgcolor"" value=""#CC9966"" />
            <param name=""allowScriptAccess"" value=""sameDomain"" />
            <embed src=""{0}"" quality=""high"" bgcolor=""#6699CC""
                width=""350"" height=""150"" name=""FBPluginTest"" align=""middle""
                play=""true""
                loop=""false""
                quality=""high""
                allowScriptAccess=""sameDomain""
                type=""application/x-shockwave-flash""
                pluginspage=""http://www.adobe.com/go/getflashplayer"">
            </embed>
        </object>
    ",
    api.Url.PluginStaticFileUrl("FBPluginTest.swf")
    );
}

When I use the same /static/ folder being used in the plugin as a virtual directory in IIS and create a html file with basically the same <object> stuff, it works fine.

Has anyone had any success with embedding a swf?
Ian Jones Send private email
Tuesday, April 28, 2009
 
 
Another developer encountered the same issue.  It looks like we aren't setting the content-type header correctly for SWF files.  We'll fix this before release, but in the meantime he was able to get it working by serving the content from a binary page like so:

public byte[] BinaryPageDisplay()
{
    System.Net.WebClient wc = new System.Net.WebClient();
    byte[] result = wc.DownloadData("http://localhost/FogBugz/" + api.Url.PluginStaticFileUrl("TestForFogBugz.swf"));
    api.Response.ContentType = "application/x-shockwave-flash";
    return result;
}
David Fullerton Send private email
Wednesday, April 29, 2009
 
 
Thanks David, that worked, looking forward to the fix.

Follow on question...

Is there an easy way to determine the base url for the current FogBugz service (i.e. the http://localhost/FogBugz/ bit in your example)?
Ian Jones Send private email
Wednesday, April 29, 2009
 
 
Currently, no.  Can you tell me what you would need it for?
David Fullerton Send private email
Thursday, April 30, 2009
 
 
Hi David,

We need to know the path to FogBugz for the very example you gave, that WebClient.DownloadData call doesn't work without a full url.

being able to do something like api.Url.FogBugzUrl() to get the FogBugz URL would be very handy, I'm not sure how to do it otherwise.
Ian Jones Send private email
Thursday, April 30, 2009
 
 
Fair enough.  I've opened a case.
David Fullerton Send private email
Thursday, April 30, 2009
 
 
In the next release, serving Flash files will be possible without using the above workaround.

IPluginStaticFile now exposes a new method, StaticFileHeaders.  Implement it as follows to make flash SWFs work correctly:

void StaticFileHeaders(string sFilename)
{
  if (sFilename.ToLower().EndsWith(".swf"))
  {
    api.Response.ContentType = "application/x-shockwave-flash";
    api.Response.AddHeader("Content-Disposition", "inline");
  }
}
David Fullerton Send private email
Thursday, May 14, 2009
 
 
Thanks David, that's a very nice solution, looking forward to getting that release.
Ian Jones Send private email
Thursday, May 14, 2009
 
 
I added a BaseUrl method to CUrlApi, so you can use:

api.Url.BaseUrl()

to get the "http://localhost/fogbugz/" portion of the current request URL
David Fullerton Send private email
Monday, May 18, 2009
 
 
Thanks David, that's great news.

Will this be in 7.0.3 when it's released?
Ian Jones Send private email
Monday, May 18, 2009
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz