play audio in mobile app

play audio in mobile app

  

I know how play audio files in web apps using HTML5 Goodies, but i don't know how to play audio files in mobile apps.

I have tryed to copy this app over to a mobile app, but failed.

Do someone know have to play audio files in mobile apps?

Plz help

Hi,

You can use the "Video" widget to play audio files. Pass it the URL to an audio file, and it will play it.

which video widget?

I assume you're developing a P10 mobile app, right? If so, you have a Video widget available to use in your apps, as shown in the image below:

Do i need a "File_ReadBinary" server action to get it to work?

No, the Video widget only needs the URL of the file to be played. If you're going to play a resource file, you need to set its "Deploy Action" property to "Deploy to Target Directory".

Also, notice that in your resource's properties there's a read-only property called "Runtime Path". This is the path to your resource file. So, the complete URL that you need to pass to the widget would be something like: https://<YourPersonalEnvironment>/<ResourcePath>.

I have no idea :)

The "SourceFile" property is a Text property, so you need to place the URL between double quotes, like this:

"https://yourpersonalenvironment/yourapp/test/Sound".

What you had in the first image (Resources.sound.URL) should work. Did it not?

None off them worked. Can it have something to do with the sound file?

Maybe. What kind of file is it? Can you share it, so that I can give it a try?

Ok, here's a simple, working example that plays the file you posted.

Thx again for all the help

Hi, its me again :)

When you click the video widget you get a video layout with a black background and audio. Is there any way to make a new widget with my own design and make it work?

Hi,

Let me just add that Aurelio's solution (using the URL attribute of the resource) also causes the resource to be pre-fetched and available to be played while offline.

Hi once again :)

You can play a sound without any interface using the Audio JavaScript API. Take a look at this thread: http://stackoverflow.com/questions/9419263/playing-audio-with-javascript

You may have a JavaScript node with that code inside to play the audio. Pass the resource URL as an input parameter and use it in there.

Hi Carlos,

Thank you for the info! Let me say that the URL attribute is really useful, and should also be available in web apps.

Hi, its me once with my last question

When you click the video widget, you get a full screen video layout with a black background and audio on your phone. Is there any way to make a new widget with my own design and make it still work?

Solution

Hi Tobias,

If it is just to play audio, you don't need to use the video widget. Create your own block with the UI you wish and use the Audio JavaScript API to play the file.

Solution

Hi,

You can use the "Video" widget to play audio files. Pass it the URL to an audio file, and it will play it.