mirror of
https://github.com/cranci1/Sora.git
synced 2026-05-06 18:19:35 +00:00
uh idk
This commit is contained in:
parent
182244b708
commit
78ccc08545
2 changed files with 37 additions and 1 deletions
|
|
@ -35,7 +35,7 @@ struct MusicProgressSlider<T: BinaryFloatingPoint>: View {
|
|||
.mask({
|
||||
HStack {
|
||||
Rectangle()
|
||||
.frame(width: max(bounds.size.width * CGFloat((localRealProgress + localTempProgress)), 0), alignment: .leading)
|
||||
.frame(width: max((bounds.size.width * CGFloat(localRealProgress + localTempProgress)).isFinite ? bounds.size.width * CGFloat(localRealProgress + localTempProgress) : 0, 0), alignment: .leading)
|
||||
Spacer(minLength: 0)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ struct MediaInfoView: View {
|
|||
@State var isRefetching: Bool = true
|
||||
@State var isFetchingEpisode: Bool = false
|
||||
|
||||
@State private var selectedEpisode: String = ""
|
||||
@State private var selectedEpisodeNumber: Int = 0
|
||||
|
||||
@AppStorage("externalPlayer") private var externalPlayer: String = "Default"
|
||||
@AppStorage("episodeChunkSize") private var episodeChunkSize: Int = 100
|
||||
|
||||
|
|
@ -384,6 +387,26 @@ struct MediaInfoView: View {
|
|||
scheme = "outplayer://\(url)"
|
||||
case "nPlayer":
|
||||
scheme = "nplayer-\(url)"
|
||||
case "Sora":
|
||||
let customMediaPlayer = CustomMediaPlayer(
|
||||
module: module,
|
||||
urlString: url,
|
||||
fullUrl: fullURL,
|
||||
title: title,
|
||||
episodeNumber: selectedEpisodeNumber,
|
||||
onWatchNext: {
|
||||
selectNextEpisode()
|
||||
}
|
||||
)
|
||||
let hostingController = UIHostingController(rootView: customMediaPlayer)
|
||||
hostingController.modalPresentationStyle = .fullScreen
|
||||
Logger.shared.log("Opening custom media player with url: \(url)")
|
||||
|
||||
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
|
||||
let rootVC = windowScene.windows.first?.rootViewController {
|
||||
rootVC.present(hostingController, animated: true, completion: nil)
|
||||
}
|
||||
return
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
|
@ -404,6 +427,19 @@ struct MediaInfoView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func selectNextEpisode() {
|
||||
guard let currentEpisodeIndex = episodeLinks.firstIndex(where: { $0.href == selectedEpisode }) else { return }
|
||||
let nextEpisodeIndex = currentEpisodeIndex + 1
|
||||
print(nextEpisodeIndex)
|
||||
if nextEpisodeIndex < episodeLinks.count {
|
||||
selectedEpisode = episodeLinks[nextEpisodeIndex].href
|
||||
selectedEpisodeNumber = episodeLinks[nextEpisodeIndex].number
|
||||
let nextEpisodeURL = episodeLinks[nextEpisodeIndex].href
|
||||
fetchStream(href: nextEpisodeURL)
|
||||
print(nextEpisodeURL)
|
||||
}
|
||||
}
|
||||
|
||||
private func openSafariViewController(with urlString: String) {
|
||||
guard let url = URL(string: urlString) else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue