Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emscripten record video #7553

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

Jonathhhan
Copy link
Contributor

@Jonathhhan Jonathhhan commented May 31, 2023

This enables to record the Emscripten canvas with audio.
True or 1 starts the recording, false or 0 stops and downloads it.
I am sure it can be finetuned (codec wise for example).

//--------------------------------------------------------------
void ofApp::toggle_1_event(bool & isRecording) { 
	EM_ASM(recordVideo($0), isRecording);
}

I included this js file, which solves a timecode issue: https://github.com/yusitnikov/fix-webm-duration
https://recorder.handmadeproductions.de/

And it would be really great to choose any ofTexture for recording.
I already tried to achieve that, but i think somehow I need to draw the texture to another js canvas every draw circle (like the ofWindow in ofxAppEmscriptenWindow.cpp). Maybe someone can help me with that?

Maybe this is related (emscripten_webgl_make_context_current()):
"If the current browser does not support OffscreenCanvas, you can specify the EMSCRIPTEN_WEBGL_CONTEXT_PROXY_ALWAYS WebGL context creation flag. If this flag is passed, and code was compiled with -sOFFSCREEN_FRAMEBUFFER enabled, the WebGL context will be created as a “proxied context”. In this context mode, the WebGLRenderingContext object will actually be created on the main browser thread, and all WebGL API calls will be proxied as asynchronous messages from the pthread into the main thread. This will have a performance and latency impact in comparison to OffscreenCanvas contexts, however unlike OffscreenCanvas-based contexts, proxied contexts can be shared across any number of pthreads: you can use the emscripten_webgl_make_context_current() function in any pthread to activate and deactivate access to the WebGL context: for example, you could have one WebGL loading thread, and another WebGL rendering thread that coordinate shared access to the WebGL rendering context by cooperatively acquiring and releasing access to the WebGL rendering context via the emscripten_webgl_make_context_current() function. Proxied contexts do not require any special support from the browser, so any WebGL capable browser can create a proxied WebGL context."
https://emscripten.org/docs/api_reference/html5.h.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant