Repository navigation
Seek to the live edge for CMTime.positiveInfinity - #27
Open
vincentborko wants to merge 2 commits into
Open
vincentborko wants to merge 2 commits into
vincentborko wants to merge 2 commits into
Conversation
AVPlayer.seek(to: .positiveInfinity) is the standard way to jump to the live edge of an HLS stream, but the transpiled seek fed the value straight into Int64(seconds * 1000), producing a garbage offset. Map positiveInfinity to a known duration (VOD) or Player.seekToDefaultPosition() (live edge), and ignore other non-numeric times. Fixes skiptools#19. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
AVFoundation raises NSInvalidArgumentException for a seek to an indefinite
time ("Seeking is not possible to time {INDEFINITE}"), which failed the
macos-15-intel job. The ignore-non-numeric behavior is Android-only, so the
test now runs those two seeks under #if SKIP.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Qh5nkgtHPgaRKT7fJK1Db
vincentborko
force-pushed
the
fix/seek-live-edge
branch
from
September 25, 2026 17:47
3a36728 to
f9bf577
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Fixes #19. On Apple platforms
player.seek(to: .positiveInfinity)is the idiomatic way to jump to the live edge of an HLS stream.CMTime.positiveInfinityalready exists in SkipAV, but the AndroidAVPlayer.seek(to:)fed it straight intoInt64(time.seconds * 1000.0)— theresecondsisDouble.infinity, which saturates toLong.MAX_VALUE, soPlayer.seekToreceives a meaningless offset instead of the live edge..indefinite/.invalid(NaN seconds) were likewise passed through unchecked.Fix
In the transpiled
seek(to:):positiveInfinity→ clamp to a known duration (VOD) viaseekTo(duration), elsePlayer.seekToDefaultPosition()— the live edge for live streams (per the Media3 docs / your note on the issue).indefinite/invalid/negativeInfinity) → ignored rather than seeking to a garbage offset. (AVFoundation itself raisesNSInvalidArgumentExceptionfor these, so there is no iOS behavior to mirror beyond not seeking.)seek(to:completionHandler:)now delegates toseek(to:)so every seek path shares the same handling.Bridging
No bridging changes — the fix lives entirely inside the existing
#elseif SKIPbranch; the iOS path (@_exported import AVKit) is untouched.Testing
swift testis green on both platforms (native XCTest + transpiled Robolectric).testAVPlayerAdditionsnow also exercises thepositiveInfinityseek on both platforms and theindefinite/invalidseeks on Android only: on the macos-15-intel runner AVFoundation raised for the indefinite seek, which the first CI run caught. (It did not raise on a local arm64 run.) Note: the live-edge vs. saturated-offset difference only manifests against a real HLS stream (Robolectric has no media pipeline), so that addition is a smoke check of the new code paths rather than a behavioral assertion.Skip Pull Request Checklist:
swift test🤖 Generated with Claude Code