PLay Movie Full Screen DirectX ???
Posted: Fri Oct 18, 2013 7:58 am
Is there a proper way to play a movie in the OpenedScrenn ??? RenderMovieFrame seems to be removed in 5.20 ....
http://www.purebasic.com
https://www.purebasic.fr/english/
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.")
EndIfCode: Select all
OpenScreen(500, 500, 16, "", #PB_Screen_WaitSynchronization)Code: Select all
ResizeMovie(0, 0, 0, 500, 500)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)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.")
EndIfHi 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.