• (3 Pages)
  • +
  • 1
  • 2
  • 3

Adding Video to an Application Adding videos to Windows forms applications using DirectX

#16 Toft  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 5
  • Joined: 01-December 10

Posted 28 February 2011 - 01:08 AM

View PostZenQ, on 22 February 2011 - 02:39 PM, said:

I got this error when pressing the browse button

The reference for the DirectX.AudioVideoPlayback was not found in my list of .NET, so i used the one located in Windows/Microsoft.NET/DirectX for Managed Code/1.0.2902.0

note:I do have the latest Windows Media Format SDK installed. Or must I also have the DirectShow.Net?


its because the DirectX.AudioVideoPlayback only works in .NET 3.0 and the versions older then that, i've tried it my self and it doesnt work in .NET 4.0 :) try changing your application too .NET 3.0 and it should work :)
Was This Post Helpful? 1
  • +
  • -

#17 ZenQ  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 14
  • Joined: 22-February 11

Posted 28 February 2011 - 01:15 AM

Ops forgot to update that I fixed this problem..
I created an app.config and added these lines..
<startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>


:lol: my bad..
Was This Post Helpful? 1
  • +
  • -

#18 Toft  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 5
  • Joined: 01-December 10

Posted 28 February 2011 - 01:17 AM

Oh nice actually :) i didnt thought of that when trying this tutorial :P excellent mate :)

This post has been edited by Toft: 28 February 2011 - 01:17 AM

Was This Post Helpful? 0
  • +
  • -

#19 kotinkarwak  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 25-March 11

Posted 26 March 2011 - 06:39 PM

The example given shows method to locate a video file on the disk system. In C# is it possible to embed the video in the executable file and have it play from within or is the disk round-trip still going to be required (write the file to disk, point the player to the file on dis, play).
Why I ask, I am new to C# and wondered if this is at all possible for securing (hide) application resources within an application.

Toft: Please confirm the .Net version that should be used since you stated that only 3.0 variant should work, is there another method (DirectX.AudioVideoPlayback) that can be used in 4.0?
One more query, is there a simpler way to check what version of .Net is installed on a machine?

Kind Regards,
Kotin

This post has been edited by kotinkarwak: 26 March 2011 - 06:45 PM

Was This Post Helpful? 0
  • +
  • -

#20 Toft  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 5
  • Joined: 01-December 10

Posted 28 March 2011 - 01:37 AM

Hey there, i dont know wich version of .net works with the DirectX.AudioVideoPlayback, when i first followed this tutorial, i used .net 4.0, but i wasnt able to run the application.. so i changed it too .net 3.0 and it worked instantly.. you could ofc use the code ZenQ posted so it will work in 4.0, but i dont know wich version of the .net framework it supports.. i've tried searching a bit on google but i didnt found anything useful. but if you wanna know maybe you should try searching for what version of .net it supports.
Was This Post Helpful? 1
  • +
  • -

#21 kotinkarwak  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 25-March 11

Posted 28 March 2011 - 03:19 AM

Thanks Toft. Will do my revision on the version. What about the question of embedding the video resource? and inspecting machine for version of .net installed?
Thanks for this post..
Was This Post Helpful? 0
  • +
  • -

#22 Toft  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 5
  • Joined: 01-December 10

Posted 28 March 2011 - 03:24 AM

View Postkotinkarwak, on 28 March 2011 - 11:19 AM, said:

Thanks Toft. Will do my revision on the version. What about the question of embedding the video resource? and inspecting machine for version of .net installed?
Thanks for this post..


as far is i know, you can see what version of the .net framework you have, under control panel / remove or add programs
atleast thats where i could find it :), the other matter of embedding the video resource i guess its possible too add a video file as resource and then only use file in your video player. but i havent tried it out, so i cant tell you for sure if it will work, sorry mate :/

This post has been edited by Toft: 28 March 2011 - 03:25 AM

Was This Post Helpful? 0
  • +
  • -

#23 kotinkarwak  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 25-March 11

Posted 28 March 2011 - 03:28 AM

Thanks Toft,
See I can read/write/update registry keys in C# so will spend sometime and review this as well, need to troubleshoot the .Net installs (I know the software update manages this on the system i.e. will only keep most relevant version as it updates but just need to learn how to inspect the registry).
Was This Post Helpful? 0
  • +
  • -

#24 lesPaul456  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 173
  • View blog
  • Posts: 729
  • Joined: 16-April 09

Posted 28 March 2011 - 04:10 PM

Sorry it took me so long to reply, I've been pretty busy...

I wrote this tutorial several months ago, long before .NET 4 was released. I was using version 3.5 of the .NET Framework, I believe.

Anyway, Managed DirectX (MDX) is now deprecated.
Was This Post Helpful? 0
  • +
  • -

#25 seeker23  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 09-February 11

Posted 04 July 2011 - 07:51 AM

I have this error and i can`t get rid of it.
Error 1 The name 'viewport' does not exist in the current context.
Can someone help me?
Was This Post Helpful? 0
  • +
  • -

#26 milind_kulkarni  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 14-February 12

Posted 14 February 2012 - 01:00 AM

Hi 

I have the same problem of DirectX not able to open the Video..... Only one differece that in my case is I could not found the diretX.AudioVideoPlayback.dll in .NET referecnes folder inspite of it was there in the loaction C:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2902.0 

Here is my code....

[code] private void button1_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            //string path_save;

            

            //IColor s = new IColor.
            // if (select_image == 0)
            //{
            OpenFileDialog open = new OpenFileDialog();
            open.Filter = "Flash Files(  *.flv;*.avi)| *.flv;*.avi";

            try
            {

                if (open.ShowDialog() == DialogResult.OK)
                {
                   string s1 = open.FileName;
                   //Microsoft.DirectX.AudioVideoPlayback.Audio a1 = new Microsoft.DirectX.AudioVideoPlayback.Audio(s1);
                  Video myvideo = new Video(open.FileName, false);
                  // myvideo.Open(s1);
                    myvideo.Owner = this.panel1;
                    myvideo.Play();
                }
            }
            catch (Exception)
            {
                throw new ApplicationException("Failed loading image");
            }
            Cursor.Current = Cursors.Default;

        }


My try catch loop is catching expection.....

Please let me know what is the reason for this .....[/code]

This post has been edited by modi123_1: 14 February 2012 - 08:16 AM
Reason for edit:: please use code tags

Was This Post Helpful? 0
  • +
  • -

#27 milind_kulkarni  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 14-February 12

Posted 14 February 2012 - 01:12 AM

In the case above I was using Visual C# 2010 I had repeated the process with Visual C# 2008 I am able to see Microsoft.DirectX.Audovideoplayback.dll in .NET reference and I am able to build the code but I am getting the same exception again wiht 2008 too....

Please guide me to get the porper video play using DiretX...

Thanking you in advance
Was This Post Helpful? 0
  • +
  • -

#28 milind_kulkarni  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 14-February 12

Posted 14 February 2012 - 06:00 AM

Hi Guys ,

After some more search I could able to play video with my application but it is not playing any audio....any suggestation for that....

Thanks in advance....
Was This Post Helpful? 0
  • +
  • -

#29 Deepakyakkati  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 11-May 12

Posted 11 May 2012 - 04:33 AM

Hi i'm deepak, how can we play video in asp.net pages (through flash player)
Was This Post Helpful? 0
  • +
  • -

#30 vijayadhas.c  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 25-August 12

Posted 25 August 2012 - 10:30 AM

is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)

I am using Windows7 X 64bit. I can't load the video. What i do?
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3