Ejemplo n.º 1
0
        protected virtual void InitPlayersList(Item item)
        {
            IPlayerMarkupGenerator generator = MediaFrameworkContext.GetPlayerMarkupGenerator(item);

            if (generator == null)
            {
                return;
            }

            Item account = AccountManager.GetAccountItemForDescendant(item);

            if (account == null)
            {
                return;
            }

            var players = AccountManager.GetPlayers(account);

            this.PlayersList.Controls.Clear();
            foreach (var playerItem in players)
            {
                this.PlayersList.Controls.Add(new ListItem
                {
                    ID       = Control.GetUniqueID("ListItem"),
                    Selected = this.PlayerId == playerItem.ID.ToShortID(),
                    Header   = playerItem.DisplayName,
                    Value    = playerItem.ID.ToShortID().ToString()
                });
            }
            Context.ClientPage.ClientResponse.Refresh(this.PlayersList);
        }
        public virtual IPlayerMarkupGenerator GetPlayerMarkupGenerator(Item mediaItem)
        {
            Assert.ArgumentNotNull(mediaItem, "mediaItem");

            IPlayerMarkupGenerator generator = MediaFrameworkContext.GetPlayerMarkupGenerator(mediaItem);

            if (generator == null)
            {
                LogHelper.Warn("Player markup generator could not be resolved. MediaItem:" + mediaItem.Uri, this);
            }
            return(generator);
        }
        /// <summary>
        /// Processes determining the markup generator.
        /// </summary>
        /// <param name="args">
        /// The args.
        /// </param>
        public override void Process(MediaGenerateMarkupArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.ArgumentNotNull(args.MediaItem, "args.MediaItem");

            IPlayerMarkupGenerator generator = MediaFrameworkContext.GetPlayerMarkupGenerator(args.MediaItem.TemplateID);

            if (generator != null)
            {
                args.Generator = generator;

                if (args.MarkupType == MarkupType.Html)
                {
                    args.Properties.MediaId = args.Generator.GetMediaId(args.MediaItem);
                }
            }
            else
            {
                LogHelper.Warn("Player markup generator couldn't be determine for player. Player markup generation will be stopped.", this);

                args.AbortPipeline();
            }
        }