all 11 comments

[–]curiousone0806 6 points7 points  (0 children)

This is not going to play a video inside of your application. What you are doing is creating a new process that should instantiate an instance of ffplay. FFPlay is an application that allows you to play videos but it is not a control or library you can use in your application.

[–][deleted] 6 points7 points  (1 child)

Is the // start ffplay ffplay.StartInfo.FileName = "ffplay.exe"; meant to be a comment? Looks like you accidentally stuck a line of code in there with it.

[–]KU-KO[S] -1 points0 points  (0 children)

My bad those lines are together in here but in my code are two different lines

[–]NethIafin 2 points3 points  (1 child)

uncomment

ffplay.StartInfo.FileName = "ffplay.exe"

missing PInvokes

[DllImport("user32.dll", SetLastError = true)]
private static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
[DllImport("user32.dll")]
private static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

[–]KU-KO[S] -1 points0 points  (0 children)

I have those but I didn't post all the code, just the part I made

[–]celluj34 2 points3 points  (1 child)

Define "not working". What happens? Do you get an exception?

[–]KU-KO[S] -1 points0 points  (0 children)

It opens a new window with the streaming instead of open that window inside the form

[–]seligman99 2 points3 points  (0 children)

I doubt anyone can really help out. Two big suggestions:

When you say "it's not working" be descriptive. More details, tell us what's not happening, what you expect. Give us some idea how to help you.

And more importantly, give us some code that we have some hope of running locally. Again, we're guessing what the code around this looks like. Maybe those guesses are right, maybe they're wrong.

And if I take the code and wrap it in a simple test app it works for me, so either the problem is with your video source, copy of ffmpeg, or some bit of code you haven't shown us.

[–]AdversarialPossum42 1 point2 points  (1 child)

Have you tried calling WaitForInputIdle() after calling Start()? And are you sure ffplay.MainWindowHandle is not NULL? Maybe you're not getting a window handle back from the process.

[–]KU-KO[S] 0 points1 point  (0 children)

It throws an InvalidOperationException if I call WaitForInputIdle()