Play music from link

Discussion and feedback on Construct 2

Post » Thu Jan 26, 2012 8:13 pm

Is it possible play music from a URL? I haven't found a way to do this, but maybe it's possible... if it's not possible, is there plans to make this possible? Perhaps a 3rd party plugin out there already?
B
47
S
10
G
6
Posts: 455
Reputation: 8,326

Post » Fri Jan 27, 2012 1:16 am

[QUOTE=VampyricalCurse] Is it possible play music from a URL? I haven't found a way to do this, but maybe it's possible... if it's not possible, is there plans to make this possible? Perhaps a 3rd party plugin out there already?[/QUOTE]

Ive been doing a bit of experimenting with regards to sounds, and there is way to play sounds if you add stuff to the index.html file.

I added it to the bottom of my 'falling leaves' example...
LEAVES

Press play and a short audio file is loaded from my dropbox folder.

I tried to do it with the html-elements plugin but couldnt get it to work.

If you save the page, you can open it in a text editor to see how its done.

This isnt a tutorial, its just something I have been playing around with.






B
19
S
6
G
7
Posts: 1,204
Reputation: 7,296

Post » Fri Jan 27, 2012 3:29 pm

@chrisbrobs: I see, so you used html5's audio tag. I was thinking more of doing it within C2, But you said you tried and didn't work. I guess we'll just have to wait and see if this is implemented later. Thank you.

Also, very nice falling leaves effect!
B
47
S
10
G
6
Posts: 455
Reputation: 8,326

Post » Fri Jan 27, 2012 3:46 pm

[QUOTE=VampyricalCurse] @chrisbrobs: I see, so you used html5's audio tag. I was thinking more of doing it within C2, But you said you tried and didn't work. I guess we'll just have to wait and see if this is implemented later. Thank you.

Also, very nice falling leaves effect![/QUOTE]

It might work, i just dont know what settings need to be added to get it to work? In the capx that comes with the plugin, there isn't an Audio example.If Jesse Johnston reads this, he might post an example?
B
19
S
6
G
7
Posts: 1,204
Reputation: 7,296

Post » Fri Jan 27, 2012 7:10 pm

[QUOTE=chrisbrobs]It might work, i just dont know what settings need to be added to get it to work? In the capx that comes with the plugin, there isn't an Audio example.If Jesse Johnston reads this, he might post an example?[/QUOTE]

That would be most appreciated indeed.
B
47
S
10
G
6
Posts: 455
Reputation: 8,326

Post » Fri Jan 27, 2012 11:33 pm

I was just thinking! If you have your sound hosted on youtube, make it private or something.

The use this plugin: http://www.scirra.com/forum/plugin-jessejohs-html-elements-pack_topic47084_post294874.html <-- the HTML IFrame one. you can call the youtube link and play the track, Meaning you'll have audio!!.

you'll want to place it out of view though
B
29
S
12
G
7
Posts: 740
Reputation: 7,839

Post » Fri Jan 27, 2012 11:35 pm

B
29
S
12
G
7
Posts: 740
Reputation: 7,839

Post » Sat Jan 28, 2012 12:20 am

[QUOTE=smitchell] Like this: http://activeden.net/item/youtube-music-player/162816?WT.ac=free_file&WT.seg_1=free_file&WT.z_author=CodingJack Obviously this is AS3 but this is what i mean [/QUOTE]



I tried the HTML-div plugin first, but I just can't get my head around the actual settings?
B
19
S
6
G
7
Posts: 1,204
Reputation: 7,296

Post » Fri Feb 01, 2013 11:03 am

Hey there @chrisbrobs @VampyricalCurse @Pode
I did some tests too and it does work just fine with the div plugin :]

Just add the plugin to your layout, and use the "Set innerHTML" action with something like this:
(In this example, I'm also styling the player in the case you want to show it. You could also use variables to change the track name)

"<style type='text/css'>audio{opacity:0.5; width: 500px;}</style><audio controls autoplay loop><source src='http://glitched.heliohost.org/music/Caverns.ogg' type='audio/ogg'><source src='http://glitched.heliohost.org/music/Caverns.mp3' type='audio/mpeg'></audio>"

I have a quite big music library, so I decided to use this method for more flexibility with the hosting ^^
B
20
S
5
G
8
Posts: 325
Reputation: 6,473

Post » Fri Feb 01, 2013 11:23 am

Interesting. Wonder if the audio tag could be adapted to connect to a stream. In game radio might be a unique feature for some games.
B
26
S
8
G
3
Posts: 210
Reputation: 5,973

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 4 guests