mirror of
https://github.com/cranci1/Sora.git
synced 2026-05-13 13:30:42 +00:00
oh lol it works
Some checks are pending
Build and Release IPA / Build IPA and Mac Catalyst (push) Waiting to run
Some checks are pending
Build and Release IPA / Build IPA and Mac Catalyst (push) Waiting to run
This commit is contained in:
parent
7cec64fc9a
commit
bda1df0b84
1 changed files with 17 additions and 0 deletions
|
|
@ -107,6 +107,7 @@ struct MediaView: View {
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
Button(action: {
|
Button(action: {
|
||||||
|
startWatchingFirstUnfinishedEpisode()
|
||||||
}) {
|
}) {
|
||||||
HStack {
|
HStack {
|
||||||
Image(systemName: "play.fill")
|
Image(systemName: "play.fill")
|
||||||
|
|
@ -224,6 +225,22 @@ struct MediaView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func startWatchingFirstUnfinishedEpisode() {
|
||||||
|
for (index, episode) in episodes.enumerated() {
|
||||||
|
let episodeURL = episode.hasPrefix("https") ? episode : "\(module.module[0].details.baseURL)\(episode)"
|
||||||
|
let totalTime = UserDefaults.standard.double(forKey: "totalTime_\(episodeURL)")
|
||||||
|
let lastPlayedTime = UserDefaults.standard.double(forKey: "lastPlayedTime_\(episodeURL)")
|
||||||
|
let progress = totalTime > 0 ? lastPlayedTime / totalTime : 0
|
||||||
|
|
||||||
|
if progress < 0.90 {
|
||||||
|
selectedEpisode = episode
|
||||||
|
selectedEpisodeNumber = index + 1
|
||||||
|
fetchEpisodeStream(urlString: episodeURL)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func playStream(urlString: String?, fullURL: String) {
|
func playStream(urlString: String?, fullURL: String) {
|
||||||
guard let streamUrl = urlString else { return }
|
guard let streamUrl = urlString else { return }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue