Exemplo n.º 1
0
        private void load(IBindable <WorkingBeatmap> beatmap, TextureStore textureStore)
        {
            var path = beatmap.Value.BeatmapSetInfo?.Files?.Find(f => f.Filename.Equals(Video.Path, StringComparison.OrdinalIgnoreCase))?.FileInfo.StoragePath;

            if (path == null)
            {
                return;
            }

            var stream = textureStore.GetStream(path);

            if (stream == null)
            {
                return;
            }

            InternalChild = videoSprite = new VideoSprite(stream, false)
            {
                RelativeSizeAxes = Axes.Both,
                FillMode         = FillMode.Fill,
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre,
                Alpha            = 0,
                Clock            = new FramedOffsetClock(Clock)
                {
                    Offset = -Video.StartTime
                }
            };
        }
Exemplo n.º 2
0
        private async void loadVideo()
        {
            var wr = new WebRequest("https://assets.ppy.sh/media/landing.mp4");
            await wr.PerformAsync();

            Schedule(() =>
            {
                Clear();

                videoSprite = new VideoSprite(wr.ResponseStream);
                Add(videoSprite);
                videoSprite.Loop = false;

                clock             = new ManualClock();
                videoSprite.Clock = new FramedClock(clock);

                Add(timeText = new TextFlowContainer {
                    AutoSizeAxes = Axes.Both
                });

                AddStep("Jump ahead by 10 seconds", () => clock.CurrentTime += 10_000.0);
                AddStep("Jump back by 10 seconds", () => clock.CurrentTime   = Math.Max(0, clock.CurrentTime - 10_000.0));
                AddToggleStep("Toggle looping", newState =>
                {
                    videoSprite.Loop  = newState;
                    clock.CurrentTime = 0;
                });
            });
        }
        private async void loadVideo()
        {
            var wr = new WebRequest("https://assets.ppy.sh/media/landing.mp4");
            await wr.PerformAsync();

            Schedule(() =>
            {
                Clear();

                videoSprite = new VideoSprite(wr.ResponseStream);
                Add(videoSprite);
                videoSprite.Loop = false;

                clock             = new ManualClock();
                videoSprite.Clock = new FramedClock(clock);

                Add(timeText = new SpriteText
                {
                    Font = new FontUsage("RobotoCondensed", weight: "Regular", fixedWidth: true)
                });

                AddStep("Jump ahead by 10 seconds", () => clock.CurrentTime += 10_000.0);
                AddStep("Jump back by 10 seconds", () => clock.CurrentTime   = Math.Max(0, clock.CurrentTime - 10_000.0));
                AddToggleStep("Toggle looping", newState =>
                {
                    videoSprite.Loop  = newState;
                    clock.CurrentTime = 0;
                });
            });
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates and initializes the video player sample screen.
        /// </summary>
        /// <param name="spriteBatch">The <see cref="SpriteBatch"/> to render to.</param>
        public VideoPlayerScreen(SpriteBatch spriteBatch)
            : base(spriteBatch, Color.DarkGray)
        {
            Name = "VideoPlayer";

            //Reduces the ARGB values, then resets alpha to 255
            ClearColor  *= 1f / 6f;
            ClearColor.A = 255;

            //See MainMenu for TextSprite sample comments
            title          = new TextSprite(spriteBatch, GLibXNASampleGame.Instance.Content.Load <SpriteFont>("Title"), "VideoPlayer Sample", Color.PaleGoldenrod);
            title.Position = new Vector2(title.GetCenterPosition(spriteBatch.GraphicsDevice.Viewport).X, 15);
            AdditionalSprites.Add(title);

            escapeReturnDesc          = new TextSprite(spriteBatch, GLibXNASampleGame.Instance.Content.Load <SpriteFont>("Details"), "Press escape\nto return to\nthe main menu", Color.PaleGoldenrod);
            escapeReturnDesc.Position = new Vector2(3);
            AdditionalSprites.Add(escapeReturnDesc);

            //This event is fired when a key is pressed
            KeyboardManager.KeyDown += new SingleKeyEventHandler(KeyboardManager_KeyDown);

            creditTextSprite          = new TextSprite(spriteBatch, GLibXNASampleGame.Instance.Content.Load <SpriteFont>("Details"), "Video obtained from nps.gov/cany/planyourvisit/rivervideos.htm", Color.Goldenrod);
            creditTextSprite.Color.A  = 32;
            creditTextSprite.Position = new Vector2(creditTextSprite.GetCenterPosition(spriteBatch.GraphicsDevice.Viewport).X, spriteBatch.GraphicsDevice.Viewport.Height - creditTextSprite.Height - 5);
            AdditionalSprites.Add(creditTextSprite);

            //VideoSprite: Like a sprite, but displays a video
            video = new VideoSprite(GLibXNASampleGame.Instance.Content.Load <Video>("VideoSample"), Vector2.Zero, spriteBatch);
            video.Video.Stop();
            video.Position = video.GetCenterPosition(spriteBatch.GraphicsDevice.Viewport);
            Sprites.Add(video);
        }
Exemplo n.º 5
0
 private void load()
 {
     InternalChild = new VideoSprite(videoStream, false)
     {
         RelativeSizeAxes = Axes.Both,
         Clock = new FramedOffsetClock(Clock) { Offset = -logo_1 }
     };
 }
Exemplo n.º 6
0
                public LazerLogo(Stream videoStream)
                {
                    Size = new Vector2(960);

                    InternalChild = new VideoSprite(videoStream)
                    {
                        RelativeSizeAxes = Axes.Both,
                        Clock            = new FramedOffsetClock(Clock)
                        {
                            Offset = -logo_1
                        }
                    };
                }
Exemplo n.º 7
0
        private async void loadVideo()
        {
            var wr = new WebRequest("https://assets.ppy.sh/media/landing.mp4");
            await wr.PerformAsync();

            Schedule(() =>
            {
                Add(videoSprite = new VideoSprite(wr.ResponseStream, false)
                {
                    Loop  = false,
                    Clock = new FramedClock(clock = new ManualClock()),
                });

                timeText.Font = FrameworkFont.Condensed.With(fixedWidth: true);
            });
        }
 public TourneyVideo(Stream stream)
 {
     if (stream == null)
     {
         InternalChild = new Box
         {
             Colour           = ColourInfo.GradientVertical(OsuColour.Gray(0.3f), OsuColour.Gray(0.6f)),
             RelativeSizeAxes = Axes.Both,
         };
     }
     else
     {
         InternalChild = video = new VideoSprite(stream)
         {
             RelativeSizeAxes = Axes.Both,
             FillMode         = FillMode.Fit,
         }
     };
 }
            public DrawableVideo(VideoSprite video)
            {
                RelativeSizeAxes = Axes.Both;
                Masking          = true;

                video.RelativeSizeAxes = Axes.Both;
                video.FillMode         = FillMode.Fit;
                video.Anchor           = Anchor.Centre;
                video.Origin           = Anchor.Centre;

                AddRangeInternal(new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = Color4.Black,
                    },
                    video,
                });
            }
Exemplo n.º 10
0
        private void load(Storage storage)
        {
            var stream = storage.GetStream($@"videos/{filename}.m4v");

            if (stream != null)
            {
                InternalChild = video = new VideoSprite(stream)
                {
                    RelativeSizeAxes = Axes.Both,
                    FillMode         = FillMode.Fit,
                    Clock            = new FramedClock(manualClock = new ManualClock())
                };
            }
            else if (drawFallbackGradient)
            {
                InternalChild = new Box
                {
                    Colour           = ColourInfo.GradientVertical(OsuColour.Gray(0.3f), OsuColour.Gray(0.6f)),
                    RelativeSizeAxes = Axes.Both,
                };
            }
        }
Exemplo n.º 11
0
 public DimmableVideo(VideoSprite video)
 {
     this.video = video;
 }