feat: Re-add native apple controls for mpv (#1411)

This commit is contained in:
Alex
2026-02-19 17:38:01 +11:00
committed by GitHub
parent 8a782fb0c9
commit 9f9d949891
7 changed files with 361 additions and 9 deletions

View File

@@ -43,6 +43,21 @@ public class MpvPlayerModule: Module {
view.loadVideo(config: config)
}
// Now Playing metadata for iOS Control Center and Lock Screen
Prop("nowPlayingMetadata") { (view: MpvPlayerView, metadata: [String: Any]?) in
guard let metadata = metadata else { return }
// Convert Any values to String, filtering out nil/null values
var stringMetadata: [String: String] = [:]
for (key, value) in metadata {
if let stringValue = value as? String {
stringMetadata[key] = stringValue
}
}
if !stringMetadata.isEmpty {
view.setNowPlayingMetadata(stringMetadata)
}
}
// Async function to play video
AsyncFunction("play") { (view: MpvPlayerView) in
view.play()