added external player

This commit is contained in:
cranci1 2025-01-31 15:42:40 +01:00
parent 586e9731f8
commit d16c009360

View file

@ -372,6 +372,26 @@ struct MediaInfoView: View {
func playStream(url: String, fullURL: String) {
DispatchQueue.main.async {
let externalPlayer = UserDefaults.standard.string(forKey: "externalPlayer") ?? "Default"
var scheme: String?
switch externalPlayer {
case "Infuse":
scheme = "infuse://x-callback-url/play?url=\(url)"
case "VLC":
scheme = "vlc://\(url)"
case "OutPlayer":
scheme = "outplayer://\(url)"
case "nPlayer":
scheme = "nplayer-\(url)"
default:
break
}
if let scheme = scheme, let url = URL(string: scheme), UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
Logger.shared.log("Opening external app with scheme: \(url)", type: "General")
} else {
let videoPlayerViewController = VideoPlayerViewController(module: module)
videoPlayerViewController.streamUrl = url
videoPlayerViewController.fullUrl = fullURL
@ -383,6 +403,7 @@ struct MediaInfoView: View {
}
}
}
}
private func openSafariViewController(with urlString: String) {
guard let url = URL(string: urlString) else {