Example #1
0
		public static string GetEmbedCode(long PlayerID, long VideoID, PlayerPlaylistType PlaylistType, long PlaylistID, List<long> PlaylistIDs, int height, int width, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID, Dictionary<string, string> objectParams) {

			if (objectParams == null)
				objectParams = new Dictionary<string, string>();

			if(!objectParams.ContainsKey("bgcolor"))
				objectParams.Add("bgcolor", BackgroundColor);
			if (!objectParams.ContainsKey("width"))
				objectParams.Add("width", width.ToString());
			if (!objectParams.ContainsKey("height"))
				objectParams.Add("height", height.ToString());
			if (!objectParams.ContainsKey("playerID"))
				objectParams.Add("playerID", PlayerID.ToString());

			//add in video ids or playlist ids
			if (PlaylistType.Equals(PlayerPlaylistType.None) && VideoID != -1) {
				objectParams.Add("@videoPlayer", VideoID.ToString());
			} else if (PlaylistType.Equals(PlayerPlaylistType.Tabbed) && PlaylistIDs != null) {
				objectParams.Add("@playlistTabs", PlaylistIDs.ToDelimString(","));
			} else if (PlaylistType.Equals(PlayerPlaylistType.ComboBox) && PlaylistIDs != null) {
				objectParams.Add("@playlistCombo", PlaylistIDs.ToDelimString(","));
			} else if (PlaylistType.Equals(PlayerPlaylistType.VideoList) && PlaylistID != -1) {
				objectParams.Add("@videoList", PlaylistID.ToString());
			}

			objectParams.Add("isVid", "true");
			objectParams.Add("autoStart", AutoStart.ToString().ToLower());
			objectParams.Add("isUI", "true");
			objectParams.Add("dynamicStreaming", "true");
			objectParams.Add("wmode", WMode.ToString());

			return GetEmbedCode(objectTagID, objectParams);
		}
Example #2
0
 public bool Equals(WMode rhs)
 {
     if (object.ReferenceEquals(rhs, null) || rhs.GetType() != typeof(WMode))
     {
         return(false);
     }
     return(_value == rhs._value);
 }
        /// <summary>
        /// Creates the JavaScript block and Flash div controls and adds them to the page
        /// </summary>
        protected override void CreateChildControls()
        {
            //Add the flash content panel to the page
            this.Controls.Clear();

            Panel vp = new Panel();

            vp.ID = this.ClientID;
            this.Controls.Add(vp);

            if (!VideoID.Equals(-1) || !PlayerID.Equals(-1))
            {
                //wmode
                WMode qWMode = BrightcoveSDK.WMode.Transparent;
                if (WMode.Equals(BrightcoveSDK.WMode.Opaque.ToString().ToLower()))
                {
                    qWMode = BrightcoveSDK.WMode.Opaque;
                }
                if (WMode.Equals(BrightcoveSDK.WMode.Window.ToString().ToLower()))
                {
                    qWMode = BrightcoveSDK.WMode.Window;
                }

                string  uniqueID  = "video_" + DateTime.Now.ToString("yyyy.MM.dd.HH.mm.ss.FFFF");
                Literal litScript = new Literal();
                if (PlaylistTabs.Any())
                {
                    litScript.Text = EmbedCode.GetTabbedPlayerEmbedCode(PlayerID, VideoID, PlaylistTabs.GetValues(), Height, Width, BackColor, AutoStart, qWMode, uniqueID);
                }
                else if (PlaylistCombos.Any())
                {
                    litScript.Text = EmbedCode.GetComboBoxPlayerEmbedCode(PlayerID, VideoID, PlaylistCombos.GetValues(), Height, Width, BackColor, AutoStart, qWMode, uniqueID);
                }
                else if (VideoList != -1)
                {
                    EmbedCode.GetVideoListPlayerEmbedCode(PlayerID, VideoID, VideoList, Height, Width, BackColor, AutoStart, qWMode, uniqueID);
                }
                else
                {
                    litScript.Text = EmbedCode.GetVideoPlayerEmbedCode(PlayerID, VideoID, Height, Width, BackColor, AutoStart, qWMode, uniqueID);
                }

                Controls.Add(litScript);
            }
        }
Example #4
0
        /// <summary>
        /// Gets the hash code.
        /// </summary>
        /// <returns>The hash code.</returns>
        public override int GetHashCode()
        {
            if (_writeConcern.IsFrozen)
            {
                return(_frozenHashCode);
            }

            // see Effective Java by Joshua Bloch
            int hash = 17;

            hash = 37 * hash + Enabled.GetHashCode();
            hash = 37 * hash + FSync.GetHashCode();
            hash = 37 * hash + Journal.GetHashCode();
            hash = 37 * hash + W.GetHashCode();
            hash = 37 * hash + ((WMode == null) ? 0 : WMode.GetHashCode());
            hash = 37 * hash + WTimeout.GetHashCode();
            return(hash);
        }
		/// <summary>
		/// This will build an html object tag based on the information provided
		/// </summary>
		/// <param name="player">The player defined under BrightcoveSDK.SitecoreUtil</param>
		/// <param name="objectTagID">The HTML Object ID Tag</param>
		/// <param name="video">The video defined under BrightcoveSDK.SitecoreUtil</param>
		/// <param name="PlaylistID">A Playlist ID for a single playlist video player</param>
		/// <param name="PlaylistIDs">The List of Playlist IDs for a multi playlist video player</param>
		/// <param name="BackgroundColor">The Hex Value in the form: #ffffff</param>
		/// <param name="AutoStart">A flag to cause the video to automatically start playing</param>
		/// <param name="WMode">The wmode </param>
		/// <returns></returns>
		private static string GetEmbedCode(long PlayerID, long VideoID, PlayerPlaylistType PlaylistType, long PlaylistID, List<long> PlaylistIDs, int height, int width, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID) {

			StringBuilder embed = new StringBuilder();

			if (PlayerID != null) {
				//this one works
				embed.AppendLine("<!-- Start of Brightcove Player -->");
				embed.AppendLine("<div style=\"display:none\"></div>");
				embed.AppendLine("<!-- By use of this code snippet, I agree to the Brightcove Publisher T and C found at https://accounts.brightcove.com/en/terms-and-conditions/. -->");
				embed.AppendLine("<script language=\"JavaScript\" type=\"text/javascript\" src=\"http://admin.brightcove.com/js/BrightcoveExperiences.js\"></script>");
				embed.AppendLine("<object id=\"" + objectTagID + "\" class=\"BrightcoveExperience\">");
				embed.AppendLine("<param name=\"bgcolor\" value=\"" + BackgroundColor + "\" />");
				embed.AppendLine("<param name=\"width\" value=\"" + width.ToString() + "\" />");
				embed.AppendLine("<param name=\"height\" value=\"" + height.ToString() + "\" />");
				embed.AppendLine("<param name=\"playerID\" value=\"" + PlayerID + "\" />");

				//add in video ids or playlist ids
				if (PlaylistType.Equals(PlayerPlaylistType.None) && VideoID != null) {
					embed.AppendLine("<param name=\"@videoPlayer\" value=\"" + VideoID + "\"/>");
				} else if (PlaylistType.Equals(PlayerPlaylistType.Tabbed) && PlaylistIDs != null) {
					embed.AppendLine("<param name=\"@playlistTabs\" value=\"" + PlaylistIDs.ToDelimString(",") + "\"/>");
				} else if (PlaylistType.Equals(PlayerPlaylistType.ComboBox) && PlaylistIDs != null) {
					embed.AppendLine("<param name=\"@playlistCombo\" value=\"" + PlaylistIDs.ToDelimString(",") + "\"/>");
				} else if (PlaylistType.Equals(PlayerPlaylistType.VideoList) && PlaylistID != -1) {
					embed.AppendLine("<param name=\"@videoList\" value=\"" + PlaylistID.ToString() + "\"/>");
				}

				embed.AppendLine("<param name=\"isVid\" value=\"true\" />");
				embed.AppendLine("<param name=\"autoStart\" value=\"" + AutoStart.ToString().ToLower() + "\" />");
				embed.AppendLine("<param name=\"isUI\" value=\"true\" />");
				embed.AppendLine("<param name=\"dynamicStreaming\" value=\"true\" />");
				embed.AppendLine("<param name=\"wmode\" value=\"" + WMode.ToString() + "\" /> ");
				embed.AppendLine("</object>");
				embed.AppendLine("<script type=\"text/javascript\">brightcove.createExperiences();</script>");
				embed.AppendLine("<!-- End of Brightcove Player -->");
			}
			return embed.ToString();
		}
