Click here to Skip to main content
15,881,092 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I was looking for block that way who wants copy the mp4 files And I'm finding the way, that i changed mp4 file to resource By this way:
C#
private void Form1_Load(object sender, EventArgs e)
{
String openVideo = @"c:\temp\video.mp4";
System.IO.File.WriteAllBytes(openVideo, global::ProjectName.Properties.Resources.mymp4name);
System.Diagnostics.Process.Start(openVideo);
}


it works! But after the debug a software All of the storage of that saved in the exe file and this is so heavy for a file my exe size is about 900mb ,
my question is there any way to save that resource file Separate and exe file just do the software?

What I have tried:

String openVideo = @"c:\temp\video.mp4";
System.IO.File.WriteAllBytes(openVideo, global::ProjectName.Properties.Resources.mymp4name);
System.Diagnostics.Process.Start(openVideo);
}
Posted
Updated 17-Aug-17 0:22am
Comments
Jochen Arndt 17-Aug-17 5:58am    
Why not deliver the video file together with your application as it is, install it to a defined path (can be within or below the app folder if it must be only read), and load it when required?

1 solution

Your whole approach is not going to work: You are "hiding" the MP4 file in a resource, which means it's "inside" the EXE file, and you can't do anything about that.
But you aren't protecting it at all - you are actually distributing it yourself with your code!
You assume (correctly or incorrectly, it's wrong for my system) that there is a folder called "temp" in the root of the current C drive, and you write the file to there in order to open a process to show it. From that point the user can do exactly what he likes with the MP4 because it's sitting there in plain view, and will still be there if your application is closed later.

That's not "protection", that's "copying". And if (like me) the default MP4 player is VLC, it will tell me exactly where the file is, and what it's called to make my job as a video pirate even easier. :laugh:

If you want to protect video files, encrypt them, and play the decrypted stream within your application. I only know of one system to do that, and it's a paid-for product: Encrypted Video Streaming | Play Video From Stream in C# | BoxedApp SDK[^] You may find others via Google, but don't expect this to be a trivial process.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900