Skip to content

decodeImageFromList and decodeImageFromPixels returns Error: [object Event] at Object.createErrorWithStack #49244

@obshksw

Description

@obshksw

So I'm taking a screenshot of a VideoElement like this:

CanvasElement canvas = CanvasElement(width: _videoElement.videoWidth, height: _videoElement.videoHeight);
canvas.context2D.drawImage(_videoElement, 0, 0);
ImageData imgData = canvas.context2D.getImageData(0, 0, canvas.width, canvas.height);

Then show it like this:

_pauseCanvas = CanvasElement(width: _videoElement.videoWidth, height: _videoElement.videoHeight); 
_pauseCanvas.context2D.putImageData(imgData, 0, 0);

That part works perfectly.

The problem is that I'd prefer to use an Image widget instead of a CanvasElement to reuse some parts of the code on native, but decodeImageFromList don't take a Uint8ClampedList which is what I have from the ImageData and when I use:
imgData.data.buffer.asUint8List() or Uint8List.fromList(imgData.data)
I get that error:

Event {isTrusted: true, Symbol(_jsError): Error: [object Event]
    at Object.createErrorWithStack (http://localhost:57523/packages/build_web…, type: "error", target: img, currentTarget: img, …}

It's possible that I don't do the right thing, but I don't have an error that helps me to find what I'm doing wrong. Also tried decodeImageFromPixels but I get similar results.

Flutter (Channel unknown, v1.13.9, on Microsoft Windows [Version 10.0.17763.973], locale en-US)
    • Flutter version 1.13.9 at C:\dev\flutter\flutter
    • Framework revision d291de086c (12 days ago), 2020-01-09 10:25:58 -0800
    • Engine revision f001ea29f1
    • Dart version 2.8.0 (build 2.8.0-dev.0.0 c0ca187f26)

Thanks for the help!

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listc: renderingUI glitches reported at the engine/skia or impeller rendering levele: web_htmlHTML rendering backend for Webengineflutter/engine related. See also e: labels.platform-webWeb applications specifically

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions