Plugin Developer DiscussionDiscussion for FogBugz Plugin developers |
||
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?
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; }
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)?
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.
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"); } }
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 |
Powered by FogBugz