Skip to content

[Backport] Fix thumbnails on vehicle setup page#3854

Open
joaoantoniocardoso wants to merge 2 commits intobluerobotics:1.4from
joaoantoniocardoso:backports/1.4/fix-video-overview-thumbnail
Open

[Backport] Fix thumbnails on vehicle setup page#3854
joaoantoniocardoso wants to merge 2 commits intobluerobotics:1.4from
joaoantoniocardoso:backports/1.4/fix-video-overview-thumbnail

Conversation

@joaoantoniocardoso
Copy link
Member

@joaoantoniocardoso joaoantoniocardoso commented Mar 24, 2026

Backport of #3853 into 1.4

Summary by Sourcery

Enable automatic video thumbnail updates only for devices with available streams and supported encoders.

New Features:

  • Add optional autoplay behavior to video thumbnails when registration is enabled.

Bug Fixes:

  • Prevent registration and thumbnail handling for video devices that have no available streams.

Summary by Sourcery

Ensure video thumbnails on the vehicle setup page only register and autoplay for devices with valid streams and supported encoders.

New Features:

  • Add optional autoplay behavior for video thumbnails when registration is enabled.

Bug Fixes:

  • Avoid registering video devices and updating thumbnails when no valid streams are available.

Enhancements:

  • Restrict the list of valid video devices on the vehicle setup page to those with supported encoders and at least one available stream.

Automatically starts continuous thumbnail fetching on mount when both
autoplay and register are true. Used in the vehicle setup page tooltip
so thumbnails appear on hover without manual interaction.
…with streams

Filter out video devices that have no streams configured from the
vehicle setup overview, so duplicate sources from the same camera
don't appear.
@sourcery-ai
Copy link

sourcery-ai bot commented Mar 24, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Backports a fix to only register and update video thumbnails for devices with valid streams and supported encoders, and adds optional autoplay behavior for registered video thumbnails on the vehicle setup page.

Sequence diagram for video thumbnail registration and autoplay

sequenceDiagram
  actor VehicleSetupUser
  participant VideoOverview
  participant VideoThumbnail
  participant VideoService as Video

  VehicleSetupUser->>VideoOverview: Open vehicle setup page
  VideoOverview->>VideoOverview: Compute valid_devices
  VideoOverview->>VideoOverview: Filter by has_supported_encode(device)
  VideoOverview->>VideoOverview: Filter by available_streams_from_device not empty
  VideoOverview->>VideoThumbnail: Create with source, width, register, autoplay
  activate VideoThumbnail
  VideoThumbnail->>VideoThumbnail: mounted()
  alt autoplay and register are true
    VideoThumbnail->>VideoThumbnail: continuous_mode = true
    VideoThumbnail->>VideoService: startGetThumbnailForDevice(source)
  else autoplay is false or register is false
    VideoThumbnail->>VideoThumbnail: Wait for manual updates only
  end
  deactivate VideoThumbnail
Loading

Class diagram for updated VideoThumbnail and VideoOverview components

classDiagram
  class VideoOverview {
    +devices
    +video
    +streams_for_device
    +computed valid_devices
  }

  class VideoThumbnail {
    +String source
    +String width
    +Boolean register
    +Boolean disabled
    +Boolean autoplay
    +Boolean continuous_mode
    +Function updateThumbnail()
    +mounted()
    +beforeDestroy()
  }

  class VideoService {
    +startGetThumbnailForDevice(source)
  }

  VideoOverview --> VideoThumbnail : uses
  VideoThumbnail --> VideoService : calls

  %% Template relationships
  VideoOverview : passes source
  VideoOverview : passes width 280
  VideoOverview : passes register streams_for_device[device.name] !== undefined
  VideoOverview : passes autoplay true

  %% Lifecycle behavior
  VideoThumbnail : mounted()
  VideoThumbnail : if autoplay && register then
  VideoThumbnail :   continuous_mode = true
  VideoThumbnail :   video.startGetThumbnailForDevice(source)
Loading

File-Level Changes

Change Details Files
Gate thumbnail registration and autoplay on devices that actually have available streams and supported encoders.
  • Pass a conditional register prop to video-thumbnail based on whether the current device has any available streams.
  • Filter valid video devices to require both supported encoders and non-empty available streams from the device.
core/frontend/src/components/vehiclesetup/overview/VideoOverview.vue
Add optional autoplay support to the VideoThumbnail component and start continuous thumbnail updates when enabled.
  • Introduce a new Boolean autoplay prop on the VideoThumbnail component.
  • On mount, if autoplay and register are both true, enable continuous_mode and start fetching thumbnails for the device.
core/frontend/src/components/video-manager/VideoThumbnail.vue

Possibly linked issues

  • #(not specified): PR updates VideoOverview and VideoThumbnail to correctly register streams and autoplay thumbnails, fixing missing thumbnails issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@joaoantoniocardoso joaoantoniocardoso changed the title frontend: fix video thumbnail autoplay and filter devices without streams [Backport] Fix thumbnails on vehicle setup page Mar 24, 2026
@joaoantoniocardoso joaoantoniocardoso marked this pull request as ready for review March 24, 2026 18:01
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • When autoplay is enabled, mounted starts video.startGetThumbnailForDevice(this.source) but beforeDestroy only clears timers; consider explicitly stopping the continuous thumbnail stream (if a corresponding stop API exists) to avoid background work or leaks when the component is destroyed.
  • In VideoOverview.vue, register is now driven by streams_for_device[device.name] !== undefined while the device list is filtered with available_streams_from_device(video.available_streams, device); it may be worth ensuring these two data sources stay consistent so that a device cannot pass the filter but still have register resolve to false.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- When `autoplay` is enabled, `mounted` starts `video.startGetThumbnailForDevice(this.source)` but `beforeDestroy` only clears timers; consider explicitly stopping the continuous thumbnail stream (if a corresponding stop API exists) to avoid background work or leaks when the component is destroyed.
- In `VideoOverview.vue`, `register` is now driven by `streams_for_device[device.name] !== undefined` while the device list is filtered with `available_streams_from_device(video.available_streams, device)`; it may be worth ensuring these two data sources stay consistent so that a device cannot pass the filter but still have `register` resolve to false.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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.

1 participant