feature: Add actions for media segments (#236)

Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
PartyDonut 2025-02-23 16:56:49 +01:00 committed by GitHub
parent f0414439f3
commit e4b8a050c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 155 additions and 23 deletions

View file

@ -166,6 +166,13 @@ class _DesktopControlsState extends ConsumerState<DesktopControls> {
final position = ref.watch(mediaPlaybackProvider.select((value) => value.position));
MediaSegment? segment = mediaSegments?.atPosition(position);
bool forceShow = segment?.forceShow(position) ?? false;
final segmentSkipType = ref
.watch(videoPlayerSettingsProvider.select((value) => value.segmentSkipSettings[segment?.type]));
final autoSkip =
forceShow == true && segmentSkipType == SegmentSkip.skip && player.lastState?.buffering == false;
if (autoSkip) {
skipToSegmentEnd(segment);
}
return Stack(
children: [
Align(
@ -174,6 +181,7 @@ class _DesktopControlsState extends ConsumerState<DesktopControls> {
padding: const EdgeInsets.all(32),
child: SkipSegmentButton(
segment: segment,
skipType: segmentSkipType,
isOverlayVisible: forceShow ? true : showOverlay,
pressedSkip: () => skipToSegmentEnd(segment),
),