Hello everyone,
I am new to monogame. I want to play a simple video. I did everything according to a tutorial on the internet and load a video content in .wmv format but i get this strange error saying:
Error Importer ‘WmvImporter’ had unexpected failure! PlayVideo C:/Users/berka/Desktop/Game Development/PlayVideo/PlayVideo/Content/nature.wmv
Error The command ““C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\MGCB.exe” /quiet /platform:Windows /@:“C:\Users\berka\Desktop\Game Development\PlayVideo\PlayVideo\Content\Content.mgcb” /outputDir:“bin\Windows\Content” /intermediateDir:“obj\Windows\Content”” exited with code 1. PlayVideo
Where is the problem ? Below I post my code
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);
}