Hi the problem I am faced with is after adding around 35 video files of both .avi and .mpg with a total file size of around half a gig to the resources of my project, I get an error message on debug telling me "Error 1 Unable to write to output file".
I am guessing this is because the total file size may be too large. I have tried to change the properties of the folder it writes to the file from read only, however it switches right back as soon as. Also I cannot see any .exe in the output directory where the file would be normally be written.
"C:\Users\Bill\Documents\Visual Studio 2010\Projects\resources test 2\resources test 2\obj\x86\Debug"
Resources test 2 being the project name.
I am trying to create a program which plays a number of short video clips without streaming them from the internet. If I could source them from a folder on the HDD then fine however I am then faced with the problem of adding the videos to the instaler package which I dont seem to be able to find a way to do. Does anyone know why the output file will not write in these circumstances? Thank you.

That's a new error message to me :/
Usually it's along the lines of cannot delete file blah blah...

Are you sure you do not have an instance of the program running? It may have crashed and did not fully unload from memory and release the file. Sometimes you will need to reboot to clear things up.

see: Unable to write to output file '<filename>': <error>

The ResourceManager Class, might be what you're looking for. It has the option to use a folder for resources, alternatively you can use an external .resx files to store the videos.

How are you doing the Deployment?

  • Publish to a Click-Once package?
  • A WIX installer?
  • Something else?

Thank you for your help guys, I am going to look into your pointer tinstaafi thanks for that.

Hi TnTinMN, yes it is a click once package, I am not sure what a WIX installer is but I can read up it. I guess there are third party installers but I would prefer not to use them.

I re wrote the project again and added one video file at a time. This time the .exe did get made in the bin directory. I added more videos and have now got to five. I am testing it to see how many it will take before gives it errors.

I think the error message was generated on the previous version because the file was already in use. Just a guess but I guess it like this. The video file is extracted from the .exe of the finished program or the temporary .exe made when I selected debug. The video gets copied to the hdd in a temporary folder but carries a temporary file extension. The video once on the hard drive then gets its extension changed to .avi then the media player gets told to play the file. I think the file is in use in this process somehow when the media player attempted to play it. It matters little because I am fairly certain the way I was trying to get this to work needed changing anyway. The idea by tinstaafi might well hold the answers.

Scrap emmbedding the video files.

Bring up the Solution Explorer: View Menu - > Solution Explorer
Add New Folder: Project Menu -> New Folder (Let's Name it Video)
In the "Solution Explorer" window, Selected the "Video" folder and then right-click->Add->Existing Item
Now Select your video files to include in the project.
255186fb50758d71313ba5e354dd61df

For each video you add, set it's properties like this:
98cdf6dc28021ca13ae74c08badaa0ae

Build the Application.
Set the Publishing Options:
4c3969da6f5d3bc3dcb9a9b315bc8425

Now Publish it.

You can then load the video like this:

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
   AxWindowsMediaPlayer1.currentMedia = AxWindowsMediaPlayer1.newMedia(ExecutionPath() & "\Video\Video1.avi")
End Sub

Public Function ExecutionPath() As String
   Return System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
End Function

Brilliant , thank you.

I've just built a sample version and it works perfect. Thank you all very much indeed.

glad you got the help you need. Please remember to mark this solved. thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.