Skip to content

feat(HikVision): support auto hide Wnd change route#801

Merged
ArgoZhang merged 3 commits intomasterfrom
fix-hik
Dec 9, 2025
Merged

feat(HikVision): support auto hide Wnd change route#801
ArgoZhang merged 3 commits intomasterfrom
fix-hik

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented Dec 9, 2025

Link issues

fixes #800

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Handle HikVision web plugin visibility when the host element changes visibility.

New Features:

  • Automatically hide the HikVision plugin when its container element becomes invisible.

Enhancements:

  • Clean up HikVision web plugin script imports by removing an unused EventHandler dependency.

Copilot AI review requested due to automatic review settings December 9, 2025 01:47
@bb-auto bb-auto Bot added the enhancement New feature or request label Dec 9, 2025
@bb-auto bb-auto Bot added this to the v9.2.0 milestone Dec 9, 2025
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Dec 9, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds automatic hiding of the HikVision WebVideo plugin when its host element becomes invisible and performs minor cleanup in the HikVision web plugin wrapper JS file and project file.

Sequence diagram for auto hiding HikVision plugin on host visibility change

sequenceDiagram
    actor User
    participant Browser
    participant HikVisionComponent
    participant IntersectionObserver
    participant WebVideoCtrl

    User->>Browser: Navigate_to_new_route
    Browser->>HikVisionComponent: Hide_host_element
    HikVisionComponent->>IntersectionObserver: Host_visibility_changes
    IntersectionObserver->>HikVisionComponent: checkVisibility(host_element)
    alt Element_visible
        HikVisionComponent->>WebVideoCtrl: I_Resize(width,height)
    else Element_not_visible
        HikVisionComponent->>WebVideoCtrl: I_HidPlugin()
    end
Loading

Flow diagram for HikVision visibility observer with auto hide

flowchart TD
    A[init observes host element with IntersectionObserver] --> B[IntersectionObserver callback triggered]
    B --> C{checkVisibility returns true}
    C -- Yes --> D[WebVideoCtrl I_Resize with host width and height]
    C -- No --> E[WebVideoCtrl I_HidPlugin]
Loading

File-Level Changes

Change Details Files
Automatically hide the HikVision WebVideo plugin when its container element is no longer visible.
  • Extend the ResizeObserver callback to call the plugin hide method when the observed element fails the visibility check
  • Preserve the existing resize behavior when the element remains visible
src/components/BootstrapBlazor.HikVision/wwwroot/hikvision.js
Clean up unused imports and adjust project metadata for the HikVision component.
  • Remove an unused EventHandler import from the HikVision web plugin Razor JS wrapper
  • Update the HikVision project file (likely versioning or metadata; verify exact change in the diff viewer)
src/components/BootstrapBlazor.HikVision/Components/HikVisionWebPlugin.razor.js
src/components/BootstrapBlazor.HikVision/BootstrapBlazor.HikVision.csproj

Assessment against linked issues

Issue Objective Addressed Explanation
#800 Implement automatic hiding of the HikVision plugin window when its host element is not visible (e.g., after route changes).

Possibly linked issues


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

Copy link
Copy Markdown

@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 there - I've reviewed your changes - here's some feedback:

  • In the IntersectionObserver callback you call WebVideoCtrl.I_HidPlugin() when the element is not visible, but there is no corresponding Show/Resume call when it becomes visible again; consider adding symmetric behavior so the plugin is properly restored on route back/visibility change.
  • Before invoking WebVideoCtrl.I_Resize or WebVideoCtrl.I_HidPlugin in the observer callback, add a defensive check that WebVideoCtrl is defined and initialized to avoid potential runtime errors if the script has not loaded or the plugin is unavailable.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the IntersectionObserver callback you call `WebVideoCtrl.I_HidPlugin()` when the element is not visible, but there is no corresponding `Show/Resume` call when it becomes visible again; consider adding symmetric behavior so the plugin is properly restored on route back/visibility change.
- Before invoking `WebVideoCtrl.I_Resize` or `WebVideoCtrl.I_HidPlugin` in the observer callback, add a defensive check that `WebVideoCtrl` is defined and initialized to avoid potential runtime errors if the script has not loaded or the plugin is unavailable.

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.

@ArgoZhang ArgoZhang merged commit d522b6f into master Dec 9, 2025
6 checks passed
@ArgoZhang ArgoZhang deleted the fix-hik branch December 9, 2025 01:48
Copy link
Copy Markdown

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 adds automatic plugin hiding functionality when the HikVision video element is not visible (e.g., when navigating between routes). The implementation uses the existing IntersectionObserver to detect visibility changes and calls the appropriate API methods.

  • Adds automatic hiding of the video plugin when the element becomes invisible
  • Removes unused EventHandler import from HikVisionWebPlugin.razor.js
  • Bumps package version from 10.0.1 to 10.0.2

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/components/BootstrapBlazor.HikVision/wwwroot/hikvision.js Adds else clause to IntersectionObserver callback to hide the plugin via WebVideoCtrl.I_HidPlugin() when element is not visible
src/components/BootstrapBlazor.HikVision/Components/HikVisionWebPlugin.razor.js Removes unused EventHandler import
src/components/BootstrapBlazor.HikVision/BootstrapBlazor.HikVision.csproj Increments version number to 10.0.2 for the new release

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(HikVision): support auto hide Wnd change route

2 participants