This module is a modification of the Video Player code provided in the Silverlight 1.0 SDK. It covers Silverlight integration with DotNetNuke including:
Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "Silverlight", this.TemplateSourceDirectory +
@"/js/Silverlight.js");
Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "main", this.TemplateSourceDirectory + @"/js/main.js");
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), String.Format("createSilverlight{0}",
Convert.ToString(ModuleId)), CreateSilverlight());
<script type="text/javascript">
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
</script>
Literal1.Text = String.Format("createSilverlight{0}() ", Convert.ToString(ModuleId));
sb.Append("<script type='text/javascript'> ");
sb.Append(String.Format("function createSilverlight{0}() ", Convert.ToString(ModuleId)));
sb.Append("{ ");
sb.Append("Silverlight.createObject( ");
sb.Append(String.Format("'{0}', ", this.TemplateSourceDirectory + @"/xaml/Scene.xaml"));
sb.Append(String.Format("document.getElementById('dnn_ctr{0}_SilverLightVideo_SilverlightControlHost'), ",
Convert.ToString(ModuleId)));
sb.Append(String.Format("'{0}', ", strVideoSource));
sb.Append(" { ");
sb.Append("width:'100%', ");
sb.Append("height:'100%', ");
sb.Append("inplaceInstallPrompt:false, ");
sb.Append("background:'black', ");
sb.Append("isWindowless:'false', ");
sb.Append("framerate:'24', ");
sb.Append("version: '1.0' ");
sb.Append("}, ");
sb.Append("{ ");
sb.Append("onError:null,");
sb.Append("onLoad:null ");
sb.Append("}, ");
sb.Append("null) ");
sb.Append("} ");
sb.Append("</script> ");
sb.Append(String.Format("'{0}', ", this.TemplateSourceDirectory + @"/xaml/Scene.xaml"));
<asp:Panel ID="SilverlightControlHost" runat="server" Height="400px" Width="600px">
....
</asp:Panel>
sb.Append(String.Format("document.getElementById('dnn_ctr{0}_SilverLightVideo_SilverlightControlHost'), ",
sb.Append(String.Format("'{0}', ", strVideoSource));
function canvas_loaded(sender, args)
{
var plugin = sender.getHost();
plugin.content.onfullScreenChange = onFullScreenChanged;
sender.findName("media").source = plugin.id;
sender.findName("media").stop();
}
Complete Source Code
Download the example module here: SilverLightVideo_03.00.00_Install.zip
See the live sample at
this link. Michael Washington is a Website
developer and an ASP.NET, C#, and Visual Basic programmer. He has
extensive knowledge in process improvement, billing systems, and credit
card transaction processing. He is a DotNetNuke Core member and has been
involved with DotNetNuke for nearly 3 years. He is the author of
numerous DotNetNuke modules and tutorials. He is one of the founding
members of the Southern California DotNetNuke Users group (http://socaldug.org).
He has a son, Zachary and resides in Los Angeles with his wife Valerie.
About the Author:
[Back to: The ADefWebserver DotNetNuke HELP WebSite]