Add Native Playback Seek Buffer
Native VLC playback now applies a centralized 30-second media caching value before opening streams, giving short forward and backward seeks more room to avoid feeling like a fresh stream start.
Summary
Added VLC-side caching options to the native playback backend only. The player UI, skip controls, scrubber, subtitle flow, audio-track flow, and NativePlaybackBackend protocol were left unchanged.
Changes Made
- Added
private static let seekBufferMilliseconds = 30_000to centralize the native playback seek buffer. - Applied
:network-caching=30000,:http-caching=30000, and:file-caching=30000to eachVLCMediabefore playback starts. - Updated the DEBUG open log to include the configured buffer duration while keeping URL logging redacted through the existing redactor.
- Ran
pod installbecause the workspace was missing generated CocoaPods support files needed for the requested iOS build; this also restored the Pods framework build phase reference in the Xcode project.
Context
The requested buffer is a VLC media caching setting, not a custom proxy or a new app-visible setting. Keeping the change inside VLCNativePlaybackBackend.play(request:) preserves the existing player contract and keeps the first tuning point small and easy to adjust after real-device testing.
Important Implementation Details
The caching options are added after request headers and VLC HTTP options are configured, and before the media is assigned to the player. This ensures the options belong to the same VLCMedia instance used for the native stream.
The helper is compiled only when MobileVLCKit is available, matching the rest of the backend's conditional compilation pattern.
Relevant Diff Snippets
The repository asks for diffs.com rendering through @pierre/diffs/ssr. The package was not installed in this worktree, so the ESM availability check failed with ERR_MODULE_NOT_FOUND. A plain unified diff is included as the fallback.
diff --git a/Dreamio.xcodeproj/project.pbxproj b/Dreamio.xcodeproj/project.pbxproj
index af6a9dc..d7fbe19 100644
--- a/Dreamio.xcodeproj/project.pbxproj
+++ b/Dreamio.xcodeproj/project.pbxproj
@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
+ 00160C2FABC913A6DDCAB0C4 /* Pods_Dreamio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 908FA15B08AB341C116BAB46 /* Pods_Dreamio.framework */; };
@@ -15,7 +16,6 @@
- BA013CEC876B829A86AE8DCB /* Pods_Dreamio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 908FA15B08AB341C116BAB46 /* Pods_Dreamio.framework */; };
@@ -39,6 +39,7 @@
files = (
+ 00160C2FABC913A6DDCAB0C4 /* Pods_Dreamio.framework in Frameworks */,
);
diff --git a/Dreamio/VLCNativePlaybackBackend.swift b/Dreamio/VLCNativePlaybackBackend.swift
index c3c2318..0fa779a 100644
--- a/Dreamio/VLCNativePlaybackBackend.swift
+++ b/Dreamio/VLCNativePlaybackBackend.swift
@@ -5,6 +5,8 @@ import MobileVLCKit
#endif
final class VLCNativePlaybackBackend: NSObject, NativePlaybackBackend {
+ private static let seekBufferMilliseconds = 30_000
+
@@ -67,10 +69,11 @@ final class VLCNativePlaybackBackend: NSObject, NativePlaybackBackend {
if !headerValue.isEmpty {
media.addOption(":http-header=\(headerValue)")
}
+ configureSeekBuffer(for: media)
mediaPlayer.media = media
#if DEBUG
- print("[DreamioVLC] opening url=\(URLRedactor.redactedURLString(request.playbackURL.absoluteString))")
+ print("[DreamioVLC] opening url=\(URLRedactor.redactedURLString(request.playbackURL.absoluteString)) seekBufferMilliseconds=\(Self.seekBufferMilliseconds)")
#endif
@@ -84,6 +87,18 @@ final class VLCNativePlaybackBackend: NSObject, NativePlaybackBackend {
#endif
}
+#if canImport(MobileVLCKit)
+ private func configureSeekBuffer(for media: VLCMedia) {
+ let cachingOptions = [
+ ":network-caching=\(Self.seekBufferMilliseconds)",
+ ":http-caching=\(Self.seekBufferMilliseconds)",
+ ":file-caching=\(Self.seekBufferMilliseconds)"
+ ]
+
+ cachingOptions.forEach { media.addOption($0) }
+ }
+#endif
Expected Impact for End-Users
Short native playback seeks should have more buffered media available, especially around repeated 15-second skip forward and backward actions. Users should not see any new controls or settings.
Validation
- Ran
pod installto restore missing CocoaPods support files after the first build failed before Swift compilation. - Ran
xcodebuild -workspace Dreamio.xcworkspace -scheme Dreamio -destination 'generic/platform=iOS' build; the build succeeded. - Manual playback checks were not run in this environment. Real-device validation is still needed for before and after behavior on direct-file debrid streams.
Issues, Limitations, and Mitigations
- The 30-second value is intentionally a balanced starting point. It may need tuning after device testing on slower networks or very large direct files.
- The successful build still prints existing warnings about the MobileVLCKit deployment target and a run script phase without declared outputs.
bd dolt pullcould not fetch from the Dolt remote because this worktree reportsno remote.
Follow-up Work
- Validate repeated 15-second forward and backward seeks on a real device with a direct-file debrid stream.
- Compare startup time and seek recovery before and after the buffer change.
- Consider a follow-up Beads issue only if device testing shows the 30-second cache should be adjusted or made configurable.