This commit is contained in:
JinJiangHuang
2026-03-01 18:40:03 +08:00
parent a89ce6eb69
commit 3f302f83b3
3 changed files with 14 additions and 5 deletions
+2 -2
View File
@@ -122,12 +122,12 @@ enum VLCBufferMode: Int, CaseIterable, Identifiable {
if isLive { if isLive {
return (network: 2600, live: 2600, file: 3200) return (network: 2600, live: 2600, file: 3200)
} }
return (network: 3800, live: 3200, file: 4400) return (network: 6000, live: 5000, file: 6400)
case .smooth: case .smooth:
if isLive { if isLive {
return (network: 4200, live: 4200, file: 5200) return (network: 4200, live: 4200, file: 5200)
} }
return (network: 5600, live: 4800, file: 6400) return (network: 8000, live: 6800, file: 8400)
} }
} }
} }
+3 -1
View File
@@ -19,7 +19,7 @@ struct DetailView: View {
ScrollView { ScrollView {
VStack(spacing: 0) { VStack(spacing: 0) {
// //
if viewModel.isPlaying, let url = viewModel.playUrl, !showFullScreen { if viewModel.isPlaying, let url = viewModel.playUrl {
PlayerView( PlayerView(
urlString: url, urlString: url,
startPosition: viewModel.currentPlaybackSeconds(), startPosition: viewModel.currentPlaybackSeconds(),
@@ -38,6 +38,8 @@ struct DetailView: View {
.onTapGesture(count: 2) { .onTapGesture(count: 2) {
openFullScreenPlayer() openFullScreenPlayer()
} }
.opacity(showFullScreen ? 0 : 1)
.allowsHitTesting(!showFullScreen)
} }
// //
+9 -2
View File
@@ -169,7 +169,7 @@ final class VLCPlayerController: NSObject, ObservableObject, VLCMediaPlayerDeleg
cacheConfig.live += vodCacheBoostExtraLive cacheConfig.live += vodCacheBoostExtraLive
cacheConfig.file += vodCacheBoostExtraFile cacheConfig.file += vodCacheBoostExtraFile
} }
let enableFrameDrop = isLive ? bufferMode.enableFrameDrop : true let enableFrameDrop = isLive ? bufferMode.enableFrameDrop : false
let enableSkipFrames = isLive && bufferMode.enableFrameDrop let enableSkipFrames = isLive && bufferMode.enableFrameDrop
var mediaOptions: [String: Any] = [ var mediaOptions: [String: Any] = [
"network-caching": cacheConfig.network, "network-caching": cacheConfig.network,
@@ -179,6 +179,10 @@ final class VLCPlayerController: NSObject, ObservableObject, VLCMediaPlayerDeleg
"skip-frames": enableSkipFrames ? 1 : 0, "skip-frames": enableSkipFrames ? 1 : 0,
"http-reconnect": 1 "http-reconnect": 1
] ]
if !isLive {
mediaOptions["avcodec-hurry-up"] = 0
mediaOptions["clock-jitter"] = 5000000
}
if let hwOption = decodeMode.vlcHardwareDecodeOption { if let hwOption = decodeMode.vlcHardwareDecodeOption {
mediaOptions["avcodec-hw"] = hwOption mediaOptions["avcodec-hw"] = hwOption
@@ -580,11 +584,14 @@ final class VLCPlayerController: NSObject, ObservableObject, VLCMediaPlayerDeleg
} }
private func applyPlaybackRate() { private func applyPlaybackRate() {
guard mediaPlayer.rate != playbackRate else { return }
mediaPlayer.rate = playbackRate mediaPlayer.rate = playbackRate
} }
private func applyVolume() { private func applyVolume() {
mediaPlayer.audio?.volume = Int32(volume) let target = Int32(volume)
guard mediaPlayer.audio?.volume != target else { return }
mediaPlayer.audio?.volume = target
} }
private func syncDecodeModeFromSettings() { private func syncDecodeModeFromSettings() {