Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp Device Profile Builder #519

Merged
merged 35 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2df57f3
Replace device model logic with playability check
holow29 Aug 8, 2022
2015122
Linting
holow29 Aug 8, 2022
822f5c6
Merge branch 'jellyfin:main' into main
holow29 Aug 8, 2022
62d4917
Update DeviceProfileBuilder.swift
holow29 Aug 8, 2022
a0d7545
Remove wav from profile
holow29 Aug 8, 2022
24520e2
Merge branch 'main' into main
holow29 Jan 27, 2023
b9c5096
Add FLAC DirectPlay support, fix strings
holow29 Feb 3, 2023
8befab8
Update subtitle support
holow29 Feb 3, 2023
b9db972
Change maxAudioChannels to 8
holow29 Feb 6, 2023
f7f668a
Merge branch 'jellyfin:main' into main
holow29 Feb 6, 2023
b3ccb3c
Change transcodingMaxAudioChannels to 8
holow29 Feb 6, 2023
f177b94
Move HEVC profile conditions inside conditional
holow29 Feb 6, 2023
a92a9d9
Update DeviceProfileBuilder.swift
holow29 Feb 18, 2023
82ab8bd
Merge branch 'jellyfin:main' into main
holow29 Feb 18, 2023
cacfb94
Change to actual DirectPlay in native player tvOS
holow29 Feb 18, 2023
fa6a976
Change to actually DirectPlay in Native Player iOS
holow29 Feb 18, 2023
3ca6492
Remove experimental mp4/ts switch and default to mp4
holow29 Feb 18, 2023
3c45fbe
Update SwiftfinStoreDefaults.swift
holow29 Feb 18, 2023
6302d6a
Update ExperimentalSettingsView.swift
holow29 Feb 18, 2023
c5ed30f
Update ExperimentalSettingsView.swift
holow29 Feb 18, 2023
17d225b
Resolved conflicts
Apr 22, 2023
91c927e
Solve Merge Conflicts
Apr 22, 2023
248611d
Linting
Apr 22, 2023
00be18b
Update NativeVideoPlayer.swift
holow29 Apr 27, 2023
b3c81c3
Update NativeVideoPlayer.swift
holow29 Apr 27, 2023
b253ad6
Update NativeVideoPlayer.swift
holow29 Apr 27, 2023
5d99681
Merge branch 'jellyfin:main' into main
holow29 May 17, 2023
fbeac95
Merge branch 'jellyfin:main' into main
holow29 Jul 13, 2023
601eeb9
Merge branch 'jellyfin:main' into main
holow29 Oct 10, 2023
424a00a
Merge branch 'jellyfin:main' into main
holow29 Oct 13, 2023
8e10004
Merge branch 'jellyfin:main' into main
holow29 Nov 19, 2023
432d0fa
Merge branch 'jellyfin:main' into main
holow29 Jan 10, 2024
eaa9759
Merge branch 'jellyfin:main' into main
holow29 Jan 12, 2024
e7ecd34
Update DeviceProfileBuilder.swift
holow29 Jan 12, 2024
8b94bdf
Update BaseItemDto+VideoPlayerViewModel.swift
holow29 Jan 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// License, v2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at https://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2023 Jellyfin & Jellyfin Contributors
// Copyright (c) 2024 Jellyfin & Jellyfin Contributors
//

import Combine
Expand All @@ -17,11 +17,10 @@ extension BaseItemDto {

func videoPlayerViewModel(with mediaSource: MediaSourceInfo) async throws -> VideoPlayerViewModel {

let builder = DeviceProfileBuilder()
let currentVideoPlayerType = Defaults[.VideoPlayer.videoPlayerType]
// TODO: fix bitrate settings
let tempOverkillBitrate = 360_000_000
builder.setMaxBitrate(bitrate: tempOverkillBitrate)
let profile = builder.buildProfile()
let profile = DeviceProfileBuilder.buildProfile(for: currentVideoPlayerType, maxBitrate: tempOverkillBitrate)

let userSession = Container.userSession.callAsFunction()

Expand Down
402 changes: 162 additions & 240 deletions Shared/Objects/DeviceProfileBuilder.swift

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions Shared/Services/SwiftfinDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,6 @@ extension Defaults.Keys {
)
}

enum Native {

static let fMP4Container: Key<Bool> = .init("fmp4Container", default: false, suite: .generalSuite)
}

enum Overlay {

static let chapterSlider: Key<Bool> = .init("chapterSlider", default: true, suite: .generalSuite)
Expand Down
5 changes: 2 additions & 3 deletions Shared/ViewModels/VideoPlayerViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@ class VideoPlayerViewModel: ViewModel {

var hlsPlaybackURL: URL {

let segmentContainer = Defaults[.VideoPlayer.Native.fMP4Container] ? "mp4" : "ts"
let userSession = Container.userSession.callAsFunction()

let parameters = Paths.GetMasterHlsVideoPlaylistParameters(
isStatic: true,
tag: mediaSource.eTag,
playSessionID: playSessionID,
segmentContainer: segmentContainer,
segmentContainer: "mp4",
minSegments: 2,
mediaSourceID: mediaSource.id!,
deviceID: UIDevice.vendorUUIDString,
Expand All @@ -46,7 +45,7 @@ class VideoPlayerViewModel: ViewModel {
.joined(separator: ","),
isBreakOnNonKeyFrames: true,
requireAvc: false,
transcodingMaxAudioChannels: 6,
transcodingMaxAudioChannels: 8,
videoCodec: videoStreams
.compactMap(\.codec)
.joined(separator: ","),
Expand Down
2 changes: 1 addition & 1 deletion Swiftfin tvOS/Views/VideoPlayer/NativeVideoPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class UINativeVideoPlayerViewController: AVPlayerViewController {

super.init(nibName: nil, bundle: nil)

let newPlayer: AVPlayer = .init(url: manager.currentViewModel.hlsPlaybackURL)
let newPlayer: AVPlayer = .init(url: manager.currentViewModel.playbackURL)

newPlayer.allowsExternalPlayback = true
newPlayer.appliesMediaSelectionCriteriaAutomatically = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import SwiftUI

struct NativeVideoPlayerSettingsView: View {

@Default(.VideoPlayer.Native.fMP4Container)
private var fMP4Container
@Default(.VideoPlayer.resumeOffset)
private var resumeOffset

Expand All @@ -33,13 +31,6 @@ struct NativeVideoPlayerSettingsView: View {
} footer: {
Text("Resume content seconds before the recorded resume time")
}

Section {

Toggle("fMP4 Container", isOn: $fMP4Container)
} footer: {
Text("Use fMP4 container to allow hevc content on supported devices")
}
}
.navigationTitle("Native Player")
}
Expand Down
2 changes: 1 addition & 1 deletion Swiftfin/Views/VideoPlayer/NativeVideoPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class UINativeVideoPlayerViewController: AVPlayerViewController {

super.init(nibName: nil, bundle: nil)

let newPlayer: AVPlayer = .init(url: manager.currentViewModel.hlsPlaybackURL)
let newPlayer: AVPlayer = .init(url: manager.currentViewModel.playbackURL)

newPlayer.allowsExternalPlayback = true
newPlayer.appliesMediaSelectionCriteriaAutomatically = false
Expand Down
Loading