diff --git a/share/emscripten/gpac.html b/share/emscripten/gpac.html index efa8611108..9c5e5bbd2d 100644 --- a/share/emscripten/gpac.html +++ b/share/emscripten/gpac.html @@ -483,7 +483,10 @@

Performances

let fs_steps = 20; let FS = null; - const STATIC_SRC = `${window.location.origin}/data`; + let STATIC_SRC; + if (window.location.origin.indexOf('.gpac.io')>0) STATIC_SRC = `${window.location.origin}/data`; + else if (window.location.origin.startsWith('http://')) STATIC_SRC = 'http://wasm.gpac.io/data'; + else STATIC_SRC = 'https://wasm.gpac.io/data'; const examples = [ { @@ -528,14 +531,6 @@

Performances

setCommand(item.cmd.trim()); }; - async function toggle_threading() { - if (LIBGPAC.has_threads()){ - - } - // if GPAC is running, abort - // unload current GPAC - } - function setCommand(value) { cmdElement.value = value == '' ? null : value; }; @@ -2373,6 +2368,23 @@

Performances

} } + function check_threading() { + const threaded = LIBGPAC.has_threads; + const threadedOnly = [...document.getElementsByClassName('threaded')]; + threadedOnly.forEach(el => el.hidden = !threaded); + const thStatus = document.getElementById('threading_status'); + + threadingElement.checked = threaded; + if (window.location.href.indexOf('.gpac.io')<0) { + threadingElement.disabled = true; + } else { + threadingElement.onchange = () => { + const hostname = threaded ? 'wasm.gpac.io' : 'wasmth.gpac.io'; + window.location.href = `https://${hostname}/`; + console.log('Reloading to ' + window.location.href); + } + } + } const LIBGPAC = { preRun: [ // function() { LIBGPAC.ENV.SDL_EMSCRIPTEN_KEYBOARD_ELEMENT = "#canvas"; } @@ -2481,6 +2493,7 @@

Performances

load_history(); } }); + check_threading(); onGpacReady(); }, @@ -2549,17 +2562,6 @@

Performances

libgpac(LIBGPAC); }); - document.addEventListener('readystatechange', function() { - const threaded = window.location.hostname == 'wasmth.gpac.io'; - const threadedOnly = [...document.getElementsByClassName('threaded')]; - threadedOnly.forEach(el => el.hidden = !threaded); - threadingElement.checked = threaded; - threadingElement.onchange = () => { - const hostname = threaded ? 'wasm.gpac.io' : 'wasmth.gpac.io'; - window.location.href = `https://${hostname}/`; - console.log(hostname); - } - }); diff --git a/src/utils/os_config_init.c b/src/utils/os_config_init.c index a19fe59f8f..551624afff 100644 --- a/src/utils/os_config_init.c +++ b/src/utils/os_config_init.c @@ -1382,15 +1382,17 @@ GF_Err gf_opts_save() #include +#ifdef GPAC_CONFIG_EMSCRIPTEN +#define LOGFILE_HELP "set output log file - use `console` for browser console" +#else +#define LOGFILE_HELP "set output log file" +#endif + GF_GPACArg GPAC_Args[] = { GF_DEF_ARG("tmp", NULL, "specify directory for temporary file creation instead of OS-default temporary file management", NULL, NULL, GF_ARG_STRING, 0), GF_DEF_ARG("noprog", NULL, "disable progress messages", NULL, NULL, GF_ARG_BOOL, GF_ARG_HINT_ADVANCED|GF_ARG_SUBSYS_LOG), GF_DEF_ARG("quiet", NULL, "disable all messages, including errors", NULL, NULL, GF_ARG_BOOL, GF_ARG_HINT_ADVANCED|GF_ARG_SUBSYS_LOG), - GF_DEF_ARG("log-file", "lf", "set output log file" -#ifdef GPAC_CONFIG_EMSCRIPTEN - " - use `console` for browser console log" -#endif - , NULL, NULL, GF_ARG_STRING, GF_ARG_SUBSYS_LOG), + GF_DEF_ARG("log-file", "lf", LOGFILE_HELP, NULL, NULL, GF_ARG_STRING, GF_ARG_SUBSYS_LOG), GF_DEF_ARG("log-clock", "lc", "log time in micro sec since start time of GPAC before each log line except for `app` tool", NULL, NULL, GF_ARG_BOOL, GF_ARG_SUBSYS_LOG), GF_DEF_ARG("log-utc", "lu", "log UTC time in ms before each log line except for `app` tool", NULL, NULL, GF_ARG_BOOL, GF_ARG_SUBSYS_LOG), GF_DEF_ARG("logs", NULL, "set log tools and levels. \n"