[SOLVED]How do I play music (mp3) from an URL

Get help using Construct 2

Post » Sun Jul 13, 2014 9:06 am

Hi :)

I simply want to know how i can play an music (mp3) from a URL stored in an variable instead of my project files ?

Thank in advance for your response ^^
Last edited by TheMax98000 on Mon Jul 21, 2014 1:34 pm, edited 1 time in total.
B
4
S
1
Posts: 24
Reputation: 390

Post » Sun Jul 13, 2014 6:30 pm

Try This:

Create a global variable called URL, set it to text, and leave the value blank

Global text URL = ""


System> On start of layout > System > Set URL to "http://www.whatever.com/your_music.mp4"

System> On start of layout > Audio > Play "http://www.whatever.com/your_music.mp4"

__________________________________or

Use Play (by name)

and put the following in the name and tag fields:

"http://www.whatever.com/your_music.mp4"


I didn't test this

Hope this or some variation of this helps....
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,283

Post » Mon Jul 14, 2014 6:16 am

Thank you, but it doesn't work :/

I think it's because the audio plugin search on the "Sounds" or "Musics" folder on the local project, but i don't need the effects of the audio object give to me.

I just need to Play/Pause mp3 from an url, if i can use javascript or wathever like this and don't use the audio object, it's not a problem for me ^^

Thank for your futur help :)
B
4
S
1
Posts: 24
Reputation: 390

Post » Tue Jul 15, 2014 4:23 pm

I just up this post ^^

Thank for any future helper(s) ;)
B
4
S
1
Posts: 24
Reputation: 390

Post » Thu Jul 17, 2014 6:46 am

up please ^^
B
4
S
1
Posts: 24
Reputation: 390

Post » Thu Jul 17, 2014 2:14 pm

well, you can use the iframe plugin. (search forum)
And then use the "soundcloud embed" feature on soundcloud in your iframe to play/stream big remote audio files.

Thats what i do, anyway. :P
B
37
S
9
G
8
Posts: 541
Reputation: 8,554

Post » Thu Jul 17, 2014 2:18 pm

plugin name:
HTML_iFrame_Pode

The url to set ind the iframe:

"https://w.soundcloud.com/player/?url=LINK_TO_AUDIO_FILE_ON_SOUNDCLOUD_HERE&color=ff6600&auto_play=true&show_artwork=false"
B
37
S
9
G
8
Posts: 541
Reputation: 8,554

Post » Thu Jul 17, 2014 2:24 pm

Why you shouldn't use MP3 in your HTML5 games
Basically, there's no HTML5 way to read a MP3 file. So unless you're going through some kind of flash player, which may not be installed on every computers, you'll likely have different results from a computer to another.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
292
S
115
G
96
Posts: 7,295
Reputation: 70,795

Post » Fri Jul 18, 2014 12:35 pm

I will try the iframe method, thanks ^^
B
4
S
1
Posts: 24
Reputation: 390

Post » Mon Jul 21, 2014 1:33 pm

Thanks, i use the div plugin with this code -->

<audio controls>
<source src='yoursourcehere.mp3 type='audio/mpeg'>
Your browser does not support the audio control.
</audio>
B
4
S
1
Posts: 24
Reputation: 390


Return to How do I....?

Who is online

Users browsing this forum: 25games, jatin1726, kiki4construct, Username05 and 31 guests