iPhonePickMedia works but strange problem

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
grovecat
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 99
Joined: Thu Aug 04, 2011 10:32 am

iPhonePickMedia works but strange problem

Post by grovecat » Fri Jan 27, 2012 10:19 am

An iPad app I have been working on for some time uses iPhonePlaySound to play song files put in the Documents folder via iTunes file sharing and this has worked with no problem. Now that iPhonePickMedia is available, that would be a much better way of selecting songs, so I have been trying it out. The odd thing is that iPhonePlaySound works fine on a path delivered from Documents, but stubbornly will not play one via iPhonePickMedia.

So I created a simple stack with just three buttons with the following code:

GetSong
global tSongFile
on mouseUp
iPhonePickMedia "music"
put the result into tSongFile
end mouseUp

PlaySong
global tSongFile
on mouseUp
iPhonePlaySound tSongFile "1"
end mouseUp

SimplePlay
global tSongFile
on mouseUp
play tSongFile
end mouseUp

On the iPad, the song will play with the SimplePlay button, but nothing happens with the PlaySong button (which is the one I need).

There is probably a simple answer to this (as usually happens with me) and I'd be grateful for any help.

TIA
Don

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: iPhonePickMedia works but strange problem

Post by Dixie » Fri Jan 27, 2012 11:07 am

Don...

Your syntax is a little short.. it looks like that you are looking for 'iphonePlaySoundOnChannel'. Look at p.34 in the iOS release notes

be well

Dixie

grovecat
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 99
Joined: Thu Aug 04, 2011 10:32 am

Re: iPhonePickMedia works but strange problem

Post by grovecat » Fri Jan 27, 2012 11:37 am

Hi Dixie

Sorry, it was my typing error. Rather than copy and paste the code I typed it in here manually and go it wrong.

Here is a copy and paste from the actual code :

global tSongFile
on mouseUp
iphonePlaySoundOnChannel tSongFile, "1", now
end mouseUp

And it does not work on the iPad. The button changes state but nothing happens. I know that the path in tSongFile is OK because the simple Play command does work.

Post Reply