Skip to content

Fix video history playback and resume functionality#242

Open
google-labs-jules[bot] wants to merge 1 commit intomainfrom
fix/video-history-playback-9830854864461448368
Open

Fix video history playback and resume functionality#242
google-labs-jules[bot] wants to merge 1 commit intomainfrom
fix/video-history-playback-9830854864461448368

Conversation

@google-labs-jules
Copy link

This change fixes a bug in the video playback history feature, ensuring that the resume-from-breakpoint functionality works correctly when the video streaming and history tracking accounts are different. It also ensures that videos marked as fully watched will restart from the beginning.

Fixes #239


PR created automatically by Jules for task 9830854864461448368 started by @UcnacDx2

This commit addresses an issue where video playback history and resume-from-breakpoint functionality would fail when the video streaming account differed from the history tracking account.

The solution involves the following changes:
- The `videoUrl` method in `lib/http/video.dart` has been updated to accept an optional `Account` parameter. This allows the caller to specify which user account context should be used for the API request.
- The `queryVideoUrl` method in `lib/pages/video/controller.dart` now passes `Accounts.history` when fetching video playback information. This ensures that the last played time is retrieved for the correct user.
- The logic for determining whether a video has been fully watched has been corrected. It now compares the `lastPlayTime` with the video's total `timeLength` to accurately decide whether to restart the video from the beginning.
@google-labs-jules
Copy link
Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@google-labs-jules google-labs-jules bot mentioned this pull request Dec 14, 2025
@UcnacDx2 UcnacDx2 marked this pull request as ready for review December 14, 2025 14:07
Copilot AI review requested due to automatic review settings December 14, 2025 14:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug in the video playback history feature to ensure videos resume correctly from the saved playback position when different accounts are used for streaming and history tracking. It also implements logic to restart videos from the beginning when they have been fully watched (within 400ms of completion).

Key Changes:

  • Added account parameter support to the video URL API to enable separate history tracking accounts
  • Implemented logic to detect fully watched videos and restart them from the beginning instead of resuming near the end

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lib/pages/video/controller.dart Adds Accounts.history parameter to video URL requests and implements logic to reset playback position to the beginning for fully watched videos
lib/http/video.dart Adds optional Account parameter to videoUrl method and passes it through the request options to enable account-specific history tracking

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

} else if (defaultST == null) {
if (data.lastPlayTime != null &&
data.timeLength != null &&
data.lastPlayTime! >= data.timeLength! - 400) {
Copy link

Copilot AI Dec 14, 2025

Choose a reason for hiding this comment

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

The condition for determining if a video should restart from the beginning only checks if lastPlayTime >= timeLength - 400. However, lastPlayTime and timeLength are in milliseconds, so the 400ms threshold might be too small. Consider if this should be a larger value (e.g., 1000-5000ms) to provide a better user experience, as users who stopped within the last 400ms of a video might prefer to resume rather than restart.

Suggested change
data.lastPlayTime! >= data.timeLength! - 400) {
data.lastPlayTime! >= data.timeLength! - 3000) {

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix

0 participants

Comments