Page 1 of 2
Strange Movie problem
Posted: Thu Jan 15, 2004 6:46 am
by kenmo
When I load and play a movie (video) in a window, it literally wont show up. However if I move the window, it appears and continues to play normally. Does this happen to anyone else? Just try the "Movie" example code and see if it does it. If it isnt just me, is there a solution?
Not a big problem, its just annoying, especially if you want to release a media player and the user has to move the window whenever they play a file...
Re: Strange Movie problem
Posted: Thu Jan 15, 2004 6:57 am
by PB
I have the same problem, and solved it by opening an invisible window,
starting the movie, then showing the window. Add this flag to your
OpenWindow command: #PB_Window_Invisible. Then, use the
PlayMovie(0,WindowID()) command, followed by this API
command: ShowWindow_(WindowID(),#SW_SHOW).
(I still think this is a bug, as I have the latest GeForce video drivers and
Service Pack for Windows 2000 Professional).
Posted: Fri Jan 16, 2004 12:03 am
by Bong-Mong
playmovie()
Delay(500)
Resizewindow(#window_0,-1,-1,size,size)
works for me
Posted: Fri Jan 16, 2004 1:34 am
by PB
> Neither of those works for me
Are you playing MPGs? I think only MPGs are officially supported (not AVI
and other video formats). If so, does this work for you? Does for me...
Code: Select all
m$="c:\MyMovie.mpg"
If OpenWindow(0,0,0,352,240,#PB_Window_Invisible|#PB_Window_ScreenCentered,"test")
InitMovie() : LoadMovie(0,m$) : PlayMovie(0,WindowID()) : ShowWindow_(WindowID(),#SW_SHOW)
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
(Note to Fred/Webmaster: Why is this reply above Kenmo's?).
Posted: Fri Jan 16, 2004 3:36 am
by kenmo
Neither of those works for me. It doesnt really matter, because I didnt plan on releasing my current program... so oh well.
Posted: Fri Jan 16, 2004 7:45 pm
by kenmo
PB wrote:(Note to Fred/Webmaster: Why is this reply above Kenmo's?).
Thats pretty weird...
Yes Im using MPGs and yes that code works... however my app doesnt just automatically open a movie and play it, you have to choose load and open it. Which means the window has to be visible before I play the movie. Maybe if I used showwindow_() and set it invisible right before I play it, then showwindow_() it back to visible after? Is there a constant for #SW_HIDE or something?
edit - aha, it is #SW_HIDE and it does work. Thank you!
Posted: Fri Jan 16, 2004 10:57 pm
by PB
Making the window go invisible and then visible again will work, but it will
make your window lose its place on the Taskbar (which makes your app
look unprofessional). So, try the following instead:
Code: Select all
m$="C:\MyMovie.mpg"
If OpenWindow(0,0,0,352,240,#PB_Window_ScreenCentered,"Press SPACE to 'load' movie")
Repeat : Sleep_(1) : WindowEvent() : Until GetAsyncKeyState_(#VK_SPACE)<>0
InitMovie() : LoadMovie(0,m$) : PlayMovie(0,WindowID())
RedrawWindow_(WindowID(),0,0,#RDW_INVALIDATE) ; Update window.
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
Posted: Sat Jan 17, 2004 12:34 am
by kenmo
Ahh thank you that is easier and works so much better!
Posted: Sat Mar 17, 2007 1:18 am
by PB
I still have this problem as of today (Mar 17, 2007) with PB v4.02, so there's
still a bug or something going on here. Even redrawing the window or using
API calls doesn't always fix it. Resizing the window is reportedly the fix, but
this isn't elegant, nor is it an acceptable long-term solution.
Also, sometimes during movie playback, the movie will just go blank again,
requiring me to move the window to redraw it. So I'm not sure if it's my PC
due to Media Player 11, or the PureBasic PlayMovie command, or what?
Posted: Sun Mar 18, 2007 9:18 pm
by Trond
What happens if you disable all video accelleration or boot in safe mode? Is there still a problem?
Posted: Sun Mar 18, 2007 9:37 pm
by PB
> What happens if you disable all video accelleration
Hi Trond, yes, it works if I stave off the video acceleration a bit. If I use the
setting below, then all works as expected with no problems. So hopefully
that means it's not a PureBasic problem, but I'm not sure because it seems
to be DirectX related? Normally I have acceleration set to full and have no
display problems with any other apps, so PureBasic is the odd one out.

Posted: Sun Mar 18, 2007 9:58 pm
by Trond
Then it sounds like a driver problem.
Posted: Mon Mar 19, 2007 8:28 am
by PB
That only affects PureBasic?

Posted: Mon Mar 19, 2007 11:23 am
by codefire
I get the same problem.
It seems almost like the screen is not getting the initial redraw command.
However, when you drag the window it seems to initiate a Windows redraw command, the window is refreshed and it seems OK from that point on.
Posted: Mon Mar 19, 2007 12:41 pm
by Trond
PB wrote:That only affects PureBasic?

Well, I have a different driver, but the same PureBasic, and then it works.