Странная ошибка при воспроизведении видео в Monogame с XNA - PullRequest
0 голосов
/ 06 апреля 2019

Я пытаюсь воспроизвести видео в одноигровом проекте.Я сделал все, что касается учебного пособия, и загрузил содержание видео, но я получаю ошибку

Ошибка Importer 'WmvImporter' произошла непредвиденная ошибка!PlayVideo C: / Пользователи / berka / Рабочий стол / Разработка игр / PlayVideo / PlayVideo / Содержимое / nature.wmv

Ошибка Команда "" C: \ Program Files (x86) \ MSBuild \ MonoGame \ v3.0 \Сервис \ MGCB.exe "/ quiet / платформа: Windows / @:" C: \ Users \ berka \ Рабочий стол \ Разработка игр \ PlayVideo \ PlayVideo \ Content \ Content.mgcb "/ outputDir:" bin \ Windows \ Content "/ middleDir: "obj \ Windows \ Content" "завершен с кодом 1. PlayVideo

Код на самом деле очень простой.Я отправил это.Я не могу выяснить, почему это не работает.Любая помощь приветствуется.Заранее спасибо !

    protected override void Initialize()
    {
        // TODO: Add your initialization logic here

        video = Content.Load<Video>("nature");
        videoPlayer = new VideoPlayer();


        base.Initialize();
    }


    protected override void LoadContent()
    {
        // Create a new SpriteBatch, which can be used to draw textures.
        spriteBatch = new SpriteBatch(GraphicsDevice);
        videoPlayer.Play(video);
        // TODO: use this.Content to load your game content here
    }



    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);

        spriteBatch.Begin();

        Texture2D videoTexture = null;

        if(videoPlayer.State != MediaState.Stopped)
        {
            videoTexture = videoPlayer.GetTexture();
        }

        if(videoTexture != null)
        {
            spriteBatch.Draw(videoTexture, new Rectangle(0, 0, 400, 240), Color.White);
        }

        spriteBatch.End();

        // TODO: Add your drawing code here

        base.Draw(gameTime);
    }
...