fix playback if no audio track

This commit is contained in:
Aiden Vigue 2021-05-24 17:53:31 -04:00
parent 88956f33b4
commit 4801b01b16
6 changed files with 92 additions and 73 deletions

View File

@ -462,7 +462,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 14; CURRENT_PROJECT_VERSION = 15;
DEVELOPMENT_ASSET_PATHS = "\"JellyfinPlayer/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"JellyfinPlayer/Preview Content\"";
DEVELOPMENT_TEAM = 9R8RREG67J; DEVELOPMENT_TEAM = 9R8RREG67J;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
@ -491,7 +491,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 14; CURRENT_PROJECT_VERSION = 15;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "\"JellyfinPlayer/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"JellyfinPlayer/Preview Content\"";
DEVELOPMENT_TEAM = 9R8RREG67J; DEVELOPMENT_TEAM = 9R8RREG67J;

View File

@ -107,74 +107,78 @@ struct ContinueWatchingView: View {
var body: some View { var body: some View {
ScrollView(.horizontal, showsIndicators: false) { ScrollView(.horizontal, showsIndicators: false) {
LazyHStack() { if(_resumeItems.wrappedValue.count > 0) {
Spacer().frame(width:16) LazyHStack() {
ForEach(resumeItems, id: \.Id) { item in Spacer().frame(width:16)
NavigationLink(destination: ItemView(item: item)) { ForEach(resumeItems, id: \.Id) { item in
VStack(alignment: .leading) { NavigationLink(destination: ItemView(item: item)) {
Spacer().frame(height: 10) VStack(alignment: .leading) {
if(item.Type == "Episode") { Spacer().frame(height: 10)
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.Id)/Images/\(item.ImageType)?maxWidth=550&quality=80&tag=\(item.Image)")!) if(item.Type == "Episode") {
.resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.Id)/Images/\(item.ImageType)?maxWidth=550&quality=80&tag=\(item.Image)")!)
.placeholder { .resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 6, height: 6))!) .placeholder {
.resizable() Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 6, height: 6))!)
.frame(width: 320, height: 180) .resizable()
.cornerRadius(10) .frame(width: 320, height: 180)
} .cornerRadius(10)
.frame(width: 320, height: 180) }
.cornerRadius(10) .frame(width: 320, height: 180)
.overlay( .cornerRadius(10)
ZStack { .overlay(
Text("S\(String(item.ParentIndexNumber ?? 0)):E\(String(item.IndexNumber ?? 0)) - \(item.Name)") ZStack {
.font(.caption) Text("S\(String(item.ParentIndexNumber ?? 0)):E\(String(item.IndexNumber ?? 0)) - \(item.Name)")
.padding(6) .font(.caption)
.foregroundColor(.white) .padding(6)
}.background(Color.black) .foregroundColor(.white)
.opacity(0.8) }.background(Color.black)
.cornerRadius(10.0) .opacity(0.8)
.padding(6), alignment: .topTrailing .cornerRadius(10.0)
) .padding(6), alignment: .topTrailing
.overlay( )
Rectangle() .overlay(
.fill(Color(red: 172/255, green: 92/255, blue: 195/255)) Rectangle()
.mask(CustomShape(radius: 10)) .fill(Color(red: 172/255, green: 92/255, blue: 195/255))
.frame(width: CGFloat((item.ItemProgress/100)*320), height: 7) .mask(CustomShape(radius: 10))
.frame(width: CGFloat((item.ItemProgress/100)*320), height: 7)
.padding(0), alignment: .bottomLeading
)
.shadow(radius: 5)
} else {
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.Id)/Images/\(item.ImageType)?maxWidth=550&quality=80&tag=\(item.Image)")!)
.resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size
.placeholder {
Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 6, height: 6))!)
.resizable()
.frame(width: 320, height: 180)
.cornerRadius(10)
}
.frame(width: 320, height: 180)
.cornerRadius(10)
.overlay(
Rectangle()
.fill(Color(red: 172/255, green: 92/255, blue: 195/255))
.mask(CustomShape(radius: 10))
.frame(width: CGFloat((item.ItemProgress/100)*320), height: 7)
.padding(0), alignment: .bottomLeading .padding(0), alignment: .bottomLeading
) )
.shadow(radius: 5) .shadow(radius: 5)
} else { }
WebImage(url: URL(string: "\(globalData.server?.baseURI ?? "")/Items/\(item.Id)/Images/\(item.ImageType)?maxWidth=550&quality=80&tag=\(item.Image)")!) Text("\(item.Type == "Episode" ? item.SeriesName ?? "" : item.Name)")
.resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size .font(.callout)
.placeholder { .fontWeight(.semibold)
Image(uiImage: UIImage(blurHash: (item.BlurHash == "" ? "W$H.4}D%bdo#a#xbtpxVW?W?jXWsXVt7Rjf5axWqxbWXnhada{s-" : item.BlurHash), size: CGSize(width: 6, height: 6))!) .foregroundColor(.primary)
.resizable() .lineLimit(1)
.frame(width: 320, height: 180) .frame(width: 320, alignment: .leading)
.cornerRadius(10) Spacer().frame(height: 5)
} }.padding(.trailing, 5)
.frame(width: 320, height: 180) }
.cornerRadius(10)
.overlay(
Rectangle()
.fill(Color(red: 172/255, green: 92/255, blue: 195/255))
.mask(CustomShape(radius: 10))
.frame(width: CGFloat((item.ItemProgress/100)*320), height: 7)
.padding(0), alignment: .bottomLeading
)
.shadow(radius: 5)
}
Text("\(item.Type == "Episode" ? item.SeriesName ?? "" : item.Name)")
.font(.callout)
.fontWeight(.semibold)
.foregroundColor(.primary)
.lineLimit(1)
.frame(width: 320, alignment: .leading)
Spacer().frame(height: 5)
}.padding(.trailing, 5)
} }
} Spacer().frame(width:14)
Spacer().frame(width:14) }.frame(height: 215)
}.frame(height: 215) } else {
EmptyView()
}
}.onAppear(perform: onAppear) }.onAppear(perform: onAppear)
.frame(height: 215) .frame(height: 215)
.padding(.bottom, 10) .padding(.bottom, 10)

