Page 1 of 1
Posted: Tue Dec 17, 2002 10:09 am
by BackupUser
Restored from previous forum. Originally posted by chr1sb.
Can anyone show me a working example of how to play mpeg video using PlayMovie command on a screen opened with OpenScreen function?
I thought the code below would work but I don't see the video (I can hear the sound for it so I know it's playing) Should I use flipbuffers()?
Code: Select all
InitSprite()
InitMovie()
InitKeyboard()
LoadMovie(0,"d:\temp\test.mpg")
OpenScreen(640,480,32,"screen")
ResizeMovie(0, 0, 640, 480)
PlayMovie(0,ScreenID())
Repeat
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_All)
StopMovie()
FreeMovie(0)
End
chr1sb
Posted: Tue Dec 17, 2002 11:42 am
by BackupUser
Restored from previous forum. Originally posted by MrVainSCL.
hi chr1sb...
there is an API command to show the window fullscreenmode... i dont know the command atm... due fact i am at work and dont have any access to API stuff nor my sources ;(
I will take a look at home and post it when i am back at home..
PIII450, 256MB Ram, 80GB HD + 6,4 GB, RivaTNT, DirectX8.1, SB AWE64, Win2000 + all Updates...
greetz
MrVainSCL! aka Thorsten
Posted: Tue Dec 17, 2002 12:38 pm
by BackupUser
Restored from previous forum. Originally posted by Hitman.
I think the PlayMovie() is GDI based, or a MCI thingy, if you Init the DDraw mode you can't see the movie.
Well, everyone needs to do something for living.
Posted: Tue Dec 17, 2002 3:08 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
> Can anyone show me a working example of how to play mpeg video
> using PlayMovie command on a screen opened with OpenScreen function?
I don't know if you can... the manual says that PlayMovie must be used
with a WindowID, and nowhere is using a screen mentioned. Therefore,
try the following code instead -- it works just fine for me.
Code: Select all
m$="C:\FullPathOfMovieToPlay.mpg"
;
dtw=GetSystemMetrics_(#SM_CXSCREEN) ; Get Desktop Width.
dth=GetSystemMetrics_(#SM_CYSCREEN) ; Get Desktop Height.
;
; For some strange reason, the window must be invisible at creation, otherwise the video does
; not display properly when this code is compiled into an executable. Is this a bug, Fred?
;
If OpenWindow(0,0,0,dtw,dth,#PB_Window_Invisible|#PB_Window_BorderLess,"Test")
InitMovie() : LoadMovie(0,m$) : ResizeMovie(0,0,dtw,dth) ; Load movie and make it fullscreen.
PlayMovie(0,WindowID()) : ShowWindow_(WindowID(),#SW_SHOW) ; Start playing it and show window.
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
Posted: Tue Dec 17, 2002 10:33 pm
by BackupUser
Restored from previous forum. Originally posted by chr1sb.
I don't know if you can... the manual says that PlayMovie must be used with a WindowID, and nowhere is using a screen mentioned.
PlayMovie(0,ScreenID()) was suggested by Fred elsewhere on this forum, it works fine for me if the screen was created on a window with
openwindowedscreen but I want to use video clips in the middle of my game - like end of level cutscenes for example.
So, your example works fine for me but my display switches back to my desktop resolution when it displays the video - maybe there is some way to use your method but keeping the screen resolution to 640x480 (or whatever resolution is set by
openscreen)?
chr1sb
Posted: Wed Dec 18, 2002 2:37 am
by BackupUser
Restored from previous forum. Originally posted by PB.
> PlayMovie(0,ScreenID()) was suggested by Fred
I see -- I wasn't aware of that.
> maybe there is some way to use your method but keeping the screen
> resolution to 640x480 (or whatever resolution is set by openscreen)?
Sure -- just don't set dtw and dth to the Desktop size, but instead
to the resolution set by OpenScreen.
Posted: Wed Dec 18, 2002 5:01 am
by BackupUser
Restored from previous forum. Originally posted by chr1sb.
Sure -- just don't set dtw and dth to the Desktop size, but instead to the resolution set by OpenScreen.
did you try this and see it working? it makes the display revert back to the desktop for me (windowsXP)
chr1sb
Posted: Wed Dec 18, 2002 5:55 am
by BackupUser
Restored from previous forum. Originally posted by PB.
> did you try this and see it working?
No, but there wasn't any need to because you asked how to set it to
the res of the OpenScreen, so using the OpenScreen dimensions should,
theoretically, do it. I haven't played movies using screens (only
windows) so I can't really help if it's not working, sorry.
Update: Maybe try using SetForegroundWindow(WindowID()) after the
ShowWindow_(WindowID(),#SW_SHOW) command... it may (or may not)
stop the problem of the display reverting back to the Desktop. (I also
use Windows XP and, for what it's worth, my code above works fine for
playing an MPG in fullscreen in a window).
Posted: Wed Dec 18, 2002 11:31 am
by BackupUser
Restored from previous forum. Originally posted by chr1sb.
for what it's worth, my code above works fine for
playing an MPG in fullscreen in a window).
your code also works for me when I run it on its own, my problem is with incorporating video into my fullscreen DirectX application.
chr1sb
Posted: Wed Dec 18, 2002 11:56 am
by BackupUser
Restored from previous forum. Originally posted by chr1sb.
I've solved my problem! but now I have a new problem...
the loadmovie command needs to be used after the openscreen command then everything works as expected (well, also Delay(1) should be added into the repeat...until loop otherwise playback is jerky.)
My new problem is this - the video is scaled 2x without smoothing, so it looks quite blocky compared to how fullscreen video is normally displayed (eg. in Media Player or in PB's code example above)
chr1sb