Skip to content

Commit

Permalink
fix: don't createObjectURL, when webcam img doesn't exist in Mjpegstr…
Browse files Browse the repository at this point in the history
…eamer.vue (#834)

Signed-off-by: Stefan Dej <meteyou@gmail.com>
  • Loading branch information
meteyou authored May 21, 2022
1 parent cc888a3 commit fd89ff7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/webcams/Mjpegstreamer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,12 @@ export default class Mjpegstreamer extends Mixins(BaseMixin) {
}
// we're done reading the jpeg. Time to render it.
else {
img.src = URL.createObjectURL(new Blob([imageBuffer], { type: TYPE_JPEG }))
img.onload = () => URL.revokeObjectURL(img.src)
if (img) {
img.src = URL.createObjectURL(
new Blob([imageBuffer], { type: TYPE_JPEG })
)
img.onload = () => URL.revokeObjectURL(img.src)
}
frames++
contentLength = 0
bytesRead = 0
Expand Down

0 comments on commit fd89ff7

Please sign in to comment.