Skip to content

Revert NativePlayer.seek to use ticks and rename to seekTicks - #1694

Merged
nielsvanvelzen merged 2 commits into
jellyfin:masterfrom
CeruleanRed:fix/fix-seek-function
Jun 26, 2025
Merged

Revert NativePlayer.seek to use ticks and rename to seekTicks#1694
nielsvanvelzen merged 2 commits into
jellyfin:masterfrom
CeruleanRed:fix/fix-seek-function

Conversation

@CeruleanRed

@CeruleanRed CeruleanRed commented Jun 25, 2025

Copy link
Copy Markdown
Contributor

Fix the bug created by #1680 regarding the native player and durations

Changes
Revert the changes to the NativePlayer.seek function to take a Long instead of a Duration.

Issues
Fixes #1689

Summary by CodeRabbit

  • Bug Fixes

    • Improved seeking behavior in the media player, enhancing accuracy when jumping to specific positions during playback.
  • Documentation

    • Updated documentation to clarify parameter types in download-related functions.

@CeruleanRed
CeruleanRed marked this pull request as ready for review June 25, 2025 15:31
@nielsvanvelzen

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 26, 2025

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jun 26, 2025

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The code changes revert the seek functionality in the player bridge from using a Duration parameter to using a Long representing ticks. The JavaScript interface and native player methods now explicitly use ticks, addressing compatibility issues. A documentation comment was also updated for clarity.

Changes

File(s) Change Summary
app/src/main/assets/native/ExoPlayerPlugin.js Modified seek method to call seekTicks instead of seek on the native player.
app/src/main/java/org/jellyfin/mobile/bridge/NativePlayer.kt Replaced seek(Duration) with seekTicks(Long), updated conversion logic and imports.
app/src/main/java/org/jellyfin/mobile/data/entity/DownloadEntity.kt Updated documentation comment to reference [Duration] instead of kotlin.time.Duration.

Sequence Diagram(s)

sequenceDiagram
    participant JS as ExoPlayerPlugin (JS)
    participant Native as NativePlayer (Kotlin)
    participant Player as PlayerEvent

    JS->>Native: seek(ticks)
    Native->>Native: seekTicks(ticks)
    Native->>Native: Convert ticks to Duration
    Native->>Player: PlayerEvent.Seek(duration)
Loading

Assessment against linked issues

Objective Addressed Explanation
Revert seek method to use ticks (Long) instead of Duration for JS interface compatibility (#1689)
Update documentation or method names to clarify tick-based seeking (#1689)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 333de35 and 6ee5bf9.

📒 Files selected for processing (3)
  • app/src/main/assets/native/ExoPlayerPlugin.js (1 hunks)
  • app/src/main/java/org/jellyfin/mobile/bridge/NativePlayer.kt (2 hunks)
  • app/src/main/java/org/jellyfin/mobile/data/entity/DownloadEntity.kt (1 hunks)
🔇 Additional comments (4)
app/src/main/java/org/jellyfin/mobile/data/entity/DownloadEntity.kt (1)

35-35: LGTM! Documentation style improvement.

The simplification from kotlin.time.Duration to [Duration] improves documentation readability while maintaining clarity.

app/src/main/assets/native/ExoPlayerPlugin.js (1)

69-69: LGTM! Method call correctly updated to match native rename.

The call to seekTicks properly reflects the renamed native method while preserving the ticks parameter.

app/src/main/java/org/jellyfin/mobile/bridge/NativePlayer.kt (2)

11-11: LGTM! Import updated for ticks extension.

The import change from kotlin.time.Duration to org.jellyfin.sdk.model.extensions.ticks is necessary for the .ticks extension used in the seekTicks method.


53-55: LGTM! Method correctly reverted to use Long ticks parameter.

The changes successfully address the PR objectives:

  • Method renamed from seek to seekTicks for clarity
  • Parameter type reverted from Duration to Long (ticks)
  • Internal conversion using .ticks extension maintains compatibility with PlayerEvent.Seek

This approach provides a clear interface while handling the Duration conversion internally.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@nielsvanvelzen nielsvanvelzen modified the milestone: v2.7.0 Jun 26, 2025
@nielsvanvelzen nielsvanvelzen added bug Something isn't working labels Jun 26, 2025

@nielsvanvelzen nielsvanvelzen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing!

@nielsvanvelzen
nielsvanvelzen merged commit 3672bea into jellyfin:master Jun 26, 2025
7 checks passed

@Maxr1998 Maxr1998 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes!

@CeruleanRed
CeruleanRed deleted the fix/fix-seek-function branch June 27, 2025 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix seek function JavaScript interface compatibility with Duration type

3 participants