Esempio n. 1
0
        private void OnPlayerUpdateReceived(object sender, PlayerUpdateReceivedEventArgs eventArgs)
        {
            MultimediaItem multimedia       = eventArgs.Multimedia;
            int            playbackPosition = eventArgs.PlaybackPosition;
            bool           playing          = eventArgs.Playing;

            ProcessPlayerUpdate(multimedia, playbackPosition, playing);
        }
Esempio n. 2
0
        public ServerPlayerShadow(IServerInterface serverInterface, IMessageQueue messageQueue)
        {
            this.serverInterface = serverInterface;
            this.messageQueue    = messageQueue;

            this.playing          = false;
            this.activeMultimedia = null;
            this.playbackPosition = 0;

            this.stateChecker = new PeriodicWorkDispatcher(messageQueue, 5000, UpdatePlayer);
        }
Esempio n. 3
0
        private void ProcessPlayerUpdate(MultimediaItem multimedia, int playbackPosition, bool playing)
        {
            lastUpdateTimestamp = Environment.TickCount;

            this.activeMultimedia = multimedia;
            this.playing          = playing;
            this.playbackPosition = playbackPosition;

            PlayerStateChangedEventArgs playerStateEventArgs = new PlayerStateChangedEventArgs(multimedia, playbackPosition, playing);

            messageQueue.Post(() => PlayerStateChanged(this, playerStateEventArgs));
        }
Esempio n. 4
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (!(obj is MultimediaItem))
            {
                return(false);
            }

            MultimediaItem multimedia = (MultimediaItem)obj;

            return(Equals(multimedia));
        }
Esempio n. 5
0
        private void OnAddingLibraryItemToPlaylistResult(object sender, AddingLibraryItemToPlaylistResultEventArgs eventArgs)
        {
            bool           success    = eventArgs.Result;
            MultimediaItem multimedia = eventArgs.Multimedia;

            if (actualPlaylist.Count <= 1)
            {
                return;
            }

            IList <MultimediaItem> newPlaylist = new List <MultimediaItem>(actualPlaylist);

            newPlaylist.Add(multimedia);

            UpdatePlaylist(newPlaylist);

            ItemAddedEventArgs itemAddedEventArgs = new ItemAddedEventArgs(success, multimedia);

            messageQueue.Post(() => ItemAdded(this, itemAddedEventArgs));
        }
Esempio n. 6
0
 public bool Equals(MultimediaItem multimedia)
 {
     return(multimedia.id == this.id);
 }
Esempio n. 7
0
 public MultimediaItem(MultimediaItem multimedia)
 {
     this.id     = multimedia.id;
     this.name   = multimedia.name;
     this.length = multimedia.length;
 }