Ejemplo n.º 1
0
        protected void ResetPlayerEvents_NoLock(IPlayer player)
        {
            IPlayerEvents   pe = player as IPlayerEvents;
            IReusablePlayer rp = player as IReusablePlayer;

            if (pe != null)
            {
                try
                {
                    pe.ResetPlayerEvents();
                }
                catch (Exception e)
                {
                    ServiceRegistration.Get <ILogger>().Warn("PlayerSlotController: Error resetting player events in player '{0}'", e, pe);
                }
            }
            if (rp != null)
            {
                try
                {
                    rp.NextItemRequest -= OnNextItemRequest;
                }
                catch (Exception e)
                {
                    ServiceRegistration.Get <ILogger>().Warn("PlayerSlotController: Error resetting player NextItemRequest event in player '{0}'", e, rp);
                }
            }
        }
Ejemplo n.º 2
0
        protected void RegisterPlayerEvents_NoLock(IPlayer player)
        {
            IPlayerEvents   pe = player as IPlayerEvents;
            IReusablePlayer rp = player as IReusablePlayer;

            if (pe != null)
            {
                try
                {
                    pe.InitializePlayerEvents(OnPlayerStarted, OnPlayerStateReady, OnPlayerStopped, OnPlayerEnded,
                                              OnPlaybackStateChanged, OnPlaybackError);
                }
                catch (Exception e)
                {
                    ServiceRegistration.Get <ILogger>().Warn("PlayerSlotController: Error initializing player events in player '{0}'", e, pe);
                }
            }
            if (rp != null)
            {
                try
                {
                    rp.NextItemRequest += OnNextItemRequest;
                }
                catch (Exception e)
                {
                    ServiceRegistration.Get <ILogger>().Warn("PlayerSlotController: Error initializing player NextItemRequest event in player '{0}'", e, rp);
                }
            }
        }