Platforms to show: All Mac Windows Linux Cross-Platform
/AVFoundation/AVRoutePickerView test
Required plugins for this example: MBS MacBase Plugin, MBS AVFoundation Plugin, MBS MacCG Plugin, MBS MacCF Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /AVFoundation/AVRoutePickerView test
This example is the version from Mon, 2nd Feb 2020.
Project "AVRoutePickerView test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub NewDocument()
dim f as FolderItem = GetOpenFolderItem("")
if f <> nil then
OpenDocument f
end if
End EventHandler
EventHandler Sub Open()
#if Target64Bit and TargetMacOS then
// okay
#else
MsgBox "Please run on 64-bit Mac."
#endif
End EventHandler
EventHandler Sub OpenDocument(item As FolderItem)
Dim player As New AVPlayerMBS(item)
dim w as new PlayerWindow
w.Title = item.DisplayName
w.player = player
w.AVPlayerView.player = player
End EventHandler
End Class
Class PlayerWindow Inherits Window
Control AVPlayerView Inherits AVPlayerViewControlMBS
ControlInstance AVPlayerView Inherits AVPlayerViewControlMBS
End Control
Control AVRoutePickerView Inherits AVRoutePickerViewControlMBS
ControlInstance AVRoutePickerView Inherits AVRoutePickerViewControlMBS
End Control
EventHandler Sub Open()
If AVRouteDetectorMBS.available Then
// lets see whether there are airplay devices...
RouteDetector = New AVRouteDetectorMBS
AddHandler RouteDetector.MultipleRoutesDetectedDidChange, WeakAddressOf MultipleRoutesDetectedDidChange
RouteDetector.RouteDetectionEnabled = True
If AVRoutePickerView.Handle <> 0 Then
AVRoutePickerView.player = AVPlayerView.player
Else
Break // not available.
// AVRoutePickerView requires MacOS 10.15
End If
Else
Break // not available
End If
End EventHandler
Sub MultipleRoutesDetectedDidChange(RouteDetector as AVRouteDetectorMBS)
Dim MultipleRoutesDetected As Boolean = RouteDetector.MultipleRoutesDetected
AVRoutePickerView.Visible = MultipleRoutesDetected
End Sub
Property RouteDetector As AVRouteDetectorMBS
Property player As AVPlayerMBS
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
End Project
The items on this page are in the following plugins: MBS AVFoundation Plugin.