ttencate / jfxr

A browser-based tool to create sound effects for games.
http://jfxr.frozenfractal.com/
429 stars 45 forks source link

request: set jfxr.autoplay to false onload #37

Closed blurymind closed 5 years ago

blurymind commented 5 years ago

this is so the app doesnt autoplay upon loading. I am trying to stop it from playing a sound when loading , because when embeding it in gdevelop, I am making it load a sound that it previously stored in a gdevelop project- after it has loaded.

What ends up happening is that it loads, it plays the last edited sound from another resource, then loads the sound from my resource and plays it after.

I was wondering if there is a way of disabling this by appending autoplay=0 to the url of the app or something

ttencate commented 5 years ago

Can you access localStorage before the app is fully loaded? If so, it should work if you do localStorage['autoplayEnabled'] = false.

blurymind commented 5 years ago

Hi I will try :) Before I gain access to jsfx controller, I have to wait for it to load inside the iframe. The problem is that it seems to play the sound even before it has completely loaded the dom

My request here was for a way to disable the autoplay by appending something to the url, like .../index.html#autoplay=0

That will make it so much easier

ttencate commented 5 years ago

I think the autoplay on load was just a side effect of how Angular initializes its watches, and not necessarily a feature I included on purpose. In any case it will stop working in newer Chrome versions soon, because sites will require user interaction before they are allowed to play any audio. So I'll just suppress the autoplay on load altogether.

blurymind commented 5 years ago

Thank you 😸 This will allow me to remove the half broken workaround I had with muting the electron window and unmuting it