Closed Bug 1388974 Opened 7 years ago Closed 3 years ago

canvas.captureStream throws NS_ERROR_NOT_INITIALIZED if a 2d context hasn't been made

Categories

(Core :: WebRTC: Audio/Video, defect, P3)

54 Branch
defect

Tracking

()

RESOLVED DUPLICATE of bug 1257440

People

(Reporter: voltrevo, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36 Steps to reproduce: Ran https://output.jsbin.com/yayati Actual results: Got what appears to be an internal error: Error: [Exception... "Component not initialized" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: http://output.jsbin.com/yayati :: <TOP_LEVEL> :: line 32" data: no] .message: .stack: @http://output.jsbin.com/yayati:32:18 Expected results: Output should be a list of rtpmap lines from an sdp.
Component: Untriaged → Canvas: 2D
Product: Firefox → Core
Andrew, your user agent seems to be Chrome's. Could you go to http://www.whoishostingthis.com/tools/user-agent/ to get your real agent? Besides, I didn't see your source code. Could you give more information about your code? IIUC, RTP is not related with Canvas. Right?
Flags: needinfo?(voltrevo)
@Daosheng: Ah yeah, I used Chrome to file the bug but the output is from my Firefox testing. I just ran it again in Firefox and got the same result with this user agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:54.0) Gecko/20100101 Firefox/54.0 Also, yeah RTP isn't the issue, that's just the expected output of the program. It's using the canvas stream as a video source for WebRTC, but it fails to get the canvas stream.
Flags: needinfo?(voltrevo)
I think you need to call canvas.getContext('2d'); before you start to captureStream(). Otherwise, it will throw error message here, http://searchfox.org/mozilla-central/rev/999385a5e8c2d360cc37286882508075fc2078bd/dom/html/HTMLCanvasElement.cpp#740. By the way, it should be belong to WebRTC module. Let me ni? pehrson, probably, he would have some feedback.
Status: UNCONFIRMED → NEW
Component: Canvas: 2D → WebRTC
Ever confirmed: true
Flags: needinfo?(apehrson)
Thanks. Yeah this is a known spec-compliance issue we have in the canvas captureStream implementation. The spec says, as your bug description, that captureStream() should just work. Until we fix this the workaround is to create a context by requesting one (2d or webgl) first. Not sure if there is an existing bug for this, so I'll keep this one.
Rank: 25
Component: WebRTC → WebRTC: Audio/Video
Flags: needinfo?(apehrson)
Priority: -- → P2
Mass change P2->P3 to align with new Mozilla triage process.
Priority: P2 → P3

There's even the older bug 1257440 for this.

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