Example #6
0
		public static string GetComboBoxPlayerEmbedCode(long PlayerID, List<long> PlaylistIDs, int height, int width, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID, Dictionary<string, string> nvc) {
			return GetEmbedCode(PlayerID, -1, PlayerPlaylistType.ComboBox, -1, PlaylistIDs, height, width, BackgroundColor, AutoStart, WMode, objectTagID, nvc);
		}
		public static string GetEmbedCode(this PlayerItem player, VideoItem video, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID, Dictionary<string,string> objectParams) {
			return GetEmbedCode(player, video, -1, null, BackgroundColor, AutoStart, WMode, objectTagID, objectParams);
		}
		public static string GetEmbedCode(this PlayerItem player, VideoItem video, string BackgroundColor, bool AutoStart, WMode WMode) {
			return GetEmbedCode(player, video, BackgroundColor, AutoStart, WMode, CreateEmbedID());
		}
		public static string GetEmbedCode(this PlayerItem player, List<long> PlaylistIDs, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID, Dictionary<string,string> objectParams) {
			return GetEmbedCode(player, null, -1, PlaylistIDs, BackgroundColor, AutoStart, WMode, objectTagID, objectParams);
		}
Example #10
0
 public static string GetEmbedCode(this PlayerItem player, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID)
 {
     return(GetEmbedCode(player, BackgroundColor, AutoStart, WMode, objectTagID, new Dictionary <string, string>()));
 }
Example #11
0
        public static string GetEmbedCode(long PlayerID, long VideoID, PlayerPlaylistType PlaylistType, long PlaylistID, List <long> PlaylistIDs, int height, int width, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID, Dictionary <string, string> objectParams)
        {
            if (objectParams == null)
            {
                objectParams = new Dictionary <string, string>();
            }

            if (!objectParams.ContainsKey("bgcolor"))
            {
                objectParams.Add("bgcolor", BackgroundColor);
            }
            if (!objectParams.ContainsKey("width"))
            {
                objectParams.Add("width", width.ToString());
            }
            if (!objectParams.ContainsKey("height"))
            {
                objectParams.Add("height", height.ToString());
            }
            if (!objectParams.ContainsKey("playerID"))
            {
                objectParams.Add("playerID", PlayerID.ToString());
            }

            //add in video ids or playlist ids
            if (PlaylistType.Equals(PlayerPlaylistType.None) && VideoID != -1)
            {
                objectParams.Add("@videoPlayer", VideoID.ToString());
            }
            else if (PlaylistType.Equals(PlayerPlaylistType.Tabbed) && PlaylistIDs != null)
            {
                objectParams.Add("@playlistTabs", PlaylistIDs.ToDelimString(","));
            }
            else if (PlaylistType.Equals(PlayerPlaylistType.ComboBox) && PlaylistIDs != null)
            {
                objectParams.Add("@playlistCombo", PlaylistIDs.ToDelimString(","));
            }
            else if (PlaylistType.Equals(PlayerPlaylistType.VideoList) && PlaylistID != -1)
            {
                objectParams.Add("@videoList", PlaylistID.ToString());
            }

            objectParams.Add("isVid", "true");
            objectParams.Add("autoStart", AutoStart.ToString().ToLower());
            objectParams.Add("isUI", "true");
            objectParams.Add("dynamicStreaming", "true");
            objectParams.Add("wmode", WMode.ToString());

            return(GetEmbedCode(objectTagID, objectParams));
        }
Example #12
0
		//based on list of ids
		public static string GetTabbedPlayerEmbedCode(long PlayerID, long VideoID, List<long> PlaylistIDs, int height, int width, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID) {
			return GetEmbedCode(PlayerID, VideoID, PlayerPlaylistType.Tabbed, -1, PlaylistIDs, height, width, BackgroundColor, AutoStart, WMode, objectTagID);
		}
Example #13
0
        protected void SetVideoPlayer()
        {
            VideoItem vp = new VideoItem(currentDB.Items[ddlVideo.SelectedValue]);

            vpPlayer.PlayerID   = currentItem.PlayerID;
            vpPlayer.VideoID    = vp.VideoID;
            vpPlayer.PlayerName = currentItem.Name;
            vpPlayer.Height     = currentItem.Height;
            vpPlayer.Width      = currentItem.Width;
            if (chkAutoStart.Checked)
            {
                vpPlayer.AutoStart = true;
            }
            vpPlayer.WMode = ddlWMode.SelectedValue;

            IEnumerable <string> selected = from li in cblPlaylist.Items.Cast <ListItem>() where li.Selected == true select li.Value;

            vpPlayer.VideoList = -1;
            vpPlayer.PlaylistCombos.Clear();
            vpPlayer.PlaylistTabs.Clear();
            vpPlayer.CssClass = "BrightcoveExperience";

            WMode wmode = WMode.Window;

            try {
                wmode = (WMode)Enum.Parse(wmode.GetType(), ddlWMode.SelectedValue, true);
            }catch {}

            switch (currentItem.PlaylistType)
            {
            case PlayerPlaylistType.VideoList:
                if (selected.Count() > 0)
                {
                    PlaylistItem p = new PlaylistItem(currentDB.Items[selected.First()]);
                    vpPlayer.VideoList = p.PlaylistID;
                    pnlVideo.Visible   = false;
                }
                break;

            case PlayerPlaylistType.Tabbed:
                List <long> pids = new List <long>();
                foreach (string pID in selected)
                {
                    PlaylistItem p = new PlaylistItem(currentDB.Items[pID]);
                    vpPlayer.PlaylistTabs.Add(new PlaylistTab(p.PlaylistID));
                    pids.Add(p.PlaylistID);
                }
                pnlVideo.Visible = false;
                break;

            case PlayerPlaylistType.ComboBox:
                List <long> cpids = new List <long>();
                foreach (string pID in selected)
                {
                    PlaylistItem p = new PlaylistItem(currentDB.Items[pID]);
                    vpPlayer.PlaylistCombos.Add(new PlaylistCombo(p.PlaylistID));
                    cpids.Add(p.PlaylistID);
                }
                pnlVideo.Visible = false;
                break;

            case PlayerPlaylistType.None:
                pnlPlaylist.Visible = false;
                break;
            }
        }
Example #14
0
 public static extern int SetErrorMode(
     WMode wMode
     );
		public static string GetEmbedCode(this PlayerItem player, long PlaylistID, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID) {
			return GetEmbedCode(player, null, PlaylistID, null, BackgroundColor, AutoStart, WMode, objectTagID);
		}
		/// <summary>
		/// This will build an html object tag based on the information provided
		/// </summary>
		/// <param name="player">The player defined under BrightcoveSDK.SitecoreUtil</param>
		/// <param name="objectTagID">The HTML Object ID Tag</param>
		/// <param name="video">The video defined under BrightcoveSDK.SitecoreUtil</param>
		/// <param name="PlaylistID">A Playlist ID for a single playlist video player</param>
		/// <param name="PlaylistIDs">The List of Playlist IDs for a multi playlist video player</param>
		/// <param name="BackgroundColor">The Hex Value in the form: #ffffff</param>
		/// <param name="AutoStart">A flag to cause the video to automatically start playing</param>
		/// <param name="WMode">The wmode </param>
		/// <returns></returns>
		private static string GetEmbedCode(this PlayerItem player, VideoItem video, long PlaylistID, List<long> PlaylistIDs, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID) {

			StringBuilder embed = new StringBuilder();

			if (player != null) {
				//this one works
				embed.AppendLine("<!-- Start of Brightcove Player -->");
				embed.AppendLine("");
				embed.AppendLine("<div style=\"display:none\"></div>");
				embed.AppendLine("<script language=\"JavaScript\" type=\"text/javascript\" src=\"http://admin.brightcove.com/js/BrightcoveExperiences.js\"></script>");
				embed.AppendLine("<object id=\"" + objectTagID + "\" class=\"BrightcoveExperience\">");
				embed.AppendLine("<param name=\"bgcolor\" value=\"" + BackgroundColor + "\" />");
				embed.AppendLine("<param name=\"width\" value=\"" + player.Width.ToString() + "\" />");
				embed.AppendLine("<param name=\"height\" value=\"" + player.Height.ToString() + "\" />");
				embed.AppendLine("<param name=\"playerID\" value=\"" + player.PlayerID + "\" />");

				//add in video ids or playlist ids
				if (player.PlaylistType.Equals(PlayerPlaylistType.None) && video != null) {
					embed.AppendLine("<param name=\"@videoPlayer\" value=\"" + video.VideoID + "\"/>");
				} else if (player.PlaylistType.Equals(PlayerPlaylistType.Tabbed) && PlaylistIDs != null) {
					embed.AppendLine("<param name=\"@playlistTabs\" value=\"" + PlaylistIDs.ToDelimString(",") + "\"/>");
				} else if (player.PlaylistType.Equals(PlayerPlaylistType.ComboBox) && PlaylistIDs != null) {
					embed.AppendLine("<param name=\"@playlistCombo\" value=\"" + PlaylistIDs.ToDelimString(",") + "\"/>");
				} else if (player.PlaylistType.Equals(PlayerPlaylistType.VideoList) && PlaylistID != -1) {
					embed.AppendLine("<param name=\"@videoList\" value=\"" + PlaylistID.ToString() + "\"/>");
				}

				embed.AppendLine("<param name=\"isVid\" value=\"true\" />");
				embed.AppendLine("<param name=\"autoStart\" value=\"" + AutoStart.ToString().ToLower() + "\" />");
				embed.AppendLine("<param name=\"isUI\" value=\"true\" />");
				embed.AppendLine("<param name=\"dynamicStreaming\" value=\"true\" />");
				embed.AppendLine("<param name=\"wmode\" value=\"" + WMode.ToString() + "\" /> ");
				embed.AppendLine("</object>");
				embed.AppendLine("");
				embed.AppendLine("<!-- End of Brightcove Player -->");
			}
			return embed.ToString();
        }
        protected override void DoRender(HtmlTextWriter output)
        {
            Database      db      = Sitecore.Context.Database;
            StringBuilder sbOut   = new StringBuilder();
            StringBuilder sbError = new StringBuilder();

            //get the player
            long playerid = -1;

            //check to see if the guid is there
            if (long.TryParse(this.Attributes["player"], out playerid))
            {
                //get player obj
                PlayerItem p = PlayerLibraryItem.GetPlayer(playerid);
                if (p != null)
                {
                    //parse wmode
                    WMode wmode = WMode.Window;
                    try {
                        wmode = (WMode)Enum.Parse(wmode.GetType(), this.Attributes["wmode"], true);
                    }catch {}

                    //get background color
                    string bgcolor = this.Attributes["bgcolor"];
                    bgcolor = (string.IsNullOrEmpty(bgcolor)) ? "#ffffff" : bgcolor;
                    if (!bgcolor.StartsWith("#"))
                    {
                        bgcolor = "#" + bgcolor;
                    }

                    string oparams = this.Attributes["oparams"];
                    Dictionary <string, string> objectParams = new Dictionary <string, string>();
                    if (!string.IsNullOrEmpty(oparams))
                    {
                        string[] keys = oparams.Split(',');
                        foreach (string k in keys)
                        {
                            string[] pair = k.Split('=');
                            if (pair.Length > 0)
                            {
                                objectParams.Add(pair[0], pair[1]);
                            }
                        }
                    }

                    //parse autostart
                    bool autostart = false;
                    try {
                        autostart = (this.Attributes["autostart"].Equals("true")) ? true : false;
                    }catch {}

                    //determine which embed code to display
                    if (p.PlaylistType.Equals(PlayerPlaylistType.None))
                    {
                        //get the video id
                        long videoid = -1;
                        if (long.TryParse(this.Attributes["video"], out videoid))
                        {
                            //try parse the id and get the item
                            VideoItem v = VideoLibraryItem.GetVideo(videoid);
                            if (v != null)
                            {
                                sbOut.Append(p.GetEmbedCode(v, bgcolor, autostart, wmode));
                            }
                        }
                    }
                    else if (p.PlaylistType.Equals(PlayerPlaylistType.VideoList))
                    {
                        long videolist = -1;
                        if (long.TryParse(this.Attributes["videolist"], out videolist))
                        {
                            sbOut.Append(p.GetEmbedCode(videolist, bgcolor, autostart, wmode));
                        }
                    }
                    else if (p.PlaylistType.Equals(PlayerPlaylistType.ComboBox) || p.PlaylistType.Equals(PlayerPlaylistType.Tabbed))
                    {
                        List <string> t = new List <string>();
                        //get both the lists and build a string list
                        if (p.PlaylistType.Equals(PlayerPlaylistType.ComboBox))
                        {
                            string combo = (this.Attributes["playlistcombo"] != null) ? this.Attributes["playlistcombo"] : "";
                            t.AddRange(combo.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries));
                        }
                        else if (p.PlaylistType.Equals(PlayerPlaylistType.Tabbed))
                        {
                            string tabs = (this.Attributes["playlisttabs"] != null) ? this.Attributes["playlisttabs"] : "";
                            t.AddRange(tabs.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries));
                        }
                        //convert to a list of long
                        List <long> playlists = new List <long>();
                        foreach (string s in t)
                        {
                            long temp = -1;
                            if (long.TryParse(s, out temp))
                            {
                                playlists.Add(temp);
                            }
                        }
                        //get the embed code
                        sbOut.Append(p.GetEmbedCode(playlists, bgcolor, autostart, wmode, PlayerExtensions.CreateEmbedID(), objectParams));
                    }

                    //Notify the user
                    if (sbOut.Length < 1)
                    {
                        sbError.AppendLine("Player playlist type wasn't selected.");
                    }
                }
                else
                {
                    sbError.AppendLine("Player doesn't exist in Sitecore.");
                }
            }
            else
            {
                sbError.AppendLine("Player value is not a long.");
            }
            //determine if it's an error or not
            if (sbError.Length > 0)
            {
                output.WriteLine("<div style=\"display:none;\">" + sbError.ToString() + "</div>");
            }
            else
            {
                output.WriteLine(sbOut.ToString());
            }
        }
