mirror of
https://github.com/cranci1/Sora.git
synced 2026-05-06 18:19:35 +00:00
test
This commit is contained in:
parent
8e0563facc
commit
519744616e
2 changed files with 22 additions and 13 deletions
|
|
@ -25,6 +25,8 @@ class VideoPlayerViewController: UIViewController {
|
|||
var episodeImageUrl: String = ""
|
||||
var mediaTitle: String = ""
|
||||
|
||||
var detachedWindow: UIWindow?
|
||||
|
||||
init(module: ScrapingModule) {
|
||||
self.module = module
|
||||
super.init(nibName: nil, bundle: nil)
|
||||
|
|
|
|||
|
|
@ -1248,8 +1248,7 @@ struct MediaInfoView: View {
|
|||
var title: String = ""
|
||||
var streamUrl: String = ""
|
||||
var headers: [String:String]? = nil
|
||||
if let sources = sources as? [String]
|
||||
{
|
||||
if let sources = sources as? [String] {
|
||||
if index + 1 < sources.count {
|
||||
if !sources[index].lowercased().contains("http") {
|
||||
title = sources[index]
|
||||
|
|
@ -1265,16 +1264,11 @@ struct MediaInfoView: View {
|
|||
streamUrl = sources[index]
|
||||
index += 1
|
||||
}
|
||||
}
|
||||
else if let sources = sources as? [[String: Any]]
|
||||
{
|
||||
if let currTitle = sources[index]["title"] as? String
|
||||
{
|
||||
} else if let sources = sources as? [[String: Any]] {
|
||||
if let currTitle = sources[index]["title"] as? String {
|
||||
title = currTitle
|
||||
streamUrl = (sources[index]["streamUrl"] as? String) ?? ""
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
title = "Stream \(streamIndex)"
|
||||
streamUrl = (sources[index]["streamUrl"] as? String)!
|
||||
}
|
||||
|
|
@ -1361,9 +1355,7 @@ struct MediaInfoView: View {
|
|||
videoPlayerViewController.aniListID = itemID ?? 0
|
||||
videoPlayerViewController.modalPresentationStyle = .fullScreen
|
||||
|
||||
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene, let rootVC = windowScene.windows.first?.rootViewController {
|
||||
rootVC.present(videoPlayerViewController, animated: true, completion: nil)
|
||||
}
|
||||
presentPlayerWithDetachedContext(videoPlayerViewController: videoPlayerViewController)
|
||||
return
|
||||
default:
|
||||
break
|
||||
|
|
@ -1974,4 +1966,19 @@ if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScen
|
|||
}
|
||||
}.resume()
|
||||
}
|
||||
|
||||
private func presentPlayerWithDetachedContext(videoPlayerViewController: VideoPlayerViewController) {
|
||||
guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene else { return }
|
||||
|
||||
let detachedWindow = UIWindow(windowScene: windowScene)
|
||||
let hostingController = UIViewController()
|
||||
hostingController.view.backgroundColor = .clear
|
||||
detachedWindow.rootViewController = hostingController
|
||||
detachedWindow.backgroundColor = .clear
|
||||
detachedWindow.windowLevel = .normal + 1
|
||||
detachedWindow.makeKeyAndVisible()
|
||||
|
||||
videoPlayerViewController.detachedWindow = detachedWindow
|
||||
hostingController.present(videoPlayerViewController, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue