Audio-only mpv core on every platform (dedicated com.plezy/mpv_audio_player channels): parameterized android/windows/ linux mpv plugins and a new apple MpvAudioPlayerCore, all skipping video/window paths (vid=no, audio-display=no, gapless-audio=weak). MusicPlaybackService drives an in-memory queue with shuffle/repeat, file-loaded-event gapless arming (property edges coalesce and the android bridge drops them), per-track progress reporting, OS media controls, audio focus, sleep timer, and error auto-skip. PlaybackCoordinator enforces one live native player: starting video disposes the audio core first.
53 lines
1.9 KiB
Swift
53 lines
1.9 KiB
Swift
import Cocoa
|
|
import FlutterMacOS
|
|
|
|
class MainFlutterWindow: NSWindow {
|
|
override func awakeFromNib() {
|
|
let flutterViewController = FlutterViewController()
|
|
|
|
// Keep the window itself opaque so WindowServer does not have to blend the
|
|
// whole video window with the desktop every frame. Flutter stays clear so
|
|
// the native video layer behind it remains visible.
|
|
self.isOpaque = true
|
|
self.backgroundColor = NSColor.black
|
|
flutterViewController.backgroundColor = NSColor.clear
|
|
|
|
let windowFrame = self.frame
|
|
self.contentViewController = flutterViewController
|
|
self.setFrame(windowFrame, display: true)
|
|
|
|
// Apply initial window configuration BEFORE frame restoration
|
|
// This prevents the window from shrinking on launch
|
|
self.titlebarAppearsTransparent = true
|
|
self.titleVisibility = .hidden
|
|
self.styleMask.insert(.fullSizeContentView)
|
|
|
|
// Add forwarding toolbar for click-through in titlebar area
|
|
let toolbar = ForwardingToolbar(flutterViewController: flutterViewController)
|
|
self.toolbar = toolbar
|
|
|
|
// Register MPV player plugin for video playback
|
|
MpvPlayerPlugin.register(
|
|
with: flutterViewController.registrar(forPlugin: "MpvPlayerPlugin"))
|
|
|
|
// Register the audio-only MPV player plugin for music playback
|
|
MpvAudioPlayerPlugin.register(
|
|
with: flutterViewController.registrar(forPlugin: "MpvAudioPlayerPlugin"))
|
|
|
|
// Register window utils plugin for dynamic titlebar/fullscreen control from Dart
|
|
WindowUtilsPlugin.register(
|
|
with: flutterViewController.registrar(forPlugin: "WindowUtilsPlugin"))
|
|
WindowUtilsPlugin.setWindow(self)
|
|
WindowUtilsPlugin.installWindowDelegate()
|
|
WindowUtilsPlugin.syncWindowChrome()
|
|
|
|
RegisterGeneratedPlugins(registry: flutterViewController)
|
|
|
|
// Enable window position/size persistence
|
|
self.setFrameAutosaveName("com.edde746.plezy.MainWindow")
|
|
WindowUtilsPlugin.syncWindowChrome()
|
|
|
|
super.awakeFromNib()
|
|
}
|
|
}
|