Example #18
0
 public static string GetEmbedCode(this PlayerItem player, List <long> PlaylistIDs, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID, Dictionary <string, string> objectParams)
 {
     return(GetEmbedCode(player, null, -1, PlaylistIDs, BackgroundColor, AutoStart, WMode, objectTagID, objectParams));
 }
 //based on video
 public static string GetComboBoxPlayerEmbedCode(long PlayerID, long VideoID, List <long> PlaylistIDs, int height, int width, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID)
 {
     return(GetEmbedCode(PlayerID, VideoID, PlayerPlaylistType.ComboBox, -1, PlaylistIDs, height, width, BackgroundColor, AutoStart, WMode, objectTagID));
 }
        // Methods
        private void DoProcessRequest(HttpContext context)
        {
            Assert.ArgumentNotNull(context, "context");

            //return DoProcessRequest(context, request, media);
            if (context != null)
            {
                NameValueCollection source = context.Request.QueryString;
                var dict = source.Cast <string>()
                           .Select(s => new { Key = s, Value = source[s] })
                           .ToDictionary(x => x.Key, y => y.Value);

                //player
                long   qPlayer   = 0;
                string playerKey = "player";
                if (dict.ContainsKey(playerKey))
                {
                    long.TryParse(dict[playerKey], out qPlayer);
                    dict.Remove(playerKey);
                }
                PlayerItem p = PlayerLibraryItem.GetPlayer(qPlayer);
                if (p == null)
                {
                    context.Response.Write("The player is null"); return;
                }

                //video
                long   qVideo   = 0;
                string videoKey = "video";
                if (dict.ContainsKey(videoKey))
                {
                    long.TryParse(dict[videoKey], out qVideo);
                    dict.Remove(videoKey);
                }

                //playlist ids
                long        qPlaylist    = 0;
                List <long> qPlaylistIds = new List <long>();
                string      playlistKey  = "playlists";
                if (dict.ContainsKey(playlistKey))
                {
                    string[] playlistids = dict[playlistKey].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    //if you only want a single
                    if (p.PlaylistType.Equals(PlayerPlaylistType.None))
                    {
                        if (playlistids.Any())
                        {
                            long.TryParse(playlistids[0], out qPlaylist);
                        }
                    }
                    else                         //you're looking for multiple
                    {
                        foreach (string id in playlistids)
                        {
                            long plist = -1;
                            if (long.TryParse(id, out plist))
                            {
                                qPlaylistIds.Add(plist);
                            }
                        }
                    }
                    dict.Remove(playlistKey);
                }

                //remove height, width and iframe
                string heightKey = "height", widthKey = "width", iframeKey = "iframe";
                if (dict.ContainsKey(heightKey))
                {
                    dict.Remove(heightKey);
                }
                if (dict.ContainsKey(widthKey))
                {
                    dict.Remove(widthKey);
                }
                if (dict.ContainsKey(iframeKey))
                {
                    dict.Remove(iframeKey);
                }

                //auto start
                bool   qAutoStart   = false;
                string autoStartKey = "autoStart";
                if (dict.ContainsKey(autoStartKey))
                {
                    bool.TryParse(dict[autoStartKey], out qAutoStart);
                    dict.Remove(autoStartKey);
                }

                //bg color
                string bgKey    = "bgcolor";
                string qBgColor = (dict.ContainsKey(bgKey)) ? dict[bgKey] : "";
                if (!qBgColor.Contains("#"))
                {
                    qBgColor = "#" + qBgColor;
                }
                dict.Remove(bgKey);

                //converts oparams to key value pairs
                string paramKey = "oparams";
                string qParams  = string.Empty;
                if (dict.ContainsKey(paramKey))
                {
                    string[] oparams = dict[paramKey].Split(',');
                    foreach (string pair in oparams)
                    {
                        string[] kv = pair.Split('=');
                        if (kv.Length > 1)
                        {
                            dict.Add(kv[0], kv[1]);
                        }
                    }
                    dict.Remove(paramKey);
                }

                //wmode
                string wmodeKey = "wmode";
                WMode  qWMode   = (!dict.ContainsKey(wmodeKey) || string.IsNullOrEmpty(dict[wmodeKey])) ? BrightcoveSDK.WMode.Transparent : (BrightcoveSDK.WMode)Enum.Parse(typeof(BrightcoveSDK.WMode), dict[wmodeKey], true);
                dict.Remove(wmodeKey);

                StringBuilder sb = new StringBuilder();
                sb.AppendLine("<html><head>");
                sb.AppendLine("</head><body>");

                string uniqueID = "video_" + DateTime.Now.ToString("yyyy.MM.dd.HH.mm.ss.FFFF");
                switch (p.PlaylistType)
                {
                case PlayerPlaylistType.VideoList:
                    sb.AppendLine(EmbedCode.GetVideoListPlayerEmbedCode(qPlayer, qPlaylist, p.Height, p.Width, qBgColor, qAutoStart, qWMode, uniqueID, dict));
                    break;

                case PlayerPlaylistType.Tabbed:
                    sb.AppendLine(EmbedCode.GetTabbedPlayerEmbedCode(qPlayer, qPlaylistIds, p.Height, p.Width, qBgColor, qAutoStart, qWMode, uniqueID, dict));
                    break;

                case PlayerPlaylistType.ComboBox:
                    sb.AppendLine(EmbedCode.GetComboBoxPlayerEmbedCode(qPlayer, qPlaylistIds, p.Height, p.Width, qBgColor, qAutoStart, qWMode, uniqueID, dict));
                    break;

                case PlayerPlaylistType.None:
                    sb.AppendLine(EmbedCode.GetVideoPlayerEmbedCode(qPlayer, qVideo, p.Height, p.Width, qBgColor, qAutoStart, qWMode, uniqueID, dict));
                    break;
                }

                sb.AppendLine("</body></html>");
                context.Response.Write(sb.ToString());
            }
            return;
        }
