Emscripten no videoPlayer linux (mint & Manjaro)

Most projects work fine in emscripten but no way to get the video player to work, I try a lot of things but nothing works. I changed the SDK version, I used nightly compilation. The videoGrabberExample works, the sounds too, strangely there is only the video function which does not work. I would like to make interactive video tutorials as part of the courses I give…
Does someone have an idea?
beautiful day!

French Google Translate

Do you have any error message?
Bonjour

Exception thrown, see JavaScript console
( Mozilla Firefox 108.0.2 )

Uncaught ReferenceError: allocate is not defined
    _html5video_player_pixel_format http://localhost:6931/videoPlayerExample.js:1
    _main http://localhost:6931/videoPlayerExample.js:1
    callMain http://localhost:6931/videoPlayerExample.js:1
    doRun http://localhost:6931/videoPlayerExample.js:1
    run http://localhost:6931/videoPlayerExample.js:1
videoPlayerExample.js:1:168116
    _html5video_player_pixel_format http://localhost:6931/videoPlayerExample.js:1
    ofxEmscriptenVideoPlayer::getPixelFormat() const http://localhost:6931/videoPlayerExample.wasm:492416
    ofVideoPlayer::setPixelFormat(ofPixelFormat) http://localhost:6931/videoPlayerExample.wasm:516900
    ofApp::setup() http://localhost:6931/videoPlayerExample.wasm:588724
    ofNode::onParentOrientationChanged(glm::qua<float, (glm::qualifier)0>&) http://localhost:6931/videoPlayerExample.wasm:324121
    std::__2::__function::__func<std::__2::shared_ptr<of::priv::Function<ofKeyEventArgs, std::__2::recursive_mutex>> ofEvent<ofKeyEventArgs, std::__2::recursive_mutex>::make_function<ofMainLoop>(ofMainLoop*, void (ofMainLoop::*)(ofKeyEventArgs&), int)::'lambda'(void const*, ofKeyEventArgs&), std::__2::allocator<std::__2::shared_ptr<of::priv::Function<ofKeyEventArgs, std::__2::recursive_mutex>> ofEvent<ofKeyEventArgs, std::__2::recursive_mutex>::make_function<ofMainLoop>(ofMainLoop*, void (ofMainLoop::*)(ofKeyEventArgs&), int)::'lambda'(void const*, ofKeyEventArgs&)>, bool (void const*, ofKeyEventArgs&)>::operator()(void const*&&, ofKeyEventArgs&) http://localhost:6931/videoPlayerExample.wasm:68151
    ofEvent<ofEventArgs, std::__2::recursive_mutex>::notify(ofEventArgs&) http://localhost:6931/videoPlayerExample.wasm:43614
    ofCoreEvents::notifySetup() http://localhost:6931/videoPlayerExample.wasm:363985
    ofxAppEmscriptenWindow::loop() http://localhost:6931/videoPlayerExample.wasm:507863
    std::__2::__function::__func<void (*)(), std::__2::allocator<void (*)()>, void ()>::operator()() http://localhost:6931/videoPlayerExample.wasm:483047
    ofMainLoop::loop() http://localhost:6931/videoPlayerExample.wasm:330282
    main http://localhost:6931/videoPlayerExample.wasm:595700
    _main http://localhost:6931/videoPlayerExample.js:1
    callMain http://localhost:6931/videoPlayerExample.js:1
    doRun http://localhost:6931/videoPlayerExample.js:1
    run http://localhost:6931/videoPlayerExample.js:1

I don’t know javascript, but I know how to read the video player on Arturo’s site
https://arturocastro.net/files/of-emscripten/videoPlayerExample/
Other examples work fine…
I probably should have specified that the compilation is carried out without problem, but it is the opening which does not work!
yé!

@dimitre
here are the messages from my terminal

emrun bin/videoPlayerExample.html
Now listening at http://0.0.0.0:6931/
[GFX1-]: glxtest: VA-API test failed: failed to initialise VAAPI connection.
[GFX1-]: Unrecognized feature ACCELERATED_CANVAS2D
[2023-04-12T16:23:39Z ERROR glean_core::metrics::ping] Invalid reason code startup for ping background-update
----------------------------------------
Exception occurred during processing of request from ('127.0.0.1', 56768)
Traceback (most recent call last):
  File "/home/db/emsdk/upstream/emscripten/emrun.py", line 623, in send_head
    f = open(path, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/home/db/of_v20230412_linux64gcc6_release/examples/video/videoPlayerExample/bin/favicon.ico'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/socketserver.py", line 683, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.10/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.10/http/server.py", line 658, in __init__
    super().__init__(*args, **kwargs)
  File "/usr/lib/python3.10/socketserver.py", line 747, in __init__
    self.handle()
  File "/usr/lib/python3.10/http/server.py", line 432, in handle
    self.handle_one_request()
  File "/usr/lib/python3.10/http/server.py", line 420, in handle_one_request
    method()
  File "/usr/lib/python3.10/http/server.py", line 662, in do_GET
    f = self.send_head()
  File "/home/db/emsdk/upstream/emscripten/emrun.py", line 625, in send_head
    self.send_error(404, "File not found: " + path)
  File "/usr/lib/python3.10/http/server.py", line 487, in send_error
    self.wfile.write(body)
  File "/usr/lib/python3.10/socketserver.py", line 826, in write
    self._sock.sendall(b)
BrokenPipeError: [Errno 32] Broken pipe
----------------------------------------

Hmm - pinging @Jona for this one!
Will see if I can recreate here. Have you tried running it in different browsers?

merci @theo
on my side I tested on firefox chromium and google Chrome
same result

@theo @bernard_Del its a known issue, that appeared with a pr like a month ago (just no idea how to solve it): ofVideoPlayer and Emscripten · Issue #7377 · openframeworks/openFrameworks · GitHub

@Jona
Thanks, I’ll take a closer look!

thank @Jona you but when you say
“I use ofSoundStream (before loading video player) in ofSetup” do you do this or is it another way?

//--------------------------------------------------------------
void ofApp::setup(){
	
	ofSoundStream();
	ofBackground(60,60,60);
	fingerMovie.load("movies/fingers.mp4");
	fingerMovie.setLoopState(OF_LOOP_NORMAL);
	fingerMovie.play();

}

because it doesn’t work for me

Not really sure, but I think I also had to include ofSoundStream.h in ofApp.h.

ok i have to give up for today…
I added

#include "ofSoundStream.h" in ofApp.h.`

and in ofApp.cpp

void ofApp::setup(){
       ofSoundStream();

but no video.
always the same message in the firefox console:

Uncaught ReferenceError: allocate is not defined
     _html5video_player_pixel_format http://localhost:6931/videoPlayerExample.js:1
     _main http://localhost:6931/videoPlayerExample.js:1
     callMain http://localhost:6931/videoPlayerExample.js:1
     doRun http://localhost:6931/videoPlayerExample.js:1
     run http://localhost:6931/videoPlayerExample.js:1

thank you @Jona , we will have tried!
the rest in the next episode

here’s a kind of tacky solution - just replace this file in libs/openFrameworks/sound/

2 Likes

I’ll check that tomorrow morning, great. i will tell you what happens
Merci pour le suivi !

Hello,
Great @theo, it works by changing the file ofSoundStream.cpp
Have a nice day and thank you for your help @dimitre , @Jona !
Bernard
Of-Emscripten-Test-video-

2 Likes

Great! Going to merge this hack fix for now and we can getter a better solution going. :+1:

1 Like