Error loading "Video\a_video". Cannot open file.

Apr 8, 2009 at 12:23 AM
Edited Apr 8, 2009 at 12:24 AM
I have a little problem, I am running XNA 3.0 with the latest version of Scurvy Media.
I keep getting "Error loading "Video\a_video". Cannot open file."  My video file is under "Content/Video/a_video.avi" and it chose the correct importer.

My code is:
 

using

 

System;

 

using

 

System.Collections.Generic;

 

using

 

System.Linq;

 

using

 

Microsoft.Xna.Framework;

 

using

 

Microsoft.Xna.Framework.Audio;

 

using

 

Microsoft.Xna.Framework.Content;

 

using

 

Microsoft.Xna.Framework.GamerServices;

 

using

 

Microsoft.Xna.Framework.Graphics;

 

using

 

Microsoft.Xna.Framework.Input;

 

using

 

Microsoft.Xna.Framework.Media;

 

using

 

Microsoft.Xna.Framework.Net;

 

using

 

Microsoft.Xna.Framework.Storage;

 

using

 

Scurvy.Media;

 

using

 

Scurvy.Media.VideoModel;

 

namespace

 

Hlle_Speicher

 

{

 

/// <summary>

 

 

/// This is the main type for your game

 

 

/// </summary>

 

 

public class Game1 : Microsoft.Xna.Framework.Game

 

{

 

GraphicsDeviceManager graphics;

 

 

SpriteBatch spriteBatch;

 

 

ContentManager vContent;

 

 

Video opening1;

 

 

public Game1()

 

{

graphics =

new GraphicsDeviceManager(this);

 

Content.RootDirectory =

"Content";

 

}

 

/// <summary>

 

 

/// Allows the game to perform any initialization it needs to before starting to run.

 

 

/// This is where it can query for any required services and load any non-graphic

 

 

/// related content. Calling base.Initialize will enumerate through any components

 

 

/// and initialize them as well.

 

 

/// </summary>

 

 

protected override void Initialize()

 

{

 

// TODO: Add your initialization logic here

 

vContent =

new VideoContentManager(Services);

 

 

base.Initialize();

 

}

 

/// <summary>

 

 

/// LoadContent will be called once per game and is the place to load

 

 

/// all of your content.

 

 

/// </summary>

 

 

protected override void LoadContent()

 

{

 

// Create a new SpriteBatch, which can be used to draw textures.

 

spriteBatch =

new SpriteBatch(GraphicsDevice);

 

opening1 = vContent.Load<

Video>("Video\a_video");

 

opening1.Loop =

false;

 

opening1.Play();

 

// TODO: use this.Content to load your game content here

 

}

 

/// <summary>

 

 

/// UnloadContent will be called once per game and is the place to unload

 

 

/// all content.

 

 

/// </summary>

 

 

protected override void UnloadContent()

 

{

 

// TODO: Unload any non ContentManager content here

 

}

 

/// <summary>

 

 

/// Allows the game to run logic such as updating the world,

 

 

/// checking for collisions, gathering input, and playing audio.

 

 

/// </summary>

 

 

/// <param name="gameTime">Provides a snapshot of timing values.</param>

 

 

protected override void Update(GameTime gameTime)

 

{

 

// Allows the game to exit

 

 

if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)

 

 

this.Exit();

 

opening1.Update();

 

// TODO: Add your update logic here

 

 

base.Update(gameTime);

 

}

 

/// <summary>

 

 

/// This is called when the game should draw itself.

 

 

/// </summary>

 

 

/// <param name="gameTime">Provides a snapshot of timing values.</param>

 

 

protected override void Draw(GameTime gameTime)

 

{

GraphicsDevice.Clear(

Color.CornflowerBlue);

 

 

if (opening1.IsPlaying)

 

{

spriteBatch.Begin();

spriteBatch.Draw(opening1.CurrentTexture,

new Vector2(10, 10), Color.White);

 

spriteBatch.End();

}

 

// TODO: Add your drawing code here

 

 

base.Draw(gameTime);

 

}

}

}

Any help will be thanked.
Apr 8, 2009 at 12:25 AM
You REALLY need a codebox...
Coordinator
Apr 8, 2009 at 1:24 PM
can you check and see if the .avi file has the readonly flag on (right click > properties > readonly checkbox)?  if so, you'd need to manually uncheck that (a common problem when the .avi file is source controlled).  This is a limitation of the underlying AVIFile API that I'm using ... not sure if there's a way around it.

Also, does this error occur during the build process, or at runtime?
May 16, 2009 at 1:44 AM

I was having the same error - fixed it by setting the RootFolder in the VideoContentManager to "Content". The original content file in a new default xna application sets the same value.