[SOLVED] I need little help about sound and URL

I can’t load sounds. Long sounds (like music) never starts on html.

I suggest “load sounds before load” option.

My second suggestion is self load URL. When I click url canvas URL loads on another tab. How can I load URL in same tab?

Thanks

1 Like

Hi. Sorry for the late reply. I personally don’t know of any methods to force Armory to autoplay audio on browser devices. You might be interested in this article though:

1 Like

Thanks for the reply. I don’t need auto play. I need play any large sound file (maybe 7-8 minutes long) after hit to the button. Little sound files already play when I trigger it.

I suggest load all sounds before interface seen. Maybe in loading screen.

And my second need _self and _blank URL codes. What can I do?

My sincere apologies… I believe I vastly misread your post.

I have no idea why this happens, sorry.

Armory uses Kha’s loadUrl() function for HTML5 builds.

Armory - loadUrl logic node

Kha - loadUrl() function

For some reason Kha only supports the opening of URLs on new pages. If you want to add a URL on the active page instead of in a new tab you’ll need to use this code instead:

js.Browser.window.open(url, "_self");

You can run this new code either of two ways:

  1. Manually run the code in a Haxe script. You might want to add HTML5 build checks to prevent the code from running on non-HTML5 builds though, example: armory/Sources/armory/logicnode/ClearConsoleNode.hx at main · armory3d/armory · GitHub
  2. Or you edit your version of the Kha file I shared above and either replace the _blank part with _self, or you create your own version of the loadUrl function, right alongside the original function.

Either of the two ways, you should be able to run the code with logic nodes via three ways:

  1. If you choose to edit the original function, the loadUrl logic node should run as expected.
  2. If you choose to create a new function, you’ll need to either edit the loadUrl logic node to use the new function, or you can create a new loadUrl logic node, if you know how to.
  3. Run Haxe function using the Call Haxe Static or Script logic node.
1 Like

Please don’t apologise. You are superior humans in my eyes :smiling_face_with_three_hearts:

1 Like

Thanks for the reply. I don’t need auto play. I need play any large sound file (maybe 7-8 minutes long) after hit to the button. Little sound files already play when I trigger it.
I suggest load all sounds before interface seen. Maybe in loading screen.

I’m having the same issue, big sound files won’t play in html5 after a while. Did you find a workaround for this?