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

ofVideoPlayer and Emscripten #7377

Open
Tracked by #6692
Jonathhhan opened this issue Mar 12, 2023 · 10 comments
Open
Tracked by #6692

ofVideoPlayer and Emscripten #7377

Jonathhhan opened this issue Mar 12, 2023 · 10 comments

Comments

@Jonathhhan
Copy link
Contributor

Jonathhhan commented Mar 12, 2023

With the current OF branch the videoPlayer examples only work with Emscripten, if I use ofSoundStream (before loading the video player) in ofSetup. Somehow that was not needed before...

Thats the error without ofSoundStream:

Uncaught ReferenceError: AUDIO is not defined
    at _html5video_player_create (videoPlayerExample.js:1:183919)
    at ofxEmscriptenVideoPlayer::ofxEmscriptenVideoPlayer() (videoPlayerExample.wasm:0x4605f)
    at ofApp::setup() (videoPlayerExample.wasm:0x908f4)

AUDIO is defined in https://github.com/openframeworks/openFrameworks/blob/master/addons/ofxEmscripten/libs/html5audio/lib/emscripten/library_html5audio.js and used by the videoPlayer, because it uses the same audioContext (which is needed for panning for example)...

@dimitre
Copy link
Member

dimitre commented Mar 12, 2023

Is this some regression? it used to work well?
if yes can you please try to identify which commit introduced this behavior?

@Jonathhhan
Copy link
Contributor Author

@dimitre yes, it was working before (not long ago). will try to find the commit the next days...

@dimitre
Copy link
Member

dimitre commented Mar 14, 2023

can you please test it again in latest master?

@Jonathhhan
Copy link
Contributor Author

@dimitre still the same with the latest master. I will have a look into the recent commits, when I have some time (soon).

@Jonathhhan
Copy link
Contributor Author

Jonathhhan commented Mar 16, 2023

@dimitre I found it (actually not sure how to solve this): https://github.com/openframeworks/openFrameworks/pull/7301/files :)

@Jonathhhan
Copy link
Contributor Author

@2bbb is there a way to enable soundstream for the videoplayer automatically (like before) with Emscripten? Thank you.

@2bbb
Copy link
Contributor

2bbb commented Mar 19, 2023

Hi, @Jonathhhan

maybe there is a way, I think.
but I don't understand about Emscripten...

@2bbb
Copy link
Contributor

2bbb commented Mar 19, 2023

Notice: I DON'T UNDERSTAND Emscripten.

can we call ofxEmscriptenAudioContext() in ofxEmscriptenVideoPlayer:: load()? (isn't there setup...?)
currently ofxEmscriptenAudioContext() is hide in implementation only in ofxEmscriptenSoundPlayer.cpp.
but maybe we can test quickly with dirty way to edit ofxEmscriptenVideoPlayer.cpp like:

extern int ofxEmscriptenAudioContext();

bool ofxEmscriptenVideoPlayer::load(string name){
	ofxEmscriptenAudioContext();
	if (name.substr(0, 12) == "blob:http://" || name.substr(0, 13) == "blob:https://"){
  ....
}

this way is to only for test. if it clear problem, then we need to decide to make ofxEmscriptenAudioContext public in header, or not.

@Jonathhhan
Copy link
Contributor Author

Jonathhhan commented Mar 21, 2023

@2bbb thanks a lot. I tried your suggestion but it does not work.
No, there is no setup (like in ofVideoPlayer?)
Now the error is:
Uncaught TypeError: Cannot read properties of undefined (reading 'createMediaElementSource')
in: https://github.com/openframeworks/openFrameworks/blob/master/addons/ofxEmscripten/libs/html5video/lib/emscripten/library_html5video.js

@ofTheo
Copy link
Member

ofTheo commented Apr 12, 2023

Sort of a hack but this works for me:

https://gist.github.com/ofTheo/4283463783876f901f80c00f99bc56ec

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

No branches or pull requests

4 participants