Example #21
0
 /// <summary>
 /// This will build an html object tag based on the information provided
 /// </summary>
 /// <param name="player">The player defined under BrightcoveSDK.SitecoreUtil</param>
 /// <param name="objectTagID">The HTML Object ID Tag</param>
 /// <param name="video">The video defined under BrightcoveSDK.SitecoreUtil</param>
 /// <param name="PlaylistID">A Playlist ID for a single playlist video player</param>
 /// <param name="PlaylistIDs">The List of Playlist IDs for a multi playlist video player</param>
 /// <param name="BackgroundColor">The Hex Value in the form: #ffffff</param>
 /// <param name="AutoStart">A flag to cause the video to automatically start playing</param>
 /// <param name="WMode">The wmode </param>
 /// <param name="objectParams">Specifies any additional object params that should be added</param>
 /// <returns></returns>
 public static string GetEmbedCode(long PlayerID, long VideoID, PlayerPlaylistType PlaylistType, long PlaylistID, List <long> PlaylistIDs, int height, int width, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID)
 {
     return(GetEmbedCode(PlayerID, VideoID, PlaylistType, PlaylistID, PlaylistIDs, height, width, BackgroundColor, AutoStart, WMode, objectTagID, new Dictionary <string, string>()));
 }
        protected override void DoRender(HtmlTextWriter output)
        {
            Database      db      = Sitecore.Context.Database;
            StringBuilder sbOut   = new StringBuilder();
            StringBuilder sbError = new StringBuilder();

            //get the player
            long playerid = -1;

            //check to see if the guid is there
            if (long.TryParse(this.Attributes["player"], out playerid))
            {
                //get player obj
                PlayerItem p = PlayerLibraryItem.GetPlayer(playerid);
                if (p != null)
                {
                    //parse wmode
                    WMode wmode = WMode.Window;
                    try {
                        wmode = (WMode)Enum.Parse(wmode.GetType(), this.Attributes["wmode"], true);
                    }catch {}

                    //get background color
                    string bgcolor = this.Attributes["bgcolor"];
                    bgcolor = (bgcolor == "") ? "#ffffff" : bgcolor;

                    //parse autostart
                    bool autostart = false;
                    try {
                        bool.Parse(this.Attributes["autostart"]);
                    }catch {}

                    //determine which embed code to display
                    if (p.PlaylistType.Equals(PlayerPlaylistType.None))
                    {
                        //get the video id
                        long videoid = -1;
                        if (long.TryParse(this.Attributes["video"], out videoid))
                        {
                            //try parse the id and get the item
                            VideoItem v = VideoLibraryItem.GetVideo(videoid);
                            if (v != null)
                            {
                                sbOut.Append(p.GetEmbedCode(v, bgcolor, autostart, wmode));
                            }
                        }
                    }
                    else if (p.PlaylistType.Equals(PlayerPlaylistType.VideoList))
                    {
                        long videolist = -1;
                        if (long.TryParse(this.Attributes["videolist"], out videolist))
                        {
                            sbOut.Append(p.GetEmbedCode(videolist, bgcolor, autostart, wmode));
                        }
                    }
                    else if (p.PlaylistType.Equals(PlayerPlaylistType.ComboBox) || p.PlaylistType.Equals(PlayerPlaylistType.Tabbed))
                    {
                        //get both the lists and build a string list
                        string        tabs  = this.Attributes["playlisttabs"];
                        string        combo = this.Attributes["playlistcombo"];
                        List <string> t     = tabs.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
                        t.AddRange(combo.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList());

                        //convert to a list of long
                        List <long> playlists = new List <long>();
                        foreach (string s in t)
                        {
                            long temp = -1;
                            if (long.TryParse(s, out temp))
                            {
                                playlists.Add(temp);
                            }
                        }

                        //get the embed code
                        sbOut.Append(p.GetEmbedCode(playlists, bgcolor, autostart, wmode));
                    }

                    //if nothing then just get embed for player with nothing
                    if (sbOut.Length.Equals(0))
                    {
                        sbOut.Append(p.GetEmbedCode(bgcolor, autostart, wmode));
                    }
                }
                else
                {
                    sbError.AppendLine("Player doesn't exist in Sitecore.");
                }
            }
            else
            {
                sbError.AppendLine("Player value is not a long.");
            }
            //determine if it's an error or not
            if (sbError.Length > 0)
            {
                output.WriteLine("<div style=\"display:none;\">" + sbError.ToString() + "</div>");
            }
            else
            {
                output.WriteLine(sbOut.ToString());
            }
        }
        // Methods
        private void DoProcessRequest(HttpContext context)
        {
            Assert.ArgumentNotNull(context, "context");

            //return DoProcessRequest(context, request, media);
            if (context != null)
            {
                NameValueCollection nvc = context.Request.QueryString;

                //player
                long qPlayer = 0;
                if (nvc.HasKey("player"))
                {
                    long.TryParse(nvc.Get("player"), out qPlayer);
                }
                PlayerItem p = PlayerLibraryItem.GetPlayer(qPlayer);
                if (p == null)
                {
                    context.Response.Write("The player is null"); return;
                }

                //video
                long qVideo = 0;
                if (nvc.HasKey("video"))
                {
                    long.TryParse(nvc.Get("video"), out qVideo);
                }

                //playlist ids
                long        qPlaylist    = 0;
                List <long> qPlaylistIds = new List <long>();
                if (nvc.HasKey("playlists"))
                {
                    string[] playlistids = context.Request.QueryString.Get("playlists").Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    //if you only want a single
                    if (p.PlaylistType.Equals(PlayerPlaylistType.None))
                    {
                        if (playlistids.Any())
                        {
                            long.TryParse(playlistids[0], out qPlaylist);
                        }
                    }
                    else                         //you're looking for multiple
                    {
                        foreach (string id in playlistids)
                        {
                            long plist = -1;
                            if (long.TryParse(id, out plist))
                            {
                                qPlaylistIds.Add(plist);
                            }
                        }
                    }
                }

                //auto start
                bool qAutoStart = false;
                if (nvc.HasKey("autoStart"))
                {
                    bool.TryParse(nvc.Get("autoStart"), out qAutoStart);
                }

                //bg color
                string qBgColor = (nvc.HasKey("bgcolor")) ? nvc.Get("bgcolor") : "";

                //wmode
                WMode qWMode = WMode.Transparent;
                if (nvc.HasKey("wmode"))
                {
                    string wmode = nvc.Get("wmode").ToLower();
                    if (wmode.Equals(WMode.Opaque.ToString().ToLower()))
                    {
                        qWMode = WMode.Opaque;
                    }
                    if (wmode.Equals(WMode.Window.ToString().ToLower()))
                    {
                        qWMode = WMode.Window;
                    }
                }

                StringBuilder sb = new StringBuilder();
                sb.AppendLine("<html><head>");
                sb.AppendLine("</head><body>");

                string uniqueID = "video_" + DateTime.Now.ToString("yyyy.MM.dd.HH.mm.ss.FFFF");
                switch (p.PlaylistType)
                {
                case PlayerPlaylistType.VideoList:
                    sb.AppendLine(EmbedCode.GetVideoListPlayerEmbedCode(qPlayer, qVideo, qPlaylist, p.Height, p.Width, qBgColor, qAutoStart, qWMode, uniqueID));
                    break;

                case PlayerPlaylistType.Tabbed:
                    sb.AppendLine(EmbedCode.GetTabbedPlayerEmbedCode(qPlayer, qVideo, qPlaylistIds, p.Height, p.Width, qBgColor, qAutoStart, qWMode, uniqueID));
                    break;

                case PlayerPlaylistType.ComboBox:
                    sb.AppendLine(EmbedCode.GetComboBoxPlayerEmbedCode(qPlayer, qVideo, qPlaylistIds, p.Height, p.Width, qBgColor, qAutoStart, qWMode, uniqueID));
                    break;

                case PlayerPlaylistType.None:
                    sb.AppendLine(EmbedCode.GetVideoPlayerEmbedCode(qPlayer, qVideo, p.Height, p.Width, qBgColor, qAutoStart, qWMode, uniqueID));
                    break;
                }

                sb.AppendLine("</body></html>");
                context.Response.Write(sb.ToString());
            }
            return;
        }
