File tree Expand file tree Collapse file tree
src/components/BootstrapBlazor.HikVision Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -316,6 +316,18 @@ public async Task<bool> SetVolume(int value)
316316 return ret ;
317317 }
318318
319+ /// <summary>
320+ /// 抓图方法返回 Url
321+ /// </summary>
322+ /// <returns></returns>
323+ public async Task CapturePictureAndDownload ( )
324+ {
325+ if ( IsLogin && IsRealPlaying )
326+ {
327+ var stream = await InvokeAsync < IJSStreamReference ? > ( "capturePictureAndDownload" , Id ) ;
328+ }
329+ }
330+
319331 private TaskCompletionSource < IJSStreamReference ? > ? _captureTaskCompletionSource = null ;
320332
321333 /// <summary>
Original file line number Diff line number Diff line change @@ -439,6 +439,25 @@ const base64ToArray = base64String => {
439439
440440 return bytes ;
441441}
442+
443+ export function capturePictureAndDownload ( id ) {
444+ const vision = Data . get ( id ) ;
445+ const { iWndIndex, realPlaying, invoke } = vision ;
446+
447+ if ( realPlaying !== true ) {
448+ return "" ;
449+ }
450+
451+ try {
452+ const base64 = await WebVideoCtrl . I_CapturePicData ( ) ;
453+ const bytes = base64ToArray ( base64 ) ;
454+ return DotNet . createJSStreamReference ( bytes . buffer ) ;
455+ }
456+ catch ( ex ) {
457+ return null ;
458+ }
459+ }
460+
442461export function dispose ( id ) {
443462 const vision = Data . get ( id ) ;
444463 const { realPlaying, logined, observer } = vision ;
You can’t perform that action at this time.
0 commit comments