@@ -13,13 +13,11 @@ export async function init(id) {
1313 return false ;
1414 }
1515
16- const result = await initWindow ( id ) ;
16+ const vision = Data . get ( id ) ;
17+ const result = await initWindow ( id , iWndIndex => vision . iWndIndex = iWndIndex ) ;
1718 if ( result . inited === false ) {
1819 return false ;
1920 }
20-
21- const vision = Data . get ( id ) ;
22- vision . iWndIndex = result . iWndIndex ;
2321 vision . inited = true ;
2422
2523 const observer = new IntersectionObserver ( ( ) => {
@@ -103,14 +101,14 @@ const removePlugin = () => {
103101 }
104102}
105103
106- const initWindow = id => {
107- const result = { inited : null , iWndIndex : - 1 } ;
104+ const initWindow = ( id , cb ) => {
105+ const result = { inited : null } ;
108106 WebVideoCtrl . I_InitPlugin ( {
109107 szBasePath : './_content/BootstrapBlazor.HikVision' ,
110108 bWndFull : true ,
111109 iWndowType : 1 ,
112110 cbSelWnd : function ( xmlDoc ) {
113- result . iWndIndex = parseInt ( getTagNameFirstValue ( xmlDoc , "SelectWnd" ) ) ;
111+ cb ( parseInt ( getTagNameFirstValue ( xmlDoc , "SelectWnd" ) ) ) ;
114112 } ,
115113 cbDoubleClickWnd : function ( iWndIndex , bFullScreen ) {
116114
@@ -553,6 +551,29 @@ export async function stopRecord(id) {
553551 } ) ;
554552}
555553
554+ export async function changeWndNum ( id , iWndType ) {
555+ const vision = Data . get ( id ) ;
556+ if ( ! iWndType ) {
557+ iWndType = "1" ;
558+ }
559+
560+ let ret = false ;
561+ try {
562+ if ( "1*2" === iWndType || "2*1" === iWndType ) {
563+ await WebVideoCtrl . I_ArrangeWindow ( iWndType ) ;
564+ }
565+ else {
566+ const iType = parseInt ( iWndType , 10 ) ;
567+ await WebVideoCtrl . I_ChangeWndNum ( iType ) ;
568+ }
569+ ret = true ;
570+ }
571+ catch ( oError ) {
572+ console . log ( oError ) ;
573+ }
574+ return ret ;
575+ }
576+
556577export function dispose ( id ) {
557578 const vision = Data . get ( id ) ;
558579 const { realPlaying, logined, observer } = vision ;
0 commit comments