Audio streaming issue

Discussion and feedback on Construct 2

Post » Mon Mar 23, 2015 7:46 pm

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?
B
10
S
3
Posts: 87
Reputation: 957

Post » Sat Jun 27, 2015 8:29 am

Hi ; did you figured out how to solve your problem ? I started working on a streaming radio app and this could interests me.
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Wed Jul 01, 2015 7:41 pm

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.
B
10
S
3
Posts: 87
Reputation: 957

Post » Wed Jul 22, 2015 9:07 am

SOLVED!

Just created a plugin called Audiostream which allows to stream and stop playing online streams.
B
10
S
3
Posts: 87
Reputation: 957

Post » Thu Jul 23, 2015 12:33 pm

wmsgva wrote: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 :)
B
70
S
20
G
67
Posts: 1,316
Reputation: 42,305

Post » Thu Jul 23, 2015 12:39 pm

@gamescorpstudio He posted it on the forum :)
viewtopic.php?f=183&t=150385&p=953182&hilit=create+plugins#p953182

@wmsgva Nice work!
B
52
S
22
G
12
Posts: 728
Reputation: 11,722

Post » Thu Jul 23, 2015 12:45 pm

@Anonnymitet

thanks :D
B
70
S
20
G
67
Posts: 1,316
Reputation: 42,305


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 1 guest