Showing
1 changed file
with
12 additions
and
0 deletions
| @@ -240,6 +240,18 @@ class MobileScannerWeb extends MobileScannerPlatform { | @@ -240,6 +240,18 @@ class MobileScannerWeb extends MobileScannerPlatform { | ||
| 240 | _handleMediaTrackSettingsChange, | 240 | _handleMediaTrackSettingsChange, |
| 241 | ); | 241 | ); |
| 242 | 242 | ||
| 243 | + final HTMLVideoElement videoElement; | ||
| 244 | + | ||
| 245 | + // Attach the video element to the DOM, through its parent container. | ||
| 246 | + // If a video element is already present, reuse it. | ||
| 247 | + if (_divElement!.children.length == 0) { | ||
| 248 | + videoElement = document.createElement('video') as HTMLVideoElement; | ||
| 249 | + | ||
| 250 | + _divElement!.appendChild(videoElement); | ||
| 251 | + } else { | ||
| 252 | + videoElement = _divElement!.children.item(0)! as HTMLVideoElement; | ||
| 253 | + } | ||
| 254 | + | ||
| 243 | await _barcodeReader.start( | 255 | await _barcodeReader.start( |
| 244 | startOptions, | 256 | startOptions, |
| 245 | videoElement: videoElement, | 257 | videoElement: videoElement, |
-
Please register or login to post a comment