/// <summary> /// Creates a script block which loads a QuickTime video at runtime. /// </summary> /// <returns>Script block that will load a QuickTime video</returns> private string BuildScriptBlock() { string scriptBlock = string.Format("LoadQuickTime('QTPlaceholder_{0}', '{1}', {2}, {3}, '{4}', '{5}', '{6}', {7});", ltlScript.ClientID, HTMLHelper.HTMLEncode(URLHelper.ResolveUrl(VideoURL)), Width, Height, ShowControls.ToString().ToLowerCSafe(), Autostart.ToString().ToLowerCSafe(), Loop.ToString().ToLowerCSafe(), ScriptHelper.GetString(GetString("Media.NotSupported"))); return(ScriptHelper.GetScript(scriptBlock)); }
protected override void Render(HtmlTextWriter output) { StringBuilder sb = new StringBuilder("<OBJECT ID='" + this.ClientID + "' name='" + this.ClientID + "' " + "CLASSID='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6'" + "VIEWASTEXT" + "height=" + Height + " " + "width=" + Width + ">"); //Render properties as object parameters sb.Append("<PARAM name='URL' value='" + FileName + "'>"); sb.Append("<PARAM name='mute' value='" + Mute.ToString() + "'>"); sb.Append("<PARAM name='AutoStart' value='" + Autostart.ToString() + "'>"); sb.Append("<PARAM name='balance' value='" + Balance + "'>"); sb.Append("<PARAM name='enabled' value='" + Enabled.ToString() + "'>"); sb.Append("<PARAM name='fullScreen' value='" + Fullscreen.ToString() + "'>"); sb.Append("<PARAM name='playCount' value='" + PlayCount.ToString() + "'>"); if (Volume >= 0) { sb.Append("<PARAM name='volume' value='" + Volume + "'>"); } sb.Append("<PARAM name='rate' value='" + Rate + "'>"); sb.Append("<PARAM name='StretchToFit' value='" + StretchToFit.ToString() + "'>"); sb.Append("<PARAM name='enabledContextMenu' value='" + EnableContextMenu.ToString() + "'>"); //output ending object tag sb.Append("</OBJECT>"); //flush everything to the output stream output.Write(sb.ToString()); }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (StopProcessing) { // Do nothing } else { if (PortalContext.IsDesignMode(PortalContext.ViewMode)) { ltlPlaceholder.Text = "<table style=\"border: 1px solid Gray;background-color:#eee;width:" + Width + "px;height:" + Height + "px\"><tr><td style=\"vertical-align:middle;text-align:center;color:Gray;\">" + GetString("global.herecomesvideo").ToUpperCSafe() + "</td></tr></table>"; } else { // Auto activation hack if (AutoActivation) { ltlPlaceholder.Text = "<div class=\"VideoLikeContent\" id=\"RMPlaceholder_" + ltlScript.ClientID + "\" ></div>"; // Register external script ScriptHelper.RegisterScriptFile(Page, "~/CMSWebParts/Media/RealMedia_files/video.js"); // Call function for video object insertion ltlScript.Text = BuildScriptBlock(); } else { // Movie ltlPlaceholder.Text = "<div class=\"VideoLikeContent\" ><div class=\"Video\"><object classid=\"clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA\" width=\"" + Width + "\" height=\"" + Height + "\">" + "<param name=\"src\" value=\"" + UrlResolver.ResolveUrl(VideoURL) + "\" />" + "<param name=\"autostart\" value=\"" + Autostart.ToString().ToLowerCSafe() + "\" />" + "<param name=\"wmode\" value=\"transparent\" />" + "<param name=\"loop\" value=\"" + Loop + "\" />" + "<param name=\"logo\" value=\"false\" />" + "<param name=\"controls\" value=\"ImageWindow\" />" + "<param name=\"console\" value=\"one\" />" + "<!--[if !IE]>-->" + "<embed height=\"" + Height + "\" loop=\"" + Loop + "\" wmode=\"transparent\" src=\"" + HTMLHelper.HTMLEncode(UrlResolver.ResolveUrl(VideoURL)) + "\" type=\"audio/x-pn-realaudio-plugin\" width=\"" + Width + "\" controls=\"ImageWindow\" autostart=\"" + Autostart + "\" console=\"one\" logo=\"false\" />" + "<!--<![endif]-->" + "<noembed>" + GetString("RealMedia.NotSupported") + "</noembed>" + "\n" + "</object></div>"; // Control panel if (ShowControls) { ltlPlaceholder.Text += "<div class=\"Controls\"><object classid=\"clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA\" width=\"" + Width + "\" height=\"" + ControlsHeight + "\">" + "<param name=\"src\" value=\"" + HTMLHelper.HTMLEncode(UrlResolver.ResolveUrl(VideoURL)) + "\" />" + "<param name=\"autostart\" value=\"" + Autostart.ToString().ToLowerCSafe() + "\" />" + "<param name=\"wmode\" value=\"transparent\" />" + "<param name=\"loop\" value=\"" + Loop + "\" />" + "<param name=\"controls\" value=\"ControlPanel\" />" + "<param name=\"logo\" value=\"false\" />" + "<param name=\"console\" value=\"one\" />" + "<!--[if !IE]>-->" + "<embed height=\"" + ControlsHeight + "\" loop=\"" + Loop + "\" wmode=\"transparent\" src=\"" + HTMLHelper.HTMLEncode(UrlResolver.ResolveUrl(VideoURL)) + "\" type=\"audio/x-pn-realaudio-plugin\" width=\"" + Width + "\" controls=\"ControlPanel\" autostart=\"" + Autostart + "\" console=\"one\" logo=\"false\" />" + "<!--<![endif]-->" + "<noembed>" + GetString("RealMedia.NotSupported") + "</noembed>" + "</object></div>"; } // End div ltlPlaceholder.Text += "</div>"; } } } }