Limit progress updates
This commit is contained in:
parent
968bd487b3
commit
eb5f21bf5d
|
@ -459,8 +459,8 @@ struct EpisodeItemView: View {
|
|||
}
|
||||
}
|
||||
.onAppear(perform: {
|
||||
favorite = item.userData!.isFavorite!
|
||||
watched = item.userData!.played!
|
||||
favorite = item.userData?.isFavorite ?? false
|
||||
watched = item.userData?.played ?? false
|
||||
settingState = false
|
||||
})
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
|
|
|
@ -85,12 +85,12 @@ struct LibrarySearchView: View {
|
|||
.foregroundColor(.primary)
|
||||
.lineLimit(1)
|
||||
if item.productionYear != nil {
|
||||
Text(String(item.productionYear ?? 0))
|
||||
Text(String(item.productionYear!))
|
||||
.foregroundColor(.secondary)
|
||||
.font(.caption)
|
||||
.fontWeight(.medium)
|
||||
} else {
|
||||
Text(item.type!)
|
||||
Text(item.type ?? "")
|
||||
}
|
||||
}.frame(width: 100)
|
||||
}
|
||||
|
|
|
@ -123,12 +123,12 @@ struct LibraryView: View {
|
|||
.foregroundColor(.primary)
|
||||
.lineLimit(1)
|
||||
if item.productionYear != nil {
|
||||
Text(String(item.productionYear ?? 0))
|
||||
Text(String(item.productionYear!))
|
||||
.foregroundColor(.secondary)
|
||||
.font(.caption)
|
||||
.fontWeight(.medium)
|
||||
} else {
|
||||
Text(item.type!)
|
||||
Text(item.type ?? "")
|
||||
}
|
||||
}.frame(width: 100)
|
||||
}
|
||||
|
|
|
@ -463,12 +463,12 @@ struct MovieItemView: View {
|
|||
}
|
||||
}
|
||||
.onAppear(perform: {
|
||||
favorite = item.userData!.isFavorite!
|
||||
watched = item.userData!.played!
|
||||
favorite = item.userData?.isFavorite ?? false
|
||||
watched = item.userData?.played ?? false
|
||||
settingState = false
|
||||
})
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.navigationTitle(item.name!)
|
||||
.navigationTitle(item.name ?? "")
|
||||
.supportedOrientations(.allButUpsideDown)
|
||||
.overrideViewPreference(.unspecified)
|
||||
.preferredColorScheme(.none)
|
||||
|
|
|
@ -92,6 +92,7 @@ struct SeriesItemView: View {
|
|||
}
|
||||
.overrideViewPreference(.unspecified)
|
||||
.navigationTitle(item.name ?? "")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -509,15 +509,17 @@ class PlayerViewController: UIViewController, VLCMediaDelegate, VLCMediaPlayerDe
|
|||
|
||||
// MARK: Jellyfin Playstate updates
|
||||
func sendProgressReport(eventName: String) {
|
||||
let progressInfo = PlaybackProgressInfo(canSeek: true, item: manifest, itemId: manifest.id, sessionId: playSessionId, mediaSourceId: manifest.id, audioStreamIndex: Int(selectedAudioTrack), subtitleStreamIndex: Int(selectedCaptionTrack), isPaused: (mediaPlayer.state == .paused), isMuted: false, positionTicks: Int64(mediaPlayer.position * Float(manifest.runTimeTicks!)), playbackStartTimeTicks: Int64(startTime), volumeLevel: 100, brightness: 100, aspectRatio: nil, playMethod: playbackItem.videoType, liveStreamId: nil, playSessionId: playSessionId, repeatMode: .repeatNone, nowPlayingQueue: [], playlistItemId: "playlistItem0")
|
||||
if (eventName == "timeupdate" && mediaPlayer.state == .playing) || eventName != "timeupdate" {
|
||||
let progressInfo = PlaybackProgressInfo(canSeek: true, item: manifest, itemId: manifest.id, sessionId: playSessionId, mediaSourceId: manifest.id, audioStreamIndex: Int(selectedAudioTrack), subtitleStreamIndex: Int(selectedCaptionTrack), isPaused: (mediaPlayer.state == .paused), isMuted: false, positionTicks: Int64(mediaPlayer.position * Float(manifest.runTimeTicks!)), playbackStartTimeTicks: Int64(startTime), volumeLevel: 100, brightness: 100, aspectRatio: nil, playMethod: playbackItem.videoType, liveStreamId: nil, playSessionId: playSessionId, repeatMode: .repeatNone, nowPlayingQueue: [], playlistItemId: "playlistItem0")
|
||||
|
||||
PlaystateAPI.reportPlaybackProgress(playbackProgressInfo: progressInfo)
|
||||
.sink(receiveCompletion: { completion in
|
||||
HandleAPIRequestCompletion(globalData: self.globalData, completion: completion)
|
||||
}, receiveValue: { _ in
|
||||
print("Playback progress report sent!")
|
||||
})
|
||||
.store(in: &globalData.pendingAPIRequests)
|
||||
PlaystateAPI.reportPlaybackProgress(playbackProgressInfo: progressInfo)
|
||||
.sink(receiveCompletion: { completion in
|
||||
HandleAPIRequestCompletion(globalData: self.globalData, completion: completion)
|
||||
}, receiveValue: { _ in
|
||||
print("Playback progress report sent!")
|
||||
})
|
||||
.store(in: &globalData.pendingAPIRequests)
|
||||
}
|
||||
}
|
||||
|
||||
func sendStopReport() {
|
||||
|
|
Loading…
Reference in New Issue