private void AddPlayerScriptUrl(PlayerMarkupResult playerMarkupResult, MediaGenerateMarkupArgs args) { if (args.AccountItem != null && args.PlayerItem != null) { var publisherId = args.AccountItem[FieldIDs.Account.PublisherId]; var playerId = args.PlayerItem[FieldIDs.Player.Id]; if (!publisherId.IsNullOrEmpty() && !playerId.IsNullOrEmpty()) { var key = string.Format("{0}{1}Url", publisherId, playerId); if (!playerMarkupResult.BottomScripts.ContainsKey(key)) { var scriptUrl = ScriptUrl .Replace(AccountToken, publisherId) .Replace(PlayerToken, playerId); var scriptTag = string.Format(ScriptTagTemplate, scriptUrl); ////playerMarkupResult.BottomScripts.Add(key, scriptTag); //var str = "PlayerEventsListener.prototype.playerScripts.push({key:\"" + key + "\", value:\"" + //scriptUrl + "\"});"; //playerMarkupResult.BottomScripts.Add(key, string.Format("{2}brightcoveListener.playerScripts.push({{key:\"{0}\", value:\"{1}\"}});{2}", key, scriptUrl, System.Environment.NewLine)); playerMarkupResult.BottomScripts.Add(key, string.Format("{2}brightcoveListener.playerScripts['{0}']='{1}';{2}", key, scriptUrl, System.Environment.NewLine)); } } } }
public virtual void RegisterResources(Page page, PlayerMarkupResult result) { Assert.ArgumentNotNull(page, "page"); Assert.ArgumentNotNull(result, "result"); foreach (string url in result.CssUrls.Distinct()) { //ScriptManager.RegisterClientScriptBlock(page, typeof(Page), url, "<link rel='stylesheet' type='text/css' href='" + url + "'>", false); page.ClientScript.RegisterClientScriptBlock(typeof(Page), url, "<link rel='stylesheet' type='text/css' href='" + url + "'>"); } foreach (string url in result.ScriptUrls.Distinct()) { //ScriptManager.RegisterClientScriptInclude(page, typeof(Page), url, url); page.ClientScript.RegisterClientScriptInclude(typeof(Page), url, url); } foreach (var pair in result.BottomScripts) { if (!page.ClientScript.IsStartupScriptRegistered(typeof(Page), pair.Key)) { //ScriptManager.RegisterStartupScript(page, typeof(Page), pair.Key, pair.Value, true); page.ClientScript.RegisterStartupScript(typeof(Page), pair.Key, pair.Value, true); } } }
public override PlayerMarkupResult Generate(MediaGenerateMarkupArgs args) { string playerIdentifier = Guid.NewGuid().ToString("N"); PlayerMarkupResult result = new PlayerMarkupResult { Html = string.Format(this.EmbedHtml, playerIdentifier, args.MediaItem[Templates.MediaElement.UniqueID], args.Properties.Width, args.Properties.Height, string.Empty) }; result.ScriptUrls.Add(this.ScriptUrl); result.ScriptUrls.Add(this.AnalyticsScriptUrl); return(result); }
/// <summary> /// Generate a player markup. /// </summary> /// <param name="args"> /// The args. /// </param> /// <returns> /// The <see cref="string"/>. /// </returns> public override PlayerMarkupResult Generate(MediaGenerateMarkupArgs args) { var result = new PlayerMarkupResult(); result.ScriptUrls.Add(this.ScriptUrl); result.ScriptUrls.Add(this.AnalyticsScriptUrl); var sb = new StringBuilder("<object class='BrightcoveExperience'>", 1024); foreach (var pair in this.GetPlayerParameters(args)) { sb.AppendLine("<param name='" + pair.Key + "' value='" + pair.Value + "' />"); } sb.AppendLine("</object>"); result.Html = sb.ToString(); return(result); }
/// <summary> /// Generate a player markup. /// </summary> /// <param name="args"> /// The args. /// </param> /// <returns> /// The <see cref="string"/>. /// </returns> public override PlayerMarkupResult Generate(MediaGenerateMarkupArgs args) { PlayerMarkupResult playerMarkupResult = new PlayerMarkupResult(); var scriptUrl = this.ScriptUrl; playerMarkupResult.ScriptUrls.Add(this.AnalyticsScriptUrl); StringBuilder stringBuilder = new StringBuilder("<video controls", 1024); foreach (KeyValuePair <string, string> keyValuePair in this.GetPlayerParameters(args, ref scriptUrl)) { stringBuilder.Append(" " + keyValuePair.Key + "='" + keyValuePair.Value + "'"); } stringBuilder.Append("></video>"); if (!args.MediaItem.TemplateID.Equals(TemplateIDs.Video) && args.PlayerItem[FieldIDs.Player.ShowPlaylist] == "1") { stringBuilder.Append("<ol class='vjs-playlist'></ol>"); } playerMarkupResult.Html = stringBuilder.ToString(); AddPlayerScriptUrl(playerMarkupResult, args); return(playerMarkupResult); }
/// <summary> /// Generate a player markup. /// </summary> /// <param name="args"> /// The args. /// </param> /// <returns> /// The <see cref="string"/>. /// </returns> public override PlayerMarkupResult Generate(MediaGenerateMarkupArgs args) { string playerId = args.PlayerItem[FieldIDs.Player.Id]; string id = "ooyalaplayer_" + Guid.NewGuid().ToString("N"); var result = new PlayerMarkupResult { Html = string.Format( "<div id='{0}' style='width:{1}px;height:{2}px;display:inline-block;'></div><noscript><div>Please enable Javascript to watch this video</div></noscript>", id, args.Properties.Width, args.Properties.Height) }; result.ScriptUrls.Add(string.Format(ScriptUrl, playerId, id)); result.ScriptUrls.Add(this.AnalyticsScriptUrl); string parameters = !Context.PageMode.IsExperienceEditorEditing ? this.GetAdditionalParametersStr(args) : "{}"; result.BottomScripts.Add(id, string.Format("{0}.ready(function() {{ {0}.Player.create('{0}', '{1}',{2}); }});", id, args.MediaItem[FieldIDs.MediaElement.EmbedCode], parameters)); return(result); }
public static void RegisterResources(Page page, PlayerMarkupResult result) { Provider.RegisterResources(page, result); }