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

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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....

  • 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

  • I just up this post ^^

    Thank for any future helper(s)

  • up please ^^

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

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

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

  • I will try the iframe method, thanks ^^

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

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