How to get rid of the play button on ios/android platform
16 February 2016 10:51
16 February 2016 21:41
17 February 2016 17:24
After load xx.json, a play button shows. If load just one .json file, that's fine, but I need dynamically load dozens xx.json file. After second load_callback, the play button shows again and the screen freeze.
any suggestion?
Hi! This button is shown up when a scene contains some media data (basically video textures and speakers). It is needed because this media files require a user action to start playing. If you want to get rid of this button only for the dynamically loaded scenes you should set the "media_auto_activation" config parameter to False after the main scene was loaded, for example, in your "load_callback" function:
...
m_data.load("main_scene.json", main_load_cb);
...
m_data.load("secondary_scene.json", sec_load_cb);
...
function main_load_cb(data_id, success) {
m_config.set("media_auto_activation", false);
}
If you want to remove this button at all you can set this flag right at the app initialization:
exports.init = function() {
m_app.init({
...
media_auto_activation: false,
...
});
}
But this media stuff still needs a user action, so you'll probably need to do something with it. For example, a custom button to start playing. There is also a special method for this purpose: data.activate_media. It should help to avoid some issues on those devices. It should be called at the moment the user input happens. This article is an example of the usage. The source code is here: https://github.com/TriumphLLC/Blend4Web/blob/master/deploy/tutorials/examples/web_page_integration/example.js
18 February 2016 05:55
18 February 2016 10:20