-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 - regression from #7617 - video files are not found #7627
Comments
Maybe it works without
Not sure why some data types like images seem to work without |
@Jonathhhan thanks! I think the issue is that from the javascript side of things which But ofDirectory sees the file lying in So I think we need some sort of layer between EDIT: It pretty much describes the problem. |
I tried something like this to sync and read the file but while the
|
so just to be clear, the regression here is that video would work, but you had to upload |
the goal of #7617 is to minimize the manipulations required to “publish” an emscripten project. the current proposal needs a simple copy. maybe there are alternatives, generating a sort of « dist ». is the video file actually bundled in the js data file? (i am unfortunately not in a position to check things now). if we end up requiring plain /data ressources, we don’t want to duplicate assets, so they should be excluded from the data file (?). is the data file required or real advantage to a plain directory? (it does make things more complicated to update vs traditional web server management) |
This patch shows how to load external media files, the filesystem is only needed for images: https://github.com/Jonathhhan/ofEmscriptenExamples/blob/main/emscriptenImport/src/ofApp.cpp Other than that |
i had a moment to look at things; in short: packaging stuff into a dir reveals a design problem. (TLDR for those unfamiliar with the emscripten data file like I was 20 minutes ago: it is an image of a directory hierarchy packaged in a file, and that hierarchy functions transparently like the system drive in regards to native C++ file interaction) so ofToDatapath() builds the paths and return
so we have a system where some assets are bundled and managed internally by emscripten's "C++" filesystem, and some managed by javascript as relative URLs on the web server... it was luck that both worked, because they shadowed each other. i find that "surprising"... especially since the contents of whole bin/data is copied into the data file (but for movies, they serve no purpose there). i presume ofxEmscriptenVideoPlayer exists because the native C++ movie players don't work well in emscripten. @Jonathhhan wrote :
my take is that it would make more sense to make ofImages work with a similar JS backflip to get back a full web server URL to pass to ofImage::loadURL(). (except when using emrun, the stuff will have to be downloaded one way or another) it would also make it more friendly to asset management — as of now if you want to change an image in a deployed emscripten project you need the emsdk to re-generate/re-upload the data filesystem. then, if we want to keep the idea of bundling an app into a meaningfully-named directory, it means but considering the compatibility with other platforms, better something like |
To be more clear: |
Yes, I should add to @Jonathhhan's reply. The wasm filesystem is needed for everything except video/audio: I am not sure if uploading the data/ folder instead of packaging the files would end up causing more issues than we'd solve. ( I am not sure the C++ code can read from the web directory for example ).
Yes, I think that is the case but it might be worth investigating some different approaches. I guess we could compile ffmpeg for emscripten if needed, but I think it will be possible to get the The very simple but not great solution though would be to exclude all video / sound files from being packaged and to copy just those files over to myAppFolder/data/ |
Okay, so I think the solution will work. |
indeed a partial data file (no video/audio) makes sense in terms of disk space but it's still quite strange (at least to me, a "newcomer" to emscripten app distribution) that some of my media will live as plain, accessible files on the web server, and some will need an emsdk preprocess packaging step. when I made the PR to bundle things in a directory I was under the impression that the data.fs was required and sufficient (an inference made because it's size matched the data dir, plus my test with (unfortunately) an image asset). I guess I don't know if the goal of emscripten OF to (1) transparently "port" desktop apps with as little as possible changes to the src (using the same examples, for example), or (2) be more like iOS/android where it is quite implicit that an app designed natively there will not work on desktop, but will pull as much benefit as possible from the underlying platform.
so:
|
@artificiel well the old approach before your PR was that files were getting bundled twice which definitely created more confusion and hid this issue. I think having everything use index.data makes sense as a shorter term fix and I agree I am not sure if 2) would be a big project, but it could definitely be fairly involved. In the end having the option for both might be handy - some people might want their files easily switched out, while others might want the security of having the files compiled to index.data. |
that’s super! now that everything is bundled in data.fs it shifts a bit the problem which becomes being able to edit data.fs without being in the emsdk workflow. that could be offline (a kind of « image explorer » that mounts data.fs as a disk) or online (a form of server-side proxy to FS). i guess these 2 things already exist in some form somewhere… but what’s nice about these 2 options is that they are completely external — from the OF/C++ perspective we have a clean and coherent solution. |
I think we have a regression from this #7617
Not sure why but since #7617 ( cc @artificiel ) moving the html to a directory and not copying the data/ folder videos now don't load.
copying
data/
intoopencvExample/
fixes the issue.@Jonathhhan as he has some insight into how file loading is working from index.data
but this might warrant a patch-release.
The text was updated successfully, but these errors were encountered: