Platforms to show: All Mac Windows Linux Cross-Platform
/AVFoundation/MoviePlayer Rate
Required plugins for this example: MBS AVFoundation Plugin, MBS MacCG Plugin, MBS MacCF Plugin, MBS Main Plugin, MBS MacBase Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /AVFoundation/MoviePlayer Rate
This example is the version from Wed, 8th Sep 2015.
Project "MoviePlayer Rate.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control MoviePlayer1 Inherits MoviePlayer
ControlInstance MoviePlayer1 Inherits MoviePlayer
EventHandler Sub Open()
dim f as FolderItem = SpecialFolder.Desktop.Child("test.mp4")
dim m as movie = f.OpenAsMovie
MoviePlayer1.movie = m
End EventHandler
End Control
Control Slider1 Inherits Slider
ControlInstance Slider1 Inherits Slider
EventHandler Sub ValueChanged()
MoviePlayer1.RateMBS = me.Value / 100.0
End EventHandler
End Control
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Module ModuleMoviePlayer
Function RateMBS(extends m as MoviePlayer) As double
#if TargetMacOS then
#if RBVersion >= 2014.0 then
// newer AVFoundation
dim p as AVPlayerMBS = m.AVPlayerMBS
return p.rate
#else
// old QuickTime
return m.rate
#endif
#elseif TargetWin32 then
#if RBVersion < 2014.0 then
if m.PlayerType = 1 then
// QuickTime
return m.Rate
end if
#endif
dim o as OLEObject = m.MovieController
'MsgBox o.TypeName
return o.Player.settings.rate
#endif
End Function
Sub RateMBS(extends m as MoviePlayer, assigns r as Double)
#if TargetMacOS then
#if RBVersion >= 2014.0 then
// newer AVFoundation
dim p as AVPlayerMBS = m.AVPlayerMBS
p.rate = r
#else
// old QuickTime
m.Rate = r
#endif
#elseif TargetWin32 then
#if RBVersion < 2014.0 then
if m.PlayerType = 1 then
// QuickTime
m.Rate = r
Return
end if
#endif
// Windows Media Player
dim o as OLEObject = m.MovieController
'MsgBox o.TypeName
o.Player.settings.rate = r
#endif
End Sub
End Module
End Project
The items on this page are in the following plugins: MBS AVFoundation Plugin.