Local videos fixes

This commit is contained in:
Arkadiusz Fal 2022-11-11 19:19:48 +01:00
parent 4cb9e24796
commit 80d8d66986
4 changed files with 12 additions and 7 deletions

View File

@ -806,7 +806,7 @@ final class PlayerModel: ObservableObject {
#if os(macOS)
var windowTitle: String {
currentVideo.isNil ? "Not Playing" : "\(currentVideo!.title) - \(currentVideo!.author)"
currentVideo.isNil ? "Not Playing" : "\(currentVideo!.displayTitle) - \(currentVideo!.displayAuthor)"
}
#else
func handleEnterForeground() {

View File

@ -59,16 +59,21 @@ extension PlayerModel {
DispatchQueue.main.async { [weak self] in
guard let self else { return }
guard let video = self.currentVideo else {
guard let video = item.video else {
return
}
self.videoBeingOpened = nil
if video.isLocal {
self.availableStreams = video.streams
return
}
guard let playerInstance = self.playerInstance else { return }
let streamsInstance = video.streams.compactMap(\.instance).first
if !video.isLocal, video.streams.isEmpty || streamsInstance != playerInstance {
if video.streams.isEmpty || streamsInstance != playerInstance {
self.loadAvailableStreams(video)
} else {
self.availableStreams = self.streamsWithInstance(instance: playerInstance, streams: video.streams)

View File

@ -111,12 +111,12 @@ struct PlayerControls: View {
if playerControlsLayout.displaysTitleLine {
VStack(alignment: .leading) {
Text(player.currentVideo?.title ?? "Not Playing")
Text(player.currentVideo?.displayTitle ?? "Not Playing")
.shadow(radius: 10)
.font(.system(size: playerControlsLayout.titleLineFontSize).bold())
.lineLimit(1)
Text(player.currentVideo?.channel.name ?? "")
Text(player.currentVideo?.displayAuthor ?? "")
.fontWeight(.semibold)
.shadow(radius: 10)
.foregroundColor(.secondary)

View File

@ -163,7 +163,7 @@ struct VideoCell: View {
.frame(maxWidth: 320)
VStack(alignment: .leading, spacing: 0) {
videoDetail(video.title, lineLimit: 5)
videoDetail(video.displayTitle, lineLimit: 5)
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
if !channelOnThumbnail, !inChannelView {
@ -240,7 +240,7 @@ struct VideoCell: View {
VStack(alignment: .leading, spacing: 0) {
Group {
VStack(alignment: .leading, spacing: 0) {
videoDetail(video.title, lineLimit: 2)
videoDetail(video.displayTitle, lineLimit: 2)
#if os(tvOS)
.frame(minHeight: 60, alignment: .top)
#elseif os(macOS)