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

Adds "use fmp4" experimental option #623

Merged
merged 1 commit into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -21,6 +21,7 @@ extension BaseItemDto {
let tempOverkillBitrate = 360_000_000
builder.setMaxBitrate(bitrate: tempOverkillBitrate)
let profile = builder.buildProfile()
let segmentContainer = Defaults[.Experimental.usefmp4Hls] ? "mp4" : "ts"

let getPostedPlaybackInfoRequest = GetPostedPlaybackInfoRequest(
userId: SessionManager.main.currentLogin.user.id,
Expand Down Expand Up @@ -95,7 +96,7 @@ extension BaseItemDto {
tag: currentMediaSource.eTag,
deviceProfileId: nil,
playSessionId: response.playSessionId,
segmentContainer: "ts",
segmentContainer: segmentContainer,
segmentLength: nil,
minSegments: 2,
deviceId: UIDevice.vendorUUIDString,
Expand Down
8 changes: 5 additions & 3 deletions Shared/Objects/DeviceProfileBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

// lol can someone buy me a coffee this took forever :|

import Defaults
import Foundation
import JellyfinAPI

Expand Down Expand Up @@ -43,6 +44,7 @@ class DeviceProfileBuilder {
}

public func buildProfile() -> ClientCapabilitiesDeviceProfile {
let segmentContainer = Defaults[.Experimental.usefmp4Hls] ? "mp4" : "ts"
let maxStreamingBitrate = bitrate
let maxStaticBitrate = bitrate
let musicStreamingTranscodingBitrate = bitrate
Expand Down Expand Up @@ -99,7 +101,7 @@ class DeviceProfileBuilder {
if supportsFeature(minimumSupported: .A8X) {
if supportsFeature(minimumSupported: .A9) {
transcodingProfiles = [TranscodingProfile(
container: "ts",
container: segmentContainer,
type: .video,
videoCodec: "h264,hevc,mpeg4",
audioCodec: "aac,mp3,wav,eac3,ac3,flac,opus",
Expand All @@ -111,7 +113,7 @@ class DeviceProfileBuilder {
)]
} else {
transcodingProfiles = [TranscodingProfile(
container: "ts",
container: segmentContainer,
type: .video,
videoCodec: "h264,mpeg4",
audioCodec: "aac,mp3,wav,eac3,ac3,opus",
Expand All @@ -127,7 +129,7 @@ class DeviceProfileBuilder {
// Device supports FLAC?
if supportsFeature(minimumSupported: .A10X) {
transcodingProfiles = [TranscodingProfile(
container: "ts",
container: segmentContainer,
type: .video,
videoCodec: "hevc,h264,mpeg4",
audioCodec: "aac,mp3,wav,ac3,eac3,flac,opus",
Expand Down
1 change: 1 addition & 0 deletions Shared/SwiftfinStore/SwiftfinStoreDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ extension Defaults.Keys {
)
static let forceDirectPlay = Key<Bool>("forceDirectPlay", default: false, suite: .generalSuite)
static let nativePlayer = Key<Bool>("nativePlayer", default: false, suite: .generalSuite)
static let usefmp4Hls = Key<Bool>("usefmp4Hls", default: false, suite: .generalSuite)
static let liveTVAlphaEnabled = Key<Bool>("liveTVAlphaEnabled", default: false, suite: .generalSuite)
static let liveTVForceDirectPlay = Key<Bool>("liveTVForceDirectPlay", default: false, suite: .generalSuite)
static let liveTVNativePlayer = Key<Bool>("liveTVNativePlayer", default: false, suite: .generalSuite)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ struct ExperimentalSettingsView: View {
var syncSubtitleStateWithAdjacent
@Default(.Experimental.nativePlayer)
var nativePlayer
@Default(.Experimental.usefmp4Hls)
var usefmp4Hls

@Default(.Experimental.liveTVAlphaEnabled)
var liveTVAlphaEnabled
Expand All @@ -35,6 +37,8 @@ struct ExperimentalSettingsView: View {

Toggle("Native Player", isOn: $nativePlayer)

Toggle("Use fmp4 with HLS", isOn: $usefmp4Hls)

} header: {
L10n.experimental.text
}
Expand Down
5 changes: 5 additions & 0 deletions Swiftfin/Views/SettingsView/ExperimentalSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ struct ExperimentalSettingsView: View {
var syncSubtitleStateWithAdjacent
@Default(.Experimental.nativePlayer)
var nativePlayer
@Default(.Experimental.usefmp4Hls)
var usefmp4Hls

@Default(.Experimental.liveTVAlphaEnabled)
var liveTVAlphaEnabled
@Default(.Experimental.liveTVForceDirectPlay)
Expand All @@ -34,6 +37,8 @@ struct ExperimentalSettingsView: View {

Toggle("Native Player", isOn: $nativePlayer)

Toggle("Use fmp4 with HLS", isOn: $usefmp4Hls)

} header: {
L10n.experimental.text
}
Expand Down