Closed Bug 1689022 Opened 4 years ago Closed 3 years ago

canvas.captureStream() throwing NS_ERROR_NOT_INITIALIZED: error

Categories

(Core :: Graphics: Canvas2D, defect)

68 Branch
x86_64
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1388974

People

(Reporter: grant.patterson, Unassigned)

Details

I couldn't figure out how to reopen the original bug so I cloned it.

https://codepen.io/dbriggs/pen/xxbdrML clearly reproduces this bug. Note that only canvas.getContext('2d') makes captureStream() work; canvas.getContext('3d') does not, which means 3D canvases cannot be captured as streams.

+++ This bug was initially created as a clone of Bug #1572422 +++

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36

Steps to reproduce:

<canvas></canvas>
<script>
var canvasElt = document.querySelector('canvas');
var stream = canvasElt.captureStream();
</script>

Actual results:

NS_ERROR_NOT_INITIALIZED: error was thrown

Expected results:

i should have get MediaStream from this element just like in chrome.

Code is from mozilla developer docs.

Code that works is

<canvas></canvas>
<script>
var canvasElt = document.querySelector('canvas');
var ctx = canvasElt.getContext("2d");
var stream = canvasElt.captureStream();
</script>

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Canvas: 2D
Product: Firefox → Core

Apologies: canvas.getContext('3d') is not a thing!! canvas.getContext('webgl') is a suitable workaround for this issue if using a webgl canvas.

Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.