How to play an embedded video file in C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TxAg03
    New Member
    • Feb 2008
    • 14

    #1

    How to play an embedded video file in C#

    I am looking for a way to play embedded videos using either Windows Media Player, or DirectX. I have tried using the url option with WMP, but can only play files off the HDD. I am running into the same problem using DirectX, can only play videos from the HDD. I have added videos (*.wmv) to the project and set them to embedded resource. How can I then access and play them?
  • cnixuser
    New Member
    • Dec 2006
    • 80

    #2
    Could you elaborate on what you mean by embedded?

    Comment

    • TxAg03
      New Member
      • Feb 2008
      • 14

      #3
      Forgive me if my terms are not correct. In the solution explorer, I right-click and select 'add', then 'existing item'. I then select the added video (*.wmv) and for it's build action property, I set it to 'embedded resource'. I have found many explanations on how to do this with pictures and text, even audio, but nothing for video.

      I am trying to write a program that contains multiple videos. So that the user can not distribute them or access them without letting me know, I currently have them zipped up with a password. This is slow because I have to extract them to a temp file to play them in an embedded WMP on another form. I am trying to find a way to access them from within my program to eliminate the wait of extracting.

      Comment

      • cnixuser
        New Member
        • Dec 2006
        • 80

        #4
        Originally posted by TxAg03
        Forgive me if my terms are not correct. In the solution explorer, I right-click and select 'add', then 'existing item'. I then select the added video (*.wmv) and for it's build action property, I set it to 'embedded resource'. I have found many explanations on how to do this with pictures and text, even audio, but nothing for video.

        I am trying to write a program that contains multiple videos. So that the user can not distribute them or access them without letting me know, I currently have them zipped up with a password. This is slow because I have to extract them to a temp file to play them in an embedded WMP on another form. I am trying to find a way to access them from within my program to eliminate the wait of extracting.
        I'll research this problem some myself. What version of the .Net framework are you using?

        Comment

        • TxAg03
          New Member
          • Feb 2008
          • 14

          #5
          Thank you cnixuser.

          Using Visual Studio 2008 and am writing in .NET 2.0. If need be, I can switch to .NET 3.0 or 3.5.

          Comment

          • TxAg03
            New Member
            • Feb 2008
            • 14

            #6
            Maybe this is an alternative to embedding the files... Is there a way to encrypt a file (video) and have the program be able to read it without having to decrypt the file to a temp location? I know that Windows can encrypt files, making it that only that user can access/run them. Is there a way that I can make it so that my program is the only program that can have access to the files?

            Comment

            Working...