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

Implement media segments #4052

Merged
merged 2 commits into from
Oct 7, 2024

Conversation

nielsvanvelzen
Copy link
Member

@nielsvanvelzen nielsvanvelzen commented Oct 5, 2024

This adds the initial support for media segments with some of the actions I'd like still missing.

Changes

  • Add new preference category "Media segment actions" in the playback section
    • Contains a preference for each supported segment type
  • Add "nothing" action - does literally nothing, default for each segment
  • Add "skip" action - skips to the end of the segment when the player seeks over the segment start position

The MediaSegmentRepository contains a hardcoded list of supported segment types that is always included when requesting segments. This way we can add new segment types on the backend without breaking existing app releases (SDK won't be able to parse an unknown enum). Additionally, I've opted to not support the "unknown" type in the client.

Future additions will include:

  • Notification when a segment was skipped
  • "ask to skip" action that shows a button to skip the segment
  • "mute" action that mutes the audio during a segment
  • "skip subsequent" action that plays a specific segment only once in a media queue (e.g. opening theme of a show on first episode and not in all subsequent episodes)

I'm not sure how many of these will be implemented within the current playback code as it's a bit finicky to work with.

Screenshots

75ef3b7838451aa5

Issues

@@ -64,7 +64,7 @@
private Limiter mLimiter;
private PlaybackControllerNotifiable mPlaybackControllerNotifiable;
private PlaybackOverlayFragmentHelper _helper;
private ExoPlayer mExoPlayer;
public ExoPlayer mExoPlayer;

Check notice

Code scanning / Android Lint

Unknown nullness Note

Unknown nullability; explicitly declare as @Nullable or @NonNull to improve Kotlin interoperability; see https://developer.android.com/kotlin/interop#nullability_annotations
NOTHING(R.string.segment_action_nothing),

/**
* Seek to the end of this segment (endTicks). If the duration of this segment is shorter than 1 second it should do nothing to avoid

Check warning

Code scanning / detekt

Line detected, which is longer than the defined maximum line length in the code style. Warning

Line detected, which is longer than the defined maximum line length in the code style.

/**
* Seek to the end of this segment (endTicks). If the duration of this segment is shorter than 1 second it should do nothing to avoid
* lagg. The skip action will only execute when playing over the segment start, not when seeking into the segment block.

Check warning

Code scanning / detekt

Line detected, which is longer than the defined maximum line length in the code style. Warning

Line detected, which is longer than the defined maximum line length in the code style.
@nielsvanvelzen nielsvanvelzen added this to the v0.18.0 milestone Oct 7, 2024
@nielsvanvelzen nielsvanvelzen added enhancement New feature or request release-highlight Pull request might be suitable for mentioning in the release blog post labels Oct 7, 2024
@nielsvanvelzen nielsvanvelzen marked this pull request as ready for review October 7, 2024 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request release-highlight Pull request might be suitable for mentioning in the release blog post
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants