Playing .wav File

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Googie85
Posts: 226
Joined: Tue Aug 05, 2014 10:07 am

Playing .wav File

Post by Googie85 » Fri Dec 04, 2015 2:18 am

I am having trouble playing a sound on my Android tablet. I have tried the following:

MobileControlCreate "player", "testplayer"
MobileControlSet "testplayer", "filename", "wavfile"
MobileControlGo "testplayer", "play"

I have imported as control to wavfile.

I have also tried:

Play wavfile - this works on my PC...

Any help will be appreciated!

Many Thanks,

Matt.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Playing .wav File

Post by Simon » Fri Dec 04, 2015 2:35 am

Hi Matt,
I've used .mp3 files for sound, .wav actually has many types of CODECs so I don't like them.
Don't forget you have to use the Copy Files tab to include you sound files and they will be located e.g

Code: Select all

put specialFolderPath("engine") & slash & "goal.mp3" into gSoundGoal
Once on the device.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Playing .wav File

Post by jacque » Fri Dec 04, 2015 9:46 am

The actual command is mobileControlDo. I don't know if that was a typo or not.

I also found recently that, at least on Android, player names don't work. I had to switch to using IDs. Names work okay with native fields but for some reason they fail with players. I've been meaning to report that.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Playing .wav File

Post by Klaus » Fri Dec 04, 2015 1:54 pm

Hi Matt,
Googie85 wrote:I...I have imported as control to wavfile...
imported sounds do not work on mobile!

Add your WAV file(s) to your standalone via the standalone builder "Copy files" and access
them as Simon shows in his example script but in -> specialfolderpath("resources")


Best

Klaus

maulinarmananda
Posts: 14
Joined: Thu Mar 24, 2016 12:13 pm

Re: Playing .wav File

Post by maulinarmananda » Thu Mar 24, 2016 12:25 pm

I also have an issue with this. Im trying to built my android app. and it contains videos. I can play it in my pc but when I built it in apk, my video doesn't come.
I have tried using code in website but still nothing works. Can someone help me? I really depressed because this is for my final assignment :(

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Playing .wav File

Post by Klaus » Thu Mar 24, 2016 2:40 pm

Hi maulinarmananda,

1. welcome to the forum! :D

2.
maulinarmananda wrote:I also have an issue with this. Im trying to built my android app. and it contains videos. I can play it in my pc but when I built it in apk, my video doesn't come.
I have tried using code in website but still nothing works.
sounds like a pathname problem! What pathname are you using?
Reminder: Imported sound and video files do NOT work on mobile.

And please post your script(s), I am sure we can work that out!


Best

Klaus

maulinarmananda
Posts: 14
Joined: Thu Mar 24, 2016 12:13 pm

Re: Playing .wav File

Post by maulinarmananda » Thu Mar 24, 2016 4:06 pm

this is my code

on openCard
if the environment = "mobile" then
put specialFolderPath("engine") & "/qtimun.mp4" into tVidFile
mobileControlCreate "player", "myPlayer"
put the result into sPlayerID -- save the control id

mobileControlSet sPlayerID, "filename", tVidFile
mobileControlSet sPlayerID, "visible", true
mobileControlSet sPlayerID, "rect", "30,32,414,330"
mobileControlSet sPlayerID, "showController", false
mobileControlSet sPlayerID, "preserveAspect", false

--mobileControlDo "myPlayer", "play"
--mobileControlDo "myPlayer", "pause"
end if
end openCard
mobileControlSet sPlayerID, "visible", false
on closeCard

end closeCard


sorry Klaus for asking you in other question. I will just gonna use this one. Hope I can fix my problem

Post Reply