views:

1665

answers:

6

How do you embed a flash video in silverlight, if the source file is provided?

A: 

Please go to Don't want to wait for Silverlight 3 to get your FLV support? for real-time FLV converter.

Soul_Master
A: 

Well, it seems not a good idea. But I respect is as it may be your requirement.

Similar discussion avaialble here: http://channel9.msdn.com/forums/TechOff/257390-Silverlight-can-i-embed-a-flash-object-/

NinethSense
A: 

In Silverlight 3 we've put in place raw audio/video capabilities so yes you could in theory render out .flv into Silverlight. That being said, research your codec licenses here and ensure you comply with Adobe's EULA / Terms & Conditions etc.

Scott Barnes / Rich Platforms Product Manager / Microsoft.

Scott Barnes
Thanks for your reply but I am developing this application in silverlight 2.0.Is there any way i can do it with silverlight 2.0??
Ramya
A: 

Ramya,

Sorry, not that I know of. Silverlight 3 is the only realistic strategy here, there maybe some ways to bolt it on using your own native wrapper or something along those lines but it's somewhat of a dicey setup to use that approach.

Sorry!

Scott Barnes / Rich Platforms Product Manager / Microsoft.

Scott Barnes
+2  A: 

Finally I got the answer,

string mediaUrl= http://www.youtube.com/v/h8Ek3v1RBEU&hl=en&fs=1;

HtmlElement mediaContent = HtmlPage.Document.GetElementById("MediaDiv"); HtmlElement mediaObject = HtmlPage.Document.CreateElement("Object");

mediaObject.Id = "mediaObject"; mediaContent.AppendChild(mediaObject);

HtmlElement param = HtmlPage.Document.CreateElement("param"); param.Id = "MediaID";

param.SetAttribute("name", "movie"); param.SetAttribute("value", mediaUrl);

param.SetAttribute("valuetype", "ref"); mediaObject.AppendChild(param);

HtmlElement embed = HtmlPage.Document.CreateElement("embed"); embed.SetAttribute("src", mediaUrl);

embed.SetAttribute("width", "425px"); embed.SetAttribute("height", "344px");

embed.SetAttribute("allowscriptaccess", "always"); mediaContent = HtmlPage.Document.GetElementById("MediaDiv"); mediaContent.SetAttribute("innerHTML", jsText); head.AppendChild(mediaContent);

mediaContent.SetStyleAttribute("display", "block");

This way we can embed a flash file.

Ramya
A: 

Ramya, can you explain how the java script you provided at the top works? Perhaps give a complete example of the page showing how an SL3 xap embeds the FLV speficied in mediaUrl ? I don't know much about js and interacting with the HTML page elements. Am I supposed to make a ... ? :) thanks a zillion times.

Marie