1
0
mirror of https://github.com/yattee/yattee.git synced 2025-01-06 01:20:31 +05:30

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) #if os(macOS)
var windowTitle: String { var windowTitle: String {
currentVideo.isNil ? "Not Playing" : "\(currentVideo!.title) - \(currentVideo!.author)" currentVideo.isNil ? "Not Playing" : "\(currentVideo!.displayTitle) - \(currentVideo!.displayAuthor)"
} }
#else #else
func handleEnterForeground() { func handleEnterForeground() {

View File

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

View File

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

View File

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