Commit 4c2d3527 authored by Olivier FAURE's avatar Olivier FAURE
Browse files

Add get_media_player function

parent dbff0ca7
......@@ -31,6 +31,7 @@ PROJECT_DIR=${PROJECT_DIR:=./vlc/extras/package/wasm-emscripten/build}
emcc --bind -s USE_PTHREADS=1 -s TOTAL_MEMORY=1GB -s PTHREAD_POOL_SIZE=15 \
-s OFFSCREEN_FRAMEBUFFER=1 -s USE_WEBGL2=1 --profiling-funcs \
-s MODULARIZE=1 -s EXPORT_NAME="VlcModule" \
-s EXTRA_EXPORTED_RUNTIME_METHODS="allocateUTF8" \
-I $PATH_VLC/include/ -I $PROJECT_DIR/wasm32-unknown-emscripten/include/ main.c \
$PROJECT_DIR/build-emscripten/lib/.libs/libvlc.a \
$PROJECT_DIR/build-emscripten/vlc-modules.bc \
......
export class MediaPlayer {
constructor(module, path) {
this.module = module;
//this.media_player_ptr = module._libvlc_media_player_new_from_path(path);
this.media_player_ptr = module._get_media_player_buck_bunny();
this.media_player_ptr = 0;
let path_ptr = module.allocateUTF8(path)
this.media_player_ptr = module._get_media_player(path_ptr);
module._free(path_ptr);
}
toggle_play() {
......
......@@ -52,11 +52,11 @@ int main() {
return 0;
}
void* EMSCRIPTEN_KEEPALIVE get_media_player_buck_bunny() {
void* EMSCRIPTEN_KEEPALIVE get_media_player(const char* path) {
libvlc_media_player_t *media_player;
libvlc_media_t *m;
m = libvlc_media_new_path( libvlc, "./samples/BigBuckBunny.mp4" );
m = libvlc_media_new_path( libvlc, path );
if (m == NULL)
{
......
......@@ -117,7 +117,7 @@
};
const overlay = document.getElementById("overlay");
const media_player = new MediaPlayer(Module);
const media_player = new MediaPlayer(Module, "./samples/BigBuckBunny.mp4");
window.media_player = media_player;
window.on_overlay_click = on_overlay_click;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment