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!

Problem with showing movies in vb

Status
Not open for further replies.

tedsmith

Programmer
Nov 23, 2000
1,762
AU
I set up WindowsMediaPlayer9 to play movies but I have a strange problem as follows:
If I play the same MPG4 file and over it plays nice and smoothly in any size window I like in my application as long as I keep the original MP4 file loaded and only use stop, pause or play.
However if I close the player (but not the application) and load a new AVI file it plays OK THEN all future files play jerky as though they are about 5 frames per second.
The only way I can play smoothly again is to close the exe app.
In the design environment the same thing happens and I have to close VB6 and reopen it (not just stop the application)
The avail memory gets smaller the more files I try out so it is though the player is remembering the 2 or more files behind VB?? I cant see how to purge files in run time or is something else needed.
Any ideas?

By the way I found out you can have a small box and hide all the WM controls by entering 'none' in the uiMode property of the WMPlayer. The DLL to reference in components is WMP.DLL (not an OCX)

Ted
 
Hi there,
It sounds to me like you are not destroying the instance of Media Player that you are using, so when you close the player and not the app the player is still running in the background. This would account for the jerky motion of the movies when opened a second time and also the reduction in memory as every time you run the movie you are adding a new instance of Media Player.
You will need to find the correct method for closing the instance i.e. <object>.Quit or <object>.Close and use that when the application closes the player.

Hope this makes sense, if you need any further help please let me know.

All the best,

Dave.

 
Yes I feel that is the problem but I tried all such commands that I could imagine. Even setting the player to a variable and setting it back to nothing.
This also happens if I use the actual player in the destop with no VB6 at all. It might be a bug.
It doesnt happen if I play only AVI files, only with MPEG4.

I downloaded the latest Windows Media Player9 and installed it in a WIN98 machine on the internet. It foud a codec by itself to enable it to play MPG4.
My problem now is how do I identify this extra codec file to include in my distribution disk so I can install it on another machine that is not on the net? How will the player recognise this codec?
Any ideas?
 

Just a thought...

In you program, in an attempt to stop this behavior, why don't you set the index of the control to zero and for each movie load a new control and when done destroy it, or perhaps use two forms and create a new instance of the form that has the control on it for each movie.

Just a thought...

Good Luck

 
thanks
I tried just that but it still does the same.
It also does it if I just use the Windows Media Player in Windows so it must be a bug.
The only way to play a smooth MPG4 seems to be to close the player each time.
In Windows mediaplayer 6, you can sometimes see a greenish mix of the previous MPG when you try to play an AVI after playing an MP4
Even closing the application in the design mode doesnt fix it, you have to close VB and reopen it so the problem must be at a lower level like you get when you load a project with an unregistered control
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top