Example #24
0
        /// <summary>
        /// This will build an html object tag based on the information provided
        /// </summary>
        /// <param name="player">The player defined under BrightcoveSDK.SitecoreUtil</param>
        /// <param name="objectTagID">The HTML Object ID Tag</param>
        /// <param name="video">The video defined under BrightcoveSDK.SitecoreUtil</param>
        /// <param name="PlaylistID">A Playlist ID for a single playlist video player</param>
        /// <param name="PlaylistIDs">The List of Playlist IDs for a multi playlist video player</param>
        /// <param name="BackgroundColor">The Hex Value in the form: #ffffff</param>
        /// <param name="AutoStart">A flag to cause the video to automatically start playing</param>
        /// <param name="WMode">The wmode </param>
        /// <returns></returns>
        private static string GetEmbedCode(this PlayerItem player, VideoItem video, long PlaylistID, List <long> PlaylistIDs, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID, Dictionary <string, string> objectParams)
        {
            long videoID = (video != null) ? video.VideoID : -1;

            return(BrightcoveSDK.Utils.EmbedCode.GetEmbedCode(player.PlayerID, videoID, player.PlaylistType, PlaylistID, PlaylistIDs, player.Height, player.Width, BackgroundColor, AutoStart, WMode, objectTagID, objectParams));
        }
Example #25
0
        protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
        {
            // Wire up the onkeypress event handler to the ChangeBackgroundColor() JavaScript function
            Control       c           = Page.FindControl(ControlToManage);
            StringBuilder onClickCall = new StringBuilder();

            //make sure it's the right object
            if (c != null && c.GetType().ToString().Equals("BrightcoveSDK.UI.VideoPlayer"))
            {
                VideoPlayer vp = (VideoPlayer)c;

                //check video id
                if (VideoID.Equals(-1))
                {
                    onClickCall.Append(vp.VideoID);
                }
                else
                {
                    onClickCall.Append(VideoID);
                }
                onClickCall.Append(", ");

                //check for player id
                if (PlayerID.Equals(-1))
                {
                    onClickCall.Append(vp.PlayerID);
                }
                else
                {
                    onClickCall.Append(PlayerID);
                }

                //check for player name
                onClickCall.Append(", '" + vp.PlayerName + "', ");

                //check for auto start
                if (AutoStart.Equals(false))
                {
                    onClickCall.Append(vp.AutoStart.ToString().ToLower());
                }
                else
                {
                    onClickCall.Append(AutoStart.ToString().ToLower());
                }
                onClickCall.Append(", '");

                //check for back color
                if (BackColor.Equals("#000000"))
                {
                    onClickCall.Append(vp.BackColor);
                }
                else
                {
                    onClickCall.Append(BackColor);
                }
                onClickCall.Append("', ");

                //check for width
                if (Width.Equals(0))
                {
                    onClickCall.Append(vp.Width.ToString());
                }
                else
                {
                    onClickCall.Append(Width.ToString());
                }
                onClickCall.Append(", ");

                //check for Height
                if (Height.Equals(0))
                {
                    onClickCall.Append(vp.Height.ToString());
                }
                else
                {
                    onClickCall.Append(Height.ToString());
                }
                onClickCall.Append(", ");

                //check for IsVid
                if (IsVid.Equals(true))
                {
                    onClickCall.Append(vp.IsVid.ToString().ToLower());
                }
                else
                {
                    onClickCall.Append(IsVid.ToString().ToLower());
                }
                onClickCall.Append(", '");

                //check for WMode
                if (WMode.Equals(""))
                {
                    onClickCall.Append(vp.WMode);
                }
                else
                {
                    onClickCall.Append(WMode);
                }

                //append for ClientID
                onClickCall.Append("', '" + vp.ClientID + "', '" + PlaylistTabString + "', '" + PlaylistComboString + "', '" + VideoList.ToString() + "'");

                writer.AddAttribute("onclick", "javascript:addPlayer(" + onClickCall.ToString() + ");return false;");

                base.AddAttributesToRender(writer);
            }
            else
            {
                StringBuilder error = new StringBuilder();
                error.Append("The ControlToManage must be specified or point to a valid VideoPlayer.");

                if (c == null)
                {
                    error.Append("\n The ControlToManage was null.");
                }
                else if (!c.GetType().ToString().Equals("BrightcoveSDK.UI.VideoPlayer"))
                {
                    error.Append("\n The ControlToManage type was " + c.GetType().ToString() + ".");
                }
                throw new ArgumentException(error.ToString());
            }
        }
 public static string GetEmbedCode(this PlayerItem player, VideoItem video, string BackgroundColor, bool AutoStart, WMode WMode)
 {
     return(GetEmbedCode(player, video, BackgroundColor, AutoStart, WMode, CreateEmbedID()));
 }
