Play Audio in Mobile App using URL

  

How to  Play audio from URL like "http://www.noiseaddicts.com/samples_1w72b820/2242.mp3"

There are many topics on playing audio but nothing seems working.
I want to play an audio on clicking play button.
Please Help!!!

John Snow wrote:

How to  Play audio from URL like " http://www.noiseaddicts.com/samples_1w72b820/2242.mp3"

There are many topics on playing audio but nothing seems working.
I want to play an audio on clicking play button.
Please Help!!!

Hi there.

You can do something like I explained on a previous post.

So, you can do something like:

function playSound(url) {
    var a = new Audio(url);
    a.play();
}

or simply:

<a href="#" onclick="new Audio('http://www.noiseaddicts.com/samples_1w72b820/2242.mp3').play()">Click here to play the sound</a>

Cheers,

GM

Gonçalo Martins wrote:

John Snow wrote:

How to  Play audio from URL like " http://www.noiseaddicts.com/samples_1w72b820/2242.mp3"

There are many topics on playing audio but nothing seems working.
I want to play an audio on clicking play button.
Please Help!!!

Hi there.

You can do something like I explained on a previous post.

So, you can do something like:

function playSound(url) {
    var a = new Audio(url);
    a.play();
}

or simply:

<a href="#" onclick="new Audio('http://www.noiseaddicts.com/samples_1w72b820/2242.mp3').play()">Click here to play the sound</a>

Cheers,

GM


The above solution works only when I Open the App in Browser. It Does not work in mobile. Any reason Why?
Thanks

Hi, you must use a URL with "https" (be aware that some online audio sounds don't provide an HTTPS version, only HTTP, this will not work in mobile), using this you will be able to play that within the mobile app in the device after generating the .apk.