SOLVED: iPhone app, allowing music to continue playing from Apple Music or Spotify

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
gstarox
Posts: 14
Joined: Sun Apr 12, 2020 3:31 am

SOLVED: iPhone app, allowing music to continue playing from Apple Music or Spotify

Post by gstarox »

SOLVED (I hope it works when I publish App Store): https://livecode.fandom.com/wiki/Iphonesetaudiocategory
Use command

Code: Select all

on preOpenStack 
iphoneSetAudioCategory "ambient"
end preOpenStack 
I've made a workout timer app for iphone that has some sound cues eg mp3 files counting down "3,2,1" and saying "Rest" at appropriate times.
When people workout they probably want to listen to some music alongside the apps sound cues.
But as soon as any mp3 file is played on the app, my Apple Music or Spotify music stops immediately.
Is there any way around this?

I have definitely seen other iphone workout apps (eg BT lite) that allow for music to continue in the background with the app sound cues as well.

Thankyou,

Gee

Mac Catalina Version 10,15,3
iPhone X IOS 13,3,1
LiveCode 9,6,0 (dp3)
Xcode 10,1 & 11,3
Last edited by gstarox on Wed Apr 22, 2020 12:32 pm, edited 1 time in total.
gstarox
Posts: 14
Joined: Sun Apr 12, 2020 3:31 am

Re: iPhone app, allowing music to continue playing from Apple Music or Spotify

Post by gstarox »

Someone mentioned multi-threading is what I'm looking for?
Basically, the app sounds don't interrupt Apple Music/Spotify playing.
Or is there some way I can put Spotify/Apple music controls into the app itself?
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: iPhone app, allowing music to continue playing from Apple Music or Spotify

Post by bogs »

Well, far as I know, the verdict on multi-threading in Lc is still no way, although how you would perform that kind of problem without it is beyond my abilities.
Image
gstarox
Posts: 14
Joined: Sun Apr 12, 2020 3:31 am

Re: iPhone app, allowing music to continue playing from Apple Music or Spotify

Post by gstarox »

bogs wrote: Tue Apr 14, 2020 11:53 am Well, far as I know, the verdict on multi-threading in Lc is still no way, although how you would perform that kind of problem without it is beyond my abilities.
I don't know why this was so hard to find but eventually this worked
https://livecode.fandom.com/wiki/Iphonesetaudiocategory

Code: Select all

on preOpenStack 
iphoneSetAudioCategory "ambient"
end preOpenStack 
Post Reply