Example #27
0
		/// <summary>
		/// This will build an html object tag based on the information provided
		/// </summary>
		/// <param name="player">The player defined under BrightcoveSDK.SitecoreUtil</param>
		/// <param name="objectTagID">The HTML Object ID Tag</param>
		/// <param name="video">The video defined under BrightcoveSDK.SitecoreUtil</param>
		/// <param name="PlaylistID">A Playlist ID for a single playlist video player</param>
		/// <param name="PlaylistIDs">The List of Playlist IDs for a multi playlist video player</param>
		/// <param name="BackgroundColor">The Hex Value in the form: #ffffff</param>
		/// <param name="AutoStart">A flag to cause the video to automatically start playing</param>
		/// <param name="WMode">The wmode </param>
		/// <returns></returns>
		private static string GetEmbedCode(this PlayerItem player, VideoItem video, long PlaylistID, List<long> PlaylistIDs, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID, Dictionary<string, string> objectParams) {
			long videoID = (video != null) ? video.VideoID : -1;
			return BrightcoveSDK.Utils.EmbedCode.GetEmbedCode(player.PlayerID, videoID, player.PlaylistType, PlaylistID, PlaylistIDs, player.Height, player.Width, BackgroundColor, AutoStart, WMode, objectTagID, objectParams);
        }
 public static string GetEmbedCode(this PlayerItem player, VideoItem video, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID)
 {
     return(GetEmbedCode(player, video, -1, null, BackgroundColor, AutoStart, WMode, objectTagID));
 }
Example #29
0
		public static string GetEmbedCode(this PlayerItem player, long PlaylistID, string BackgroundColor, bool AutoStart, WMode WMode) {
			return GetEmbedCode(player, PlaylistID, BackgroundColor, AutoStart, WMode, CreateEmbedID());
		}
        /// <summary>
        /// This will build an html object tag based on the information provided
        /// </summary>
        /// <param name="player">The player defined under BrightcoveSDK.SitecoreUtil</param>
        /// <param name="objectTagID">The HTML Object ID Tag</param>
        /// <param name="video">The video defined under BrightcoveSDK.SitecoreUtil</param>
        /// <param name="PlaylistID">A Playlist ID for a single playlist video player</param>
        /// <param name="PlaylistIDs">The List of Playlist IDs for a multi playlist video player</param>
        /// <param name="BackgroundColor">The Hex Value in the form: #ffffff</param>
        /// <param name="AutoStart">A flag to cause the video to automatically start playing</param>
        /// <param name="WMode">The wmode </param>
        /// <returns></returns>
        private static string GetEmbedCode(this PlayerItem player, VideoItem video, long PlaylistID, List <long> PlaylistIDs, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID)
        {
            StringBuilder embed = new StringBuilder();

            if (player != null)
            {
                //this one works
                embed.AppendLine("<!-- Start of Brightcove Player -->");
                embed.AppendLine("");
                embed.AppendLine("<div style=\"display:none\"></div>");
                embed.AppendLine("<script language=\"JavaScript\" type=\"text/javascript\" src=\"http://admin.brightcove.com/js/BrightcoveExperiences.js\"></script>");
                embed.AppendLine("<object id=\"" + objectTagID + "\" class=\"BrightcoveExperience\">");
                embed.AppendLine("<param name=\"bgcolor\" value=\"" + BackgroundColor + "\" />");
                embed.AppendLine("<param name=\"width\" value=\"" + player.Width.ToString() + "\" />");
                embed.AppendLine("<param name=\"height\" value=\"" + player.Height.ToString() + "\" />");
                embed.AppendLine("<param name=\"playerID\" value=\"" + player.PlayerID + "\" />");

                //add in video ids or playlist ids
                if (player.PlaylistType.Equals(PlayerPlaylistType.None) && video != null)
                {
                    embed.AppendLine("<param name=\"@videoPlayer\" value=\"" + video.VideoID + "\"/>");
                }
                else if (player.PlaylistType.Equals(PlayerPlaylistType.Tabbed) && PlaylistIDs != null)
                {
                    embed.AppendLine("<param name=\"@playlistTabs\" value=\"" + PlaylistIDs.ToDelimString(",") + "\"/>");
                }
                else if (player.PlaylistType.Equals(PlayerPlaylistType.ComboBox) && PlaylistIDs != null)
                {
                    embed.AppendLine("<param name=\"@playlistCombo\" value=\"" + PlaylistIDs.ToDelimString(",") + "\"/>");
                }
                else if (player.PlaylistType.Equals(PlayerPlaylistType.VideoList) && PlaylistID != -1)
                {
                    embed.AppendLine("<param name=\"@videoList\" value=\"" + PlaylistID.ToString() + "\"/>");
                }

                embed.AppendLine("<param name=\"isVid\" value=\"true\" />");
                embed.AppendLine("<param name=\"autoStart\" value=\"" + AutoStart.ToString().ToLower() + "\" />");
                embed.AppendLine("<param name=\"isUI\" value=\"true\" />");
                embed.AppendLine("<param name=\"dynamicStreaming\" value=\"true\" />");
                embed.AppendLine("<param name=\"wmode\" value=\"" + WMode.ToString() + "\" /> ");
                embed.AppendLine("</object>");
                embed.AppendLine("");
                embed.AppendLine("<!-- End of Brightcove Player -->");
            }
            return(embed.ToString());
        }
Example #31
0
		public static string GetEmbedCode(this PlayerItem player, VideoItem video, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID) {
			return GetEmbedCode(player, video, BackgroundColor, AutoStart, WMode, objectTagID, new Dictionary<string, string>());
		}
 public static string GetEmbedCode(this PlayerItem player, long PlaylistID, string BackgroundColor, bool AutoStart, WMode WMode)
 {
     return(GetEmbedCode(player, PlaylistID, BackgroundColor, AutoStart, WMode, CreateEmbedID()));
 }
Example #33
0
		public static string GetVideoListPlayerEmbedCode(long PlayerID, long PlaylistID, int height, int width, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID, Dictionary<string, string> nvc) {
			return GetEmbedCode(PlayerID, -1, PlayerPlaylistType.VideoList, PlaylistID, null, height, width, BackgroundColor, AutoStart, WMode, objectTagID, nvc);
		}
 public static string GetEmbedCode(this PlayerItem player, long PlaylistID, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID)
 {
     return(GetEmbedCode(player, null, PlaylistID, null, BackgroundColor, AutoStart, WMode, objectTagID));
 }
