DirectX.AudioVideoPlayback / video.Owner

Started by
3 comments, last by anvil 18 years, 5 months ago
I have found a media player in one of the managed DX samples. Im trying to modify it to play the movie inside my game window, but the Owner method says it requires System.Windows.Forms.Control object and I just need to use this.sampleFramework.Window.... any ideas? exact error Cannot implicitly convert type 'System.IntPtr' to 'System.Windows.Forms.Control'


private Video videoClip = null;

public void PlayMovie()
{
     // First try to open this as a video file
    videoClip = new Video("video.mpg");
   
    videoClip.Size.Height.Equals(640);  //movie height
    videoClip.Size.Width.Equals(480);   //movie width

    // the sample uses a form but I have just a window formed by DX
    videoClip.Owner = this.sampleFramework.Window;  //build error
    
    // Start playing now
    videoClip.Play();
}


Advertisement
Have you tried using the FromHandle or FromChildHandle mehtods of Control? I don't know much about the sample framework, but if they call it a window and the type is IntPtr than than the IntPtr is probably a HWIND and you can get a Control from it like so:
Control.FromHandle(this.sampleFramework.Window);

It should also work with a form instead of a control.

Hope this helps.
yeah it compiles now hehe, but when the movie plays it makes a new window for every frame lol, atleast now I can figure out something.
thanx
lol I know why it was playing over and over in the onframerender lol, i just limited it to one time only now... works good... the size remains the same though for some reason (not 640x480)
actually at further inspection im way off, its just creating a new window for the movie INSIDE the same dimensions as the game window grrrr

This topic is closed to new replies.

Advertisement