QuickTime is no longer used from Beta 7.
You only realise that there is no decoder when you query MovieInfo (frames per second) or perform PlayMovie and the picture 'disable play' appears.
The automatic video control is probably not implemented.
To test it, I first had to convert the video 'Big Buck Bunny' from AVI to MOV.
Full movie player for testing ...
Code: Select all
;-TOP by mk-soft, v1.01.3, 07.05.2022 - 15.05.2022
#ProgramTitle = "Main Movie Window"
#Version = "v1.01.3"
Enumeration Windows
#Main
#Dialog
EndEnumeration
Enumeration Menubar
#MainMenu
EndEnumeration
Enumeration MenuItems
#MainMenuExitApplication
#MainMenuOpen
#MainMenuPlay
#MainMenuPause
#MainMenuResume
#MainMenuStop
#MainMenuSeekPlus
#MainMenuSeekMinus
#MainMenuVolumen
#MainMenuBalance
EndEnumeration
Enumeration Gadgets
#DialogTextVolumen
#DialogTextBalance
#DialogScrollVolumen
#DialogScrollBalance
EndEnumeration
Enumeration Statusbar
#MainStatusBar
EndEnumeration
Global ExitApplication
Global movie.s, movieID, frames_per_second, frame_pos, frame_len, movie_dx, movie_dy
Global volumen = 100
Global balance = 0
; ----
Procedure UpdateWindow()
Protected dx, dy
dx = WindowWidth(#Main)
dy = WindowHeight(#Main) - StatusBarHeight(#MainStatusBar) - MenuHeight()
; Resize gadgets
If IsMovie(0)
ResizeMovie(0, 0, 0, dx, dy)
EndIf
EndProcedure
; ----
Procedure UpdateStatus()
Protected info.s, time
info = "Frames: " + Str(frame_pos) + " / " + Str(frame_len)
StatusBarText(#MainStatusBar, 0, info)
If frames_per_second
time = frame_pos * 1000 / frames_per_second
info = RSet(Str(time / 60), 3, "0") + ":" + RSet(Str(time % 60), 2, "0")
time = frame_len * 1000 / frames_per_second
info + " / " + RSet(Str(time / 60), 3, "0") + ":" + RSet(Str(time % 60), 2, "0")
Else
info = "Invalid frame data"
EndIf
StatusBarText(#MainStatusBar, 1, info)
EndProcedure
; ----
Procedure Dialog()
If OpenWindow(#Dialog, #PB_Ignore, #PB_Ignore, 340, 100, "Audio", #PB_Window_Tool)
TextGadget(#DialogTextVolumen, 10, 10, 120, 25, "Volumen " + volumen)
TextGadget(#DialogTextBalance, 10, 50, 120, 25, "Balance " + balance)
ScrollBarGadget(#DialogScrollVolumen, 140, 10, 180, 30, 0, 100, 1)
ScrollBarGadget(#DialogScrollBalance, 140, 50, 180, 30, 0, 200, 1)
SetGadgetState(#DialogScrollVolumen, volumen)
SetGadgetState(#DialogScrollBalance, balance + 100)
EndIf
EndProcedure
; ----
Procedure Main()
Protected dx, dy, status
#MainStyle = #PB_Window_SystemMenu | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget
If OpenWindow(#Main, #PB_Ignore, #PB_Ignore, 600, 400, #ProgramTitle , #MainStyle)
; Menu
CreateMenu(#MainMenu, WindowID(#Main))
MenuTitle("File")
MenuItem(#MainMenuOpen, "&Open Movie")
MenuBar()
MenuItem(#MainMenuExitApplication, "E&xit")
MenuTitle("Control")
MenuItem(#MainMenuPlay, "Play")
MenuItem(#MainMenuPause, "Pause")
MenuItem(#MainMenuResume, "Resume")
MenuItem(#MainMenuStop, "Stop")
MenuBar()
MenuItem(#MainMenuSeekPlus, "Seek +")
MenuItem(#MainMenuSeekMinus, "Seek -")
MenuTitle("Audio")
MenuItem(#MainMenuVolumen, "Volumen")
MenuItem(#MainMenuBalance, "Balance")
; For Mac
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
If Not IsMenu(#MainMenu)
CreateMenu(#MainMenu, WindowID(#Main))
EndIf
MenuItem(#PB_Menu_About, "")
MenuItem(#PB_Menu_Preferences, "")
CompilerEndIf
; StatusBar
CreateStatusBar(#MainStatusBar, WindowID(#Main))
AddStatusBarField(160)
AddStatusBarField(120)
AddStatusBarField(#PB_Ignore)
StatusBarText(#MainStatusBar, 0, " " + #Version)
; Gadgets
dx = WindowWidth(#Main)
dy = WindowHeight(#Main) - StatusBarHeight(#MainStatusBar) - MenuHeight()
; Bind events
BindEvent(#PB_Event_SizeWindow, @UpdateWindow(), #Main)
; Main loop
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Select EventWindow()
Case #Main
ExitApplication = #True
Case #Dialog
CloseWindow(#Dialog)
EndSelect
Case #PB_Event_Menu
Select EventMenu()
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
Case #PB_Menu_About
MessageRequester("Info", #ProgramTitle + " " + #Version)
Case #PB_Menu_Preferences
Case #PB_Menu_Quit
PostEvent(#PB_Event_CloseWindow, #Main, #Null)
CompilerEndIf
Case #MainMenuExitApplication
PostEvent(#PB_Event_CloseWindow, #Main, #Null)
Case #MainMenuOpen
movie = OpenFileRequester("Choose the movie to play", "", "Movie files|*.avi;*.mpg|All Files|*.*", 0)
If movie
If movieID
RemoveWindowTimer(#Main, 1)
StopMovie(0)
FreeMovie(0)
EndIf
movieID = LoadMovie(0, movie)
If movieID
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
;- Windows MovieInfo Frames per second * 1000
frames_per_second = (MovieInfo(0, 0) + 1) * 1000
CompilerElse
frames_per_second = MovieInfo(0, 0)
CompilerEndIf
frame_len = MovieLength(0)
frame_pos = MovieStatus(0)
movie_dx = MovieWidth(0)
movie_dy = MovieHeight(0)
If movie_dx > 0 And movie_dy > 0
dy = movie_dy + StatusBarHeight(#MainStatusBar) + MenuHeight()
ResizeWindow(#Main, #PB_Ignore, #PB_Ignore, movie_dx, dy)
EndIf
UpdateStatus()
StatusBarText(#MainStatusBar, 2, movie)
MovieAudio(0, volumen, balance)
Else
StatusBarText(#MainStatusBar, 1, "")
MessageRequester("Error", "Can't load the movie...", #PB_MessageRequester_Error)
EndIf
EndIf
Case #MainMenuPlay
If movieID
PlayMovie(0, WindowID(#Main))
AddWindowTimer(#Main, 1, 1000)
EndIf
Case #MainMenuPause
If movieID
PauseMovie(0)
EndIf
Case #MainMenuResume
If movieID
ResumeMovie(0)
EndIf
Case #MainMenuStop
If movieID
StopMovie(0)
RemoveWindowTimer(#Main, 1)
EndIf
Case #MainMenuSeekPlus
If movieID
frame_pos + (frames_per_second * 60 / 1000) ; Add 60s
If frame_pos > frame_len
frame_pos = frame_len
EndIf
MovieSeek(0, frame_pos)
EndIf
Case #MainMenuSeekMinus
If movieID
frame_pos - (frames_per_second * 60 / 1000) ; Sub 60s
If frame_pos < 0
frame_pos = 0
EndIf
MovieSeek(0, frame_pos)
EndIf
Case #MainMenuVolumen
If Not IsWindow(#Dialog)
Dialog()
EndIf
Case #MainMenuBalance
If Not IsWindow(#Dialog)
Dialog()
EndIf
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
Case #DialogScrollVolumen
volumen = GetGadgetState(#DialogScrollVolumen)
SetGadgetText(#DialogTextVolumen, "Volumen " + volumen)
If movieID
MovieAudio(0, volumen, balance)
EndIf
Case #DialogScrollBalance
balance = GetGadgetState(#DialogScrollBalance) - 100
SetGadgetText(#DialogTextBalance, "Balance " + balance)
If movieID
MovieAudio(0, volumen, balance)
EndIf
EndSelect
Case #PB_Event_Timer
Select EventTimer()
Case 1
If movieID
status = MovieStatus(0)
If status > 0
;- Simulate frame postion (Raspberry)
If status = 1
frame_pos + (frames_per_second / 1000)
Else
frame_pos = status
EndIf
UpdateStatus()
EndIf
EndIf
EndSelect
EndSelect
Until ExitApplication
EndIf
EndProcedure
If InitMovie()
Main()
Else
MessageRequester("Error", "Can't initialize movie playback !", #PB_MessageRequester_Error)
EndIf