Example #35
0
		/// <summary>
		/// This will build an html object tag based on the information provided
		/// </summary>
		/// <param name="player">The player defined under BrightcoveSDK.SitecoreUtil</param>
		/// <param name="objectTagID">The HTML Object ID Tag</param>
		/// <param name="video">The video defined under BrightcoveSDK.SitecoreUtil</param>
		/// <param name="PlaylistID">A Playlist ID for a single playlist video player</param>
		/// <param name="PlaylistIDs">The List of Playlist IDs for a multi playlist video player</param>
		/// <param name="BackgroundColor">The Hex Value in the form: #ffffff</param>
		/// <param name="AutoStart">A flag to cause the video to automatically start playing</param>
		/// <param name="WMode">The wmode </param>
		/// <param name="objectParams">Specifies any additional object params that should be added</param>
		/// <returns></returns>
		public static string GetEmbedCode(long PlayerID, long VideoID, PlayerPlaylistType PlaylistType, long PlaylistID, List<long> PlaylistIDs, int height, int width, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID) {
			return GetEmbedCode(PlayerID, VideoID, PlaylistType, PlaylistID, PlaylistIDs, height, width, BackgroundColor, AutoStart, WMode, objectTagID, new Dictionary<string, string>());
		}
Example #36
0
 public static string GetVideoPlayerEmbedCode(long PlayerID, long VideoID, int height, int width, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID, Dictionary <string, string> nvc)
 {
     return(GetEmbedCode(PlayerID, VideoID, PlayerPlaylistType.None, -1, null, height, width, BackgroundColor, AutoStart, WMode, objectTagID, nvc));
 }
 //based on single playlist
 public static string GetVideoListPlayerEmbedCode(long PlayerID, long VideoID, long PlaylistID, int height, int width, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID)
 {
     return(GetEmbedCode(PlayerID, VideoID, PlayerPlaylistType.VideoList, PlaylistID, null, height, width, BackgroundColor, AutoStart, WMode, objectTagID));
 }
Example #38
0
 public static string GetTabbedPlayerEmbedCode(long PlayerID, List <long> PlaylistIDs, int height, int width, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID, Dictionary <string, string> nvc)
 {
     return(GetEmbedCode(PlayerID, -1, PlayerPlaylistType.Tabbed, -1, PlaylistIDs, height, width, BackgroundColor, AutoStart, WMode, objectTagID, nvc));
 }
        /// <summary>
        /// This will build an html object tag based on the information provided
        /// </summary>
        /// <param name="player">The player defined under BrightcoveSDK.SitecoreUtil</param>
        /// <param name="objectTagID">The HTML Object ID Tag</param>
        /// <param name="video">The video defined under BrightcoveSDK.SitecoreUtil</param>
        /// <param name="PlaylistID">A Playlist ID for a single playlist video player</param>
        /// <param name="PlaylistIDs">The List of Playlist IDs for a multi playlist video player</param>
        /// <param name="BackgroundColor">The Hex Value in the form: #ffffff</param>
        /// <param name="AutoStart">A flag to cause the video to automatically start playing</param>
        /// <param name="WMode">The wmode </param>
        /// <returns></returns>
        private static string GetEmbedCode(long PlayerID, long VideoID, PlayerPlaylistType PlaylistType, long PlaylistID, List <long> PlaylistIDs, int height, int width, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID)
        {
            StringBuilder embed = new StringBuilder();

            if (PlayerID != null)
            {
                //this one works
                embed.AppendLine("<!-- Start of Brightcove Player -->");
                embed.AppendLine("<div style=\"display:none\"></div>");
                embed.AppendLine("<!-- By use of this code snippet, I agree to the Brightcove Publisher T and C found at https://accounts.brightcove.com/en/terms-and-conditions/. -->");
                embed.AppendLine("<script language=\"JavaScript\" type=\"text/javascript\" src=\"http://admin.brightcove.com/js/BrightcoveExperiences.js\"></script>");
                embed.AppendLine("<object id=\"" + objectTagID + "\" class=\"BrightcoveExperience\">");
                embed.AppendLine("<param name=\"bgcolor\" value=\"" + BackgroundColor + "\" />");
                embed.AppendLine("<param name=\"width\" value=\"" + width.ToString() + "\" />");
                embed.AppendLine("<param name=\"height\" value=\"" + height.ToString() + "\" />");
                embed.AppendLine("<param name=\"playerID\" value=\"" + PlayerID + "\" />");

                //add in video ids or playlist ids
                if (PlaylistType.Equals(PlayerPlaylistType.None) && VideoID != null)
                {
                    embed.AppendLine("<param name=\"@videoPlayer\" value=\"" + VideoID + "\"/>");
                }
                else if (PlaylistType.Equals(PlayerPlaylistType.Tabbed) && PlaylistIDs != null)
                {
                    embed.AppendLine("<param name=\"@playlistTabs\" value=\"" + PlaylistIDs.ToDelimString(",") + "\"/>");
                }
                else if (PlaylistType.Equals(PlayerPlaylistType.ComboBox) && PlaylistIDs != null)
                {
                    embed.AppendLine("<param name=\"@playlistCombo\" value=\"" + PlaylistIDs.ToDelimString(",") + "\"/>");
                }
                else if (PlaylistType.Equals(PlayerPlaylistType.VideoList) && PlaylistID != -1)
                {
                    embed.AppendLine("<param name=\"@videoList\" value=\"" + PlaylistID.ToString() + "\"/>");
                }

                embed.AppendLine("<param name=\"isVid\" value=\"true\" />");
                embed.AppendLine("<param name=\"autoStart\" value=\"" + AutoStart.ToString().ToLower() + "\" />");
                embed.AppendLine("<param name=\"isUI\" value=\"true\" />");
                embed.AppendLine("<param name=\"dynamicStreaming\" value=\"true\" />");
                embed.AppendLine("<param name=\"wmode\" value=\"" + WMode.ToString() + "\" /> ");
                embed.AppendLine("</object>");
                embed.AppendLine("<script type=\"text/javascript\">brightcove.createExperiences();</script>");
                embed.AppendLine("<!-- End of Brightcove Player -->");
            }
            return(embed.ToString());
        }
Example #40
0
		//based on just player
		public static string GetVideoPlayerEmbedCode(long PlayerID, long VideoID, int height, int width, string BackgroundColor, bool AutoStart, WMode WMode, string objectTagID) {
			return GetEmbedCode(PlayerID, VideoID, PlayerPlaylistType.None, -1, null, height, width, BackgroundColor, AutoStart, WMode, objectTagID);
		}