PLay Movie Full Screen DirectX ???
-
DaylightDreamer
- User

- Posts: 52
- Joined: Wed Feb 04, 2009 8:11 am
- Location: Armenia
PLay Movie Full Screen DirectX ???
Is there a proper way to play a movie in the OpenedScrenn ??? RenderMovieFrame seems to be removed in 5.20 ....
Re: PLay Movie Full Screen DirectX ???
Hello DaylightDreamer. This example works with two short WMV and AVI videos from the web:Hope it works for you too. 
Code: Select all
InitNetwork()
selection.s = InputRequester("Select Video:", "Enter 1 for WMV video (100KB) " +
"or 2 for AVI video (1MB)", "")
If selection = "2"
ReceiveHTTPFile("https://dl.dropboxusercontent.com/u/38177172/dominoPCs.avi",
GetTemporaryDirectory() + "dominoPCs.avi")
videoFile.s = GetTemporaryDirectory() + "dominoPCs.avi"
Else
ReceiveHTTPFile("https://dl.dropboxusercontent.com/u/38177172/catfight.wmv",
GetTemporaryDirectory() + "catfight.wmv")
videoFile.s = GetTemporaryDirectory() + "catfight.wmv"
EndIf
If videoFile And
InitMovie() And
InitSprite() And
InitKeyboard() And
LoadMovie(0, videoFile)
ResizeMovie(0, 0, 0,
GetSystemMetrics_(#SM_CXSCREEN),
GetSystemMetrics_(#SM_CYSCREEN))
OpenScreen(GetSystemMetrics_(#SM_CXSCREEN),
GetSystemMetrics_(#SM_CYSCREEN),
16, "", #PB_Screen_WaitSynchronization)
PlayMovie(0, ScreenID())
MovieAudio(0, 50, 0)
Repeat
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
Else
MessageRequester("Fullscreen Playback:", "Unable to play video.")
EndIfTexas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel 
-
DaylightDreamer
- User

- Posts: 52
- Joined: Wed Feb 04, 2009 8:11 am
- Location: Armenia
Re: PLay Movie Full Screen DirectX ???
Nope 
It doesn't work.
I have try several codecs, I'm using Windows 7
It doesn't work.
I have try several codecs, I'm using Windows 7
Re: PLay Movie Full Screen DirectX ???
Nothing but a black screen here, too.
If I download the AVI file to my desktop, though, it plays just fine.
So I obviously have the necessary codecs installed, but PureBasic
can't play it for some reason.
If I download the AVI file to my desktop, though, it plays just fine.
So I obviously have the necessary codecs installed, but PureBasic
can't play it for some reason.
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.
Re: PLay Movie Full Screen DirectX ???
Just some observations:
By only changing this part of the code - it plays:
Change this part as well and it plays with less distortion:
By only changing this part of the code - it plays:
Code: Select all
OpenScreen(500, 500, 16, "", #PB_Screen_WaitSynchronization)Code: Select all
ResizeMovie(0, 0, 0, 500, 500)If you're not investing in yourself, you're falling behind.
My PureBasic Stuff ➤ FREE STUFF, Scripts & Programs.
My PureBasic Forum ➤ Questions, Requests & Comments.
Re: PLay Movie Full Screen DirectX ???
DaylightDreamer wrote:It doesn't work...
Hi guys! Please try changing the color depth from 16 to 32:PB wrote:Nothing but a black screen here, too...
Code: Select all
OpenScreen(GetSystemMetrics_(#SM_CXSCREEN),
GetSystemMetrics_(#SM_CYSCREEN),
32, "", #PB_Screen_WaitSynchronization)Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel 
Re: PLay Movie Full Screen DirectX ???
> it could be an issue with the video card
But why does it play with Media Player Classic?
Same codecs, video display, graphics card.
Also, changing it to a 16-bit display didn't help.
Lastly, I don't get the "Unable to play video" message.
Just a black screen until I hit Esc to end the app.
But why does it play with Media Player Classic?
Same codecs, video display, graphics card.
Also, changing it to a 16-bit display didn't help.
Lastly, I don't get the "Unable to play video" message.
Just a black screen until I hit Esc to end the app.
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.
Re: PLay Movie Full Screen DirectX ???
Hello PB.
The hardware may support the format, but we simply need to correct the configuration settings of OpenScreen() to work with it. WMP clearly detects and handles these settings automatically.PB wrote:But why does it play with Media Player Classic?
Same codecs, video display, graphics card.
Are you referring to the OS display settings or the depth setting of the OpenScreen() function in the example? I suggested changing the OpenScreen() function's depth setting to 32, as such:PB wrote:Also, changing it to a 16-bit display didn't help.
Code: Select all
OpenScreen(GetSystemMetrics_(#SM_CXSCREEN),
GetSystemMetrics_(#SM_CYSCREEN),
32, "", #PB_Screen_WaitSynchronization)
If the code execution reaches the "Unable to play video" error message, that would mean that either the movie was not received, did not load, or one of the device initialisations failed. If that's the case, your issue is not with OpenScreen(). This modified example includes separate error checks. Perhaps if you give it a try, you could determine where the error lies:PB wrote:Lastly, I don't get the "Unable to play video" message.
Just a black screen until I hit Esc to end the app.
Code: Select all
If InitNetwork()
Macro err(msg)
MessageRequester("Fullscreen Playback:", msg)
EndMacro
selection.s = InputRequester("Select Video:", "Enter 1 for WMV video (100KB) " +
"or 2 for AVI video (1MB)", "")
If selection = "2"
fileReceived = ReceiveHTTPFile("https://dl.dropboxusercontent.com/u/38177172/dominoPCs.avi",
GetTemporaryDirectory() + "dominoPCs.avi")
videoFile.s = GetTemporaryDirectory() + "dominoPCs.avi"
Else
fileReceived = ReceiveHTTPFile("https://dl.dropboxusercontent.com/u/38177172/catfight.wmv",
GetTemporaryDirectory() + "catfight.wmv")
videoFile.s = GetTemporaryDirectory() + "catfight.wmv"
EndIf
If fileReceived
If InitMovie()
If InitSprite()
If InitKeyboard()
If LoadMovie(0, videoFile)
ResizeMovie(0, 0, 0,
GetSystemMetrics_(#SM_CXSCREEN),
GetSystemMetrics_(#SM_CYSCREEN))
OpenScreen(GetSystemMetrics_(#SM_CXSCREEN),
GetSystemMetrics_(#SM_CYSCREEN),
32, "", #PB_Screen_WaitSynchronization)
PlayMovie(0, ScreenID())
MovieAudio(0, 50, 0)
Repeat
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
Else
err("LoadMovie() failed.")
EndIf
Else
err("InitKeyboard() failed.")
EndIf
Else
err("InitSprite() failed.")
EndIf
Else
err("InitMovie() failed.")
EndIf
Else
err("Video file not received.")
EndIf
Else
err("InitNetwork() failed.")
EndIfTexas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel 
Re: PLay Movie Full Screen DirectX ???
Oops, changing from 16-bit to 32-bit makes it work! 
For some reason I never changed it from 16. My bad!
Thanks for your patience and help, and sorry that it
was my fault all along.
For some reason I never changed it from 16. My bad!
Thanks for your patience and help, and sorry that it
was my fault all along.
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.
-
DaylightDreamer
- User

- Posts: 52
- Joined: Wed Feb 04, 2009 8:11 am
- Location: Armenia
Re: PLay Movie Full Screen DirectX ???
Yep it works like that,
However this seems to work only with native OS resolution
Once you try to set different resolution it doesn't open
Besides this seem not DirectX playback
What i need in fact is to render an intro movie for a game or maybe a cut scene
However this seems to work only with native OS resolution
Once you try to set different resolution it doesn't open
Besides this seem not DirectX playback
What i need in fact is to render an intro movie for a game or maybe a cut scene
Re: PLay Movie Full Screen DirectX ???
Hi DaylightDreamer. Yes, for full screen playback it seems that the screen size must match the display resolution. However, playback at lower resolutions is still possible, but it wouldn't be full screen, as demonstrated here:DaylightDreamer wrote:...this seems to work only with native OS resolution
Once you try to set different resolution it doesn't open
Code: Select all
If InitNetwork()
Macro err(msg)
MessageRequester("Fullscreen Playback:", msg)
EndMacro
selection.s = InputRequester("Select Video:", "Enter 1 for WMV video (100KB) " +
"or 2 for AVI video (1MB)", "")
If selection = "2"
fileReceived = ReceiveHTTPFile("https://dl.dropboxusercontent.com/u/38177172/dominoPCs.avi",
GetTemporaryDirectory() + "dominoPCs.avi")
videoFile.s = GetTemporaryDirectory() + "dominoPCs.avi"
Else
fileReceived = ReceiveHTTPFile("https://dl.dropboxusercontent.com/u/38177172/catfight.wmv",
GetTemporaryDirectory() + "catfight.wmv")
videoFile.s = GetTemporaryDirectory() + "catfight.wmv"
EndIf
If fileReceived
If InitMovie()
If InitSprite()
If InitKeyboard()
If LoadMovie(0, videoFile)
ResizeMovie(0, 0, 0, 400, 300)
OpenScreen(400, 300, 32, "", #PB_Screen_WaitSynchronization)
PlayMovie(0, ScreenID())
MovieAudio(0, 50, 0)
Repeat
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
Else
err("LoadMovie() failed.")
EndIf
Else
err("InitKeyboard() failed.")
EndIf
Else
err("InitSprite() failed.")
EndIf
Else
err("InitMovie() failed.")
EndIf
Else
err("Video file not received.")
EndIf
Else
err("InitNetwork() failed.")
EndIfDaylightDreamer wrote:Besides this seem not DirectX playback
What i need in fact is to render an intro movie for a game or maybe a cut scene
Not really sure about this, but according to the PureBasic manual, the PlayMovie() function utilises DirectX.PureBasic Manual - Movie wrote:Windows: as it uses the DirectX 7 technology (DirectShow), any kind of media can be played with this library: AVI, MPG, DivX, Mp3 etc.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel 

