User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13

Thread: Background applications specifically audio

  1. #1
    No Products Registered

    Join Date
    Dec 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Background applications specifically audio

    Hi all, new to the forum and hoping someone can help me with this.

    I have created an extension that takes advantage of a class called AudioStreamer (https://github.com/mattgallagher/AudioStreamer/).

    I have it all working. We can play the streams no problem.

    I have modified the plist settings so that:
    Application does not run in background = No
    Required background modes:
    - Item 0 = App plays audio

    Now when you press the home button, no audio is heard.

    Bringing up the task manager shows the application is running.

    Re-opening the app, the stream has not stopped playing and has been playing in the background but the sound couldn't be heard.

    Has anyone got any suggestions?

  2. #2
    Clickteam Clickteam
    Anders's Avatar
    Join Date
    Jun 2006
    Location
    Denmark, Århus
    Posts
    3,456
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)
    Hi Jamie!
    I'm think Francois knows more about the iOS audio than I do, but I think you need to have a look at audio session and interuption handling:
    http://developer.apple.com/library/i...roduction.html

    Otherwise you need to listen in on iOS system events (like when the app is paused or resumed in the background). There is now a way to subscribe to them by using these methods in CRunApp:
    -(void)registerForiOSEvents: (id<UIApplicationDelegate>)object;
    -(void)unregisterForiOSEvents: (id<UIApplicationDelegate>)object;

    Your object will then be forwarded any iOS system events in the UIApplicationDelegate protocol which you can decide to listen to or not (by implementing the methods)
    http://developer.apple.com/library/i...Reference.html

    You can then pause the audio when the app is brought to the background and resume it again when it is resumed depending on what you want.

  3. #3
    No Products Registered

    Join Date
    Dec 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To be honest, I want it to continue playing in the background. I will read the docs tomorrow and post if I have any questions.

    Problem is AudioStreamer doesn't use the standard audio from iOS, I had problems implementing those. So the normal delegate for AVPlayer/AVSession classes won't help.

    I'll come back with more info tomorrow. Thanks

  4. #4
    No Products Registered

    Join Date
    Dec 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Francois or Andos, would you be able to help with this?

    I have gone through all the documentation on the AudioSession and can verify that it is being set to the correct mode (One that plays when the screen locks and doesn't allow other audio, kAudioSessionCategory_MediaPlayback to be specific).

    The AudioSession is set to active using AudioSessionSetActive(true).

    It has also been set up to handle interuptions (i.e calls or alarms) using AudioSessionInitialize.

    As far as I can see there is nothing more I can do to the AudioSession to ensure it runs in the background. This suggests that the app is being put in idle or something?

    Do I need to implement both of your suggestions? I don't really see how registering for events will help... surely once AudioSession is set up correctly that will handle that side of things?

  5. #5
    Clickteam Clickteam
    Danny's Avatar
    Join Date
    Aug 2007
    Location
    United Kingdom
    Posts
    3,016
    Mentioned
    21 Post(s)
    Tagged
    2 Thread(s)
    Andos, Francois - The audio stream needs to continue playing when the phone is locked or the app is sent to background, Jamie has implemented the KeepAlive functions, however I assume the MMF Runtime Pauses? I found this in the help file:

    Application has been deactivated

    This event is true at the moment when the application is going to the background (when the user presses the HOME button, or receives a phone call).
    Please note that as the application is going into pause, only the code in the deactivated event will be executed before the app is reduced, any other code will be executed when the application is revived.
    Application has been reactivated

    This condition is called when the application is reactivated (for example if it was reduced and started again).


    Going off this, I would assume that with the Runtime pausing it would cause the app to lose the stream as it can no longer buffer whilst in the background...
    Want to learn Clickteam Fusion 2.5?




  6. #6
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Francois's Avatar
    Join Date
    Jul 2006
    Location
    Montpellier, France
    Posts
    6,920
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    OK checked my code, I call AudioSessionSetproperty with parameter kAudioSessionCategory_SoloAmbientSound
    From Apple's doc, the sound should be silenced by a ring, and screen locking. Does not allow sounds from other applications.
    I am sure that if you change the AudioSessionProperty later than me, it will change the mode.

  7. #7
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    UrbanMonk's Avatar
    Join Date
    May 2008
    Location
    Southern U.S.A.
    Posts
    847
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I've tried to do this myself. I've changed the audio mode, but I ran into the same issue.
    I hope someone figures this out because I want to add the ability to keep audio from my app playing even after it is minimized.

    I would also like to the ability to keep the ipod music playing when a MMF made app is started/running. That's basic functionality of all apps these days, so it's a shame that MMF doesn't support it yet.

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleMac Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    AyreGuitar's Avatar
    Join Date
    Jan 2011
    Location
    Wales, UK
    Posts
    1,113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    UrbanMonk - I believe you can allow iPod music to play when MMF made app is running by making a small change in your XCode project. More details here: http://community.clickteam.com/showthread.php?t=69226

  9. #9
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    OldSchool80s's Avatar
    Join Date
    Dec 2012
    Location
    USA
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I may be misunderstanding this thread, but I think this comment is relevant:

    The Pandora app allows for playing audio when phone is locked and screen is off.

    So, iOS allows audio to be played when the screen is off and the phone is locked.

  10. #10
    Clickteam Clickteam
    Danny's Avatar
    Join Date
    Aug 2007
    Location
    United Kingdom
    Posts
    3,016
    Mentioned
    21 Post(s)
    Tagged
    2 Thread(s)
    Yes, that's the gist OldSchool80's. Jamie has the source for another app which allows for the music to continue playing whilst in the background too, so atm this is our only priority to get this working.
    Want to learn Clickteam Fusion 2.5?




Page 1 of 2 1 2 LastLast

Similar Threads

  1. How to allow you applications to let background music play
    By Keith in forum iOS Specific Example Files
    Replies: 9
    Last Post: 2nd June 2013, 08:47 PM
  2. Keeping applications open in the background
    By Game_Master in forum iOS Export Module Version 2.0
    Replies: 2
    Last Post: 12th June 2012, 12:25 PM
  3. Background Applications
    By Ethan in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 24th May 2010, 10:39 PM
  4. Sub applications in background
    By Nick in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 20th May 2007, 10:42 AM
  5. MMF2 Applications as computer wallpaper/background
    By Brandon in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 21st January 2007, 01:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •