Beispiel #1
0
 private double computeMediaTime(Media m)
 {
     double elapsed = this._stopWatch.Elapsed.Seconds;
     double mediaDuration = m.Duration;
     double time = elapsed % mediaDuration;
     return time;
 }
Beispiel #2
0
 /// <summary>
 /// Talks to server and updates current channels
 /// </summary>
 private void updateChannelListings()
 {
     // generate fake media
     Media m1 = new Media(1, 4 * 60 + 40, 0, "test", "Video\\pixar_short.avi");
     Media m2 = new Media(1, 2 * 60 + 9, 15, "test", "Video\\batman.avi");
     Media m3 = new Media(1, 2 * 60 + 32, 0, "test", "Video\\spiderman.avi");
     Media m4 = new Media(1, 2 * 60 * 30, 0, "test", "Video\\hobbit.avi");
     Channel c1 = new Channel(0, "channel 1", m1);
     Channel c2 = new Channel(0, "channel 2", m2);
     Channel c3 = new Channel(0, "channel 3", m3);
     Channel c4 = new Channel(0, "channel 4", m4);
     this._channels.Clear();
     this._channels.Add(c1);
     this._channels.Add(c2);
     this._channels.Add(c3);
     this._channels.Add(c4);
     for (int i = 0; i < this._channels.Count; i++)
     {
         Channel c = this._channels[i];
         if (i == this._cachedMediaIndex)
         {
             c.Media.CurrentTime = this._cachedMedia.CurrentTime;
         }
         else
         {
             c.Media.CurrentTime = this.computeMediaTime(c.Media);
         }
     }
 }
Beispiel #3
0
 /// <summary>
 ///  pauses the media and media element
 ///  WARNING: PAUSING A CHANNEL INSTANTLY TURNS THAT INTO THE CACHE
 /// </summary>
 public Boolean pause(ScreenController.PauseReason pr)
 {
     if (!this.IsPaused)
     {
         this.IsPaused = true;
         double position = this._screenController.pause(pr);
         Channel curChannel = this.getCurrentChannel();
         this._cachedMedia = curChannel.Media;
         this._cachedMedia.CurrentTime = position;
         this._cachedMediaIndex = this._currentChannelIndex;
         // fade off the pause button
         return true;
     }
     else
     {
         return false;
     }
 }
Beispiel #4
0
        public Boolean turnOff()
        {
            if (this.IsOn)
            {
                this._stopWatch.Stop();

                Channel curChannel = this.getCurrentChannel();
                this._cachedMedia = curChannel.Media;
                this._cachedMedia.CurrentTime = this._screenController.getCurrentMediaPosition();
                this._cachedMediaIndex = this._currentChannelIndex;
                this._isOn = false;
                this.IsPaused = true;
                this._screenController.turnOff();
                return true;
            }
            else
            {
                return false;
            }
        }
Beispiel #5
0
        private void moveMedia(Media media, Boolean isLeft)
        {
            this._currentMediaElement.Pause();
            this._currentMediaElement.Source = media.FileUri;
            this._currentMediaElement.Volume = this._currentMediaElement.Volume;
            this._currentMediaElement.Play();
            this._currentMediaElement.Position = TimeSpan.FromSeconds(media.CurrentTime);

            /*
            if (this._cornerIcon.Opacity > 0)
            {
                this._cornerIcon.Opacity = 0.0;
                this._centerIcon.Source = this.generateImage(ScreenController.PLAY_FILE);
                this._centerIcon.BeginAnimation(Canvas.OpacityProperty, this.generateDoubleAnimation(1.0, 0, ScreenController.PLAY_FADE_IN_DURATION));
            }

            this._currentMediaElement.Pause();
            double currentPosition = this._currentMediaElement.Position.Seconds;
            this._currentMedia.CurrentTime = currentPosition;

            this._onPointMediaElement.Source = media.FileUri;
            this._onPointMediaElement.Volume = this._currentMediaElement.Volume;
            this._onPointMediaElement.Play();
            this._onPointMediaElement.Position = TimeSpan.FromSeconds(media.CurrentTime);

            this._currentContainer.Opacity = 1.0;
            this._onPointContainer.Opacity = 1.0;

            DoubleAnimation curAnimation = this.generateDoubleAnimation(this.screenX, this.screenX + this.screenWidth, ScreenController.SCREEN_CHANGE_DURATION);
            DoubleAnimation onPointAnimation = this.generateDoubleAnimation(this.screenX - this.screenWidth, this.screenX, ScreenController.SCREEN_CHANGE_DURATION);
            if (isLeft)
            {
                curAnimation = this.generateDoubleAnimation(this.screenX, this.screenX - this.screenWidth, ScreenController.SCREEN_CHANGE_DURATION);
                onPointAnimation = this.generateDoubleAnimation(this.screenX + this.screenWidth, this.screenX, ScreenController.SCREEN_CHANGE_DURATION);
            }
            this._currentContainer.BeginAnimation(Canvas.LeftProperty, curAnimation);
            this._onPointContainer.BeginAnimation(Canvas.LeftProperty, onPointAnimation);
            Canvas tempContainer = this._currentContainer;
            MediaElement tempMediaElement = this._currentMediaElement;

            this._currentContainer = this._onPointContainer;
            this._currentMediaElement = this._onPointMediaElement;
            this._currentMedia = media;

            this._onPointContainer = tempContainer;
            this._onPointMediaElement = tempMediaElement;*/
        }
Beispiel #6
0
 public void turnOn(Media m)
 {
     this.CurrentMedia = m;
     this._currentMediaElement.Source = this._currentMedia.FileUri;
     this._currentMediaElement.Play();
     this._cornerIcon.Opacity = 0;
     this._currentMediaElement.Position = TimeSpan.FromSeconds(this._currentMedia.CurrentTime);
     double startOpacity = this._currentContainer.Opacity;
     this._currentContainer.BeginAnimation(Canvas.OpacityProperty, this.generateDoubleAnimation(startOpacity, 1, ScreenController.FADE_IN_DURATION));
 }
Beispiel #7
0
 public void moveMediaToRight(Media media)
 {
     this.moveMedia(media, false);
 }
Beispiel #8
0
 public void moveMediaToLeft(Media media)
 {
     this.moveMedia(media, true);
 }
Beispiel #9
0
 public Channel(int id, String name, Media media)
 {
     this._id = id;
     this._name = name;
     this._media = media;
 }