View File

@ -18,7 +18,13 @@ struct EpisodeItemView: View {
var item: ResumeItem; var item: ResumeItem;
@EnvironmentObject var orientationInfo: OrientationInfo @EnvironmentObject var orientationInfo: OrientationInfo
var fullItem: DetailItem; var fullItem: DetailItem;
@State private var playing: Bool = false; @State private var playing: Bool = false {
didSet {
if(_playing.wrappedValue == false) {
unlockOrientations()
}
}
};
@State private var vc: PreferenceUIHostingController? = nil; @State private var vc: PreferenceUIHostingController? = nil;
@State private var progressString: String = ""; @State private var progressString: String = "";
@State private var viewDidLoad: Bool = false; @State private var viewDidLoad: Bool = false;

View File

@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string> <string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>14</string> <string>15</string>
<key>DTXApplicationID</key> <key>DTXApplicationID</key>
<string>8c1f6941-ec78-480c-b589-b41aca29a52e</string> <string>8c1f6941-ec78-480c-b589-b41aca29a52e</string>
<key>DTXBeaconURL</key> <key>DTXBeaconURL</key>

View File

@ -66,7 +66,13 @@ struct MovieItemView: View {
@State private var isLoading: Bool = true; @State private var isLoading: Bool = true;
var item: ResumeItem; var item: ResumeItem;
var fullItem: DetailItem; var fullItem: DetailItem;
@State private var playing: Bool = false; @State private var playing: Bool = false {
didSet {
if(_playing.wrappedValue == false) {
unlockOrientations()
}
}
};
@State private var vc: PreferenceUIHostingController? = nil; @State private var vc: PreferenceUIHostingController? = nil;
@State private var progressString: String = ""; @State private var progressString: String = "";
@State private var viewDidLoad: Bool = false; @State private var viewDidLoad: Bool = false;
@ -255,7 +261,7 @@ struct MovieItemView: View {
var body: some View { var body: some View {
if(playing) { if(playing) {
VideoPlayerView(item: fullItem, playing: $playing).onAppear(perform: lockOrientations) VideoPlayerView(item: fullItem, playing: $playing).onAppear(perform: lockOrientations).onDisappear(perform: unlockOrientations)
} else { } else {
LoadingView(isShowing: $isLoading) { LoadingView(isShowing: $isLoading) {
VStack(alignment:.leading) { VStack(alignment:.leading) {

View File

@ -274,7 +274,9 @@ struct VideoPlayerView: View {
} }
if(_selectedAudioTrack.wrappedValue == -1) { if(_selectedAudioTrack.wrappedValue == -1) {
_selectedAudioTrack.wrappedValue = _audioTracks.wrappedValue[0].id; if(_audioTracks.wrappedValue.count > 0) {
_selectedAudioTrack.wrappedValue = _audioTracks.wrappedValue[0].id;
}
} }
let streamUrl = streamURL.absoluteString; let streamUrl = streamURL.absoluteString;
@ -319,6 +321,7 @@ struct VideoPlayerView: View {
_selectedAudioTrack.wrappedValue = _audioTracks.wrappedValue[0].id; _selectedAudioTrack.wrappedValue = _audioTracks.wrappedValue[0].id;
} }
sendPlayReport()
pbitem = item; pbitem = item;
pbitem.subtitles = subtitles; pbitem.subtitles = subtitles;
_isPlaying.wrappedValue = true; _isPlaying.wrappedValue = true;