0 Favourites

Audio streaming issue

  • 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?

  • Hi ; did you figured out how to solve your problem ? I started working on a streaming radio app and this could interests me.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Hi Coin-Coin, I'm afraid not. I haven't had time to look much further into this. The only solution I can see at the moment would be to create a new Audio plugin which would both allow people to create a stream with the code I used with "Execute javascript" and retain the handle to the execute the audio.pause. If you hear of anyone who wants to write such a plugin, let me know.

  • SOLVED!

    Just created a plugin called Audiostream which allows to stream and stop playing online streams.

  • SOLVED!

    Just created a plugin called Audiostream which allows to stream and stop playing online streams.

    can we get access to it?:D if you dont mind sharing thats all, i wont mind donating or purchasing it from u

  • gamescorpstudio He posted it on the forum

    wmsgva Nice work!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)