In the game I'm currently creating, players can click on a radio in some of the rooms and it then starts streaming from one of the local radios.
This works fine when starting the streaming using the Browser plugin. When the player clicks on the radio object, the Browser object
calls the following javascript code using the "Execute javascript" action:
"var audio = new Audio('http://onefm.ice.infomaniak.ch:80/onefm-high.aac');audio.play();"
My issue occurs when I want to stop the stream from playing. I did try to have the Browser object execute the following javascript:
"audio.pause();audio.currentTime = 0;"
This is the correct way to stop the stream playing, but I suspect the issue is that the "audio" object is not declared anymore (the browser
forgets it when it has finished executing the first set of instructions, as the variable "audio" is local).
In a conventional programming language, I wouldn't have a problem, as I would have stored the variable and just recalled it, but I don't
know how to solve the problem in C2. Is there any way to call some javascript code that would allow me to reassign the current audio
stream object back to a variable in order to then use this variable with the pause() method and to set the currentTime parameter to zero?