File tree Expand file tree Collapse file tree
src/components/BootstrapBlazor.HikVision/wwwroot Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,6 +22,15 @@ export async function init(id) {
2222 vision . iWndIndex = result . iWndIndex ;
2323 vision . inited = true ;
2424
25+ const observer = new IntersectionObserver ( ( ) => {
26+ console . log ( 'IntersectionObserver callback' ) ;
27+ if ( checkVisibility ( el ) ) {
28+ WebVideoCtrl . I_Resize ( el . offsetWidth , el . offsetHeight ) ;
29+ }
30+ } ) ;
31+ observer . observe ( el ) ;
32+ vision . observer = observer ;
33+
2534 return true ;
2635}
2736
@@ -309,7 +318,10 @@ export function dispose(id) {
309318 const vision = Data . get ( id ) ;
310319 Data . remove ( id ) ;
311320
312- const { realPlaying, logined } = vision ;
321+ const { realPlaying, logined, observer } = vision ;
322+ if ( observer ) {
323+ observer . disconnect ( ) ;
324+ }
313325 if ( realPlaying === true ) {
314326 stopRealPlay ( id ) ;
315327 }
You can’t perform that action at this time.
0 commit comments