Strange Movie problem
Strange Movie problem
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...
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
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).
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).
> 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...
(Note to Fred/Webmaster: Why is this reply above Kenmo's?).
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
Thats pretty weird...PB wrote:(Note to Fred/Webmaster: Why is this reply above Kenmo's?).
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!
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:
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
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?
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?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
> 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.

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.

I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.