Microsoft.Xna.Framework.Media(Monogame)中 VideoPlayer 上的 Microsoft.Xna.Framework.Content.ContentLoadException

问题描述 投票:0回答:1

我正在尝试在 Monogame 中播放视频。我遇到了一些麻烦,因为最简单的方法是使用 VideoPlayer,由于某种原因它不在我的 Microsoft.Xna.Framework.Media 中。所以我将我的 visual studio 项目指向引用 Microsoft.Xna.Framework.Video.dll 并且我能够很好地制作 VideoPlayer 的对象。

我的示例代码如下:

videoPlayer = new VideoPlayer();
video = content.Load<Video>("Intro_Videos/main_intro");
videoPlayer.Play(video);

我在第 2 行遇到错误,

Microsoft.Xna.Framework.Content.ContentLoadException: 'Could not find ContentTypeReader Type. Please ensure the name of the Assembly that contains the Type matches the assembly in the full type name: Microsoft.Xna.Framework.Content.VideoReader (Microsoft.Xna.Framework.Content.VideoReader)'

下面更详细的错误:

Microsoft.Xna.Framework.Content.ContentLoadException
  HResult=0x80131500
  Message=Could not find ContentTypeReader Type. Please ensure the name of the Assembly that contains the Type matches the assembly in the full type name: Microsoft.Xna.Framework.Content.VideoReader (Microsoft.Xna.Framework.Content.VideoReader)
  Source=MonoGame.Framework
  StackTrace:
   at Microsoft.Xna.Framework.Content.ContentTypeReaderManager.LoadAssetReaders(ContentReader reader)
   at Microsoft.Xna.Framework.Content.ContentReader.InitializeTypeReaders()
   at Microsoft.Xna.Framework.Content.ContentReader.ReadAsset[T]()
   at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T](String assetName, Action`1 recordDisposableObject)
   at Microsoft.Xna.Framework.Content.ContentManager.Load[T](String assetName)
   at DevcadeGame.States.IntroState..ctor(Game1 game, GraphicsDevice graphicsDevice, Int32 PreferredBackBufferWidth, Int32 PreferredBackBufferHeight, ContentManager content) in C:\Users\garre\Desktop\Devcade\Devcade-Hero\States\IntroState.cs:line 28
   at DevcadeGame.Game1.LoadContent() in C:\Users\garre\Desktop\Devcade\Devcade-Hero\Game1.cs:line 109
   at Microsoft.Xna.Framework.Game.Initialize()
   at DevcadeGame.Game1.Initialize() in C:\Users\garre\Desktop\Devcade\Devcade-Hero\Game1.cs:line 89
   at Microsoft.Xna.Framework.Game.DoInitialize()
   at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior)
   at Microsoft.Xna.Framework.Game.Run()
   at Program.<Main>$(String[] args) in C:\Users\garre\Desktop\Devcade\Devcade-Hero\Program.cs:line 3

更多的上下文是路径应该是正确的。该视频是一个 .mp4,并且该项目使用资产构建得很好。我在 x86(主动解决方案平台)上构建。

如有任何帮助,我们将不胜感激。

c# .net xna monogame video-player
1个回答
0
投票

VideoPlayer 已在 Monogame 中删除,引用 Microsoft.Xna.Framework.Video 与 Monogame 不兼容。

© www.soinside.com 2019 - 2024. All rights reserved.