Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Video with annoying frame

Status
Not open for further replies.

SitesMasstec

Technical User
Sep 26, 2010
502
BR
Hello colleagues!

I have a video which plays well in the Windows Media Player. This is the first screen:
VideoWindowsMPlayer_vgkjve.jpg


In a VFP 9 application, I have a player (MCI Player) inside a form, which plays the same video above, BUT it appears with a large right and bottom frame when played:
VideoInsideVFP9App_c2ggyk.jpg


How to avoid the frame inside application, which cuts part of the video?


Thank you,
SitesMasstec
 
Is there a 'stretch to fit' property?

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0
 
Hello Griff!

No, there's not a Stretch property in the video player:
FormularioVideoVFP9_ogcysj.jpg


Thank you,
SitesMasstec
 
What ActiveX control is this (I cannot read Portuguese)? Have you contacted the author for direction?
 
In the samples solution.app, the video window is always stretched to the size of the shape called Player:

CAUTION: This is code out of the context of the mci video pleayer sample form, you can't use it 1:1, but you can find it there and see how it adapts the video winow to whatever size the player shape has:
Code:
		*!* Get the window handle of the window playing the video
		cCmd = "status FoxMedia window handle wait"
		hWin = INT(VAL(THISFORM.doMCI(cCmd)))
	
		*!* Once we have the window handle, we need to position
		*!* the video window to be the same position and size
		*!* as our player rectangle on the form
		x1Pos = THISFORM.player.LEFT
		y1Pos = THISFORM.player.TOP
		x2Pos = THISFORM.player.width
		y2pos = THISFORM.player.height

		*!* Use the SetWindowPos Windows function to set position and size
		SetWindowPos(hWin,0,x1Pos,y1Pos,x2Pos,y2Pos,0)

CauTION: Again said, this is not working standalonw. you need to have a form with such a player shape and the doMCI method and more, the main ingredient for the size of the video is setWindowPos, which is Windows API, declared in form init:

Code:
*!* When MCI plays a video, it creates its own Window.  By using
*!* this Windows API function we can position this Window to be
*!* in the same position as our Player rectangle on the form
DECLARE integer SetWindowPos ;
	IN User32 ;
	integer, integer, integer, integer, integer, integer, integer

So take all these ingredients with care and integrate it into your form. As your shape also is called Player this seems to have been ported from the VFP sample code. So just add this part of the samepl and you can stretch the video to any size you want (within reasonable limits).

For a short test:
1. Use the mci player sample "MCI_Play.scx" from the solution project. Play the video and see if it's sized into the Player shape on the form
2. Modify the form, resize the Player Shape to a larger size and see how the sample form adapts the video size to whatever size you give the Player shape.

If this both works you know what to take over into your form. Mainly the SetWindowPos in conjunction with getting the video handle from the MCI command "status MCIName window handle wait".

Chriss
 
Hello Chris!

I used the mci player sample "MCI_Play.scx" from the solution project, as you suggested. But the result is the same:
(I have all the code you provided above in the form procedures)
FormMCIPlayerSolutions1_ysxmzg.jpg


During the video execution, I do not know why I did this, I PAUSED and moved the form UP and LEFT so I put the whole video screen inside the player box!
FormMCIPlayerSolutionsUpLeft1_ov8hzu.jpg

Of course, in the application I want it to be inside the player screen as soon as I click on the Play button.



Thank you,
SitesMasstec
 
Hello!

The MCI player sample "MCI_Play.scx" in Solutions should work.

Even this standard example does NOT put the video inside the whole video screen.

Thank you.


Thank you,
SitesMasstec
 
From your screenshot it seems the top/left offset needs to be right for the overlay of the video. Do you have the VFP IDE Screen maximized, so its top/left is 0?

Btw the example videos I used did also appear overlayed on the shape size AND position, if I move the IDE off 0,0.
Does it happen with other videos, too? Then it's perhaps a graphic card setting about video overlay.
And if not, then it's somehow encoded into the video, but I can't imagine that.

Chriss
 
style?

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0
 
There's something mentoned in SetWindowPos, that is the host window has to be a foreground window, So how about doing:

Code:
DECLARE LONG SetForegroundWindow In Win32API Long Hwnd
SetForeGroundWindow(Thisform.Hwnd)
...
SetWindowPos(hWin,0,x1Pos,y1Pos,x2Pos,y2Pos,0)
Will that work?


Chriss
 
Chris: Your suggestion in your last post hasn't worked.

Now, I want to share with all of you:

My files mci_play.scx/sct in the Samples, Solution folder are original, dated December 09,2004.
That said, I executed it with a 320x240px AVI file (fox.avi, also provided in the same folder). It executes well, the files plays inside the screen box in the form:
FormMCIPlayerSolutionsFoxAVI_lakgam.jpg


Now, executing the same (VFP9 original sample) mci_play for a 640x480px MPG file, it runs with black frames:
VideoInsideVFP9App_p3uq5c.jpg



Thank you,
SitesMasstec
 
Unless you didn't do things in the necessary order, with the necessary handle and cocrdinates, it seems it boils down to the problem being your video file. The necessary video codecs are something in your responsibility, they are not embedded in a video. And MCI play needs codes registered with the system. Not codes VLC player or others, even Microsoft Moviews&TV or Media Player.

I don't think a wrong codec would be able to play a video at all, Even an outdated version of the right codes would be strange to only error in am added black frame to right and bottom, this all seems just too high width/height of the video window you set. You have the coordinates you set in your hands, fully.

But have you tried other videos? I'm not talking about the small AVIs that come with VFP?

Chriss
 
Yes, Chris, the Fox.avi, which came with VFP9 package, works correctly, as you can see in the first image in my previous post today (which shows the Earth globe rotating).

Is there another way to play video inside a VFP application without using MCI?


Thank you,
SitesMasstec
 
I don't know how much of all my advice gets to you as intended.

I said:
myself said:
But have you tried other videos? I'm not talking about the small AVIs that come with VFP?

I still think all that's wrong is either that specific video or you're calling SetWindowPos with wrong parameters, it's handle,0,top,left,width,height,0 not, as an example of wrong parameters that explain black areas: handle, 0, top, left, right, bottom, 0.





Chriss
 
Chris, this is the code (partial) in Object: cmdOpen, Procedure: Click:

Code:
		*!* Get the window handle of the window playing the video
		cCmd = "status FoxMedia window handle wait"
		hWin = INT(VAL(THISFORM.doMCI(cCmd)))
	
		*!* Once we have the window handle, we need to position
		*!* the video window to be the same position and size
		*!* as our player rectangle on the form
		x1Pos = THISFORM.player.LEFT
		y1Pos = THISFORM.player.TOP
		x2Pos = THISFORM.player.width
		y2pos = THISFORM.player.height

		*!* Use the SetWindowPos Windows function to set position and size
		setWindowPos(hWin,0,x1Pos,y1Pos,x2Pos,y2Pos,0)

I think it is the same as you advised me.


Thank you,
SitesMasstec
 
I gave several advices. One of them was as quoted from the description of SetWindowPos. Just read back.

Anyway it is, you could try several things, if not lower width and height, even if it contradicts the usual code, to at least see what changes.
You also had a tip from verspace and griff asked whether style changes something.

As you're silent about all this, I don't know if you're even reading and following advices.

Chriss
 
Chris:

Yes, I read all advices from you, Griff (I have not found where to change Style to run the video, probably my ignorance), also from Vernpace, I could not have the desired result after so many changes I tried.

I have been trying so much since my first post.

Probably I am not as fluent in VFP as you all. Sorry.

I will continue trying.

Thank you very much.


Thank you,
SitesMasstec
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top