Search Unity

Audio Keep playing music when iOS/Android device is locked

Discussion in 'Audio & Video' started by Simon75012, Nov 1, 2017.

  1. Simon75012

    Simon75012

    Joined:
    Sep 15, 2016
    Posts:
    79
    Hi,
    I'm having problem to keep playing some audio in background for ios/android.

    I tried to turn on : Background modes -> Audio, Airplay and Picture in Picture.

    So on my info.plist, there is :
    <key>UIBackgroundModes</key>
    <array>
    <string>audio</string>
    </array>

    Should i use something else than Audio Source to keep playing music in background?

    Apple ressources :
    "When the UIBackgroundModes key contains the audio value, the system’s media frameworks automatically prevent the corresponding app from being suspended when it moves to the background. As long as it is playing audio or video content or recording audio content, the app continues to run in the background. However, if recording or playback stops, the system suspends the app."

    I think maybe Unity Pause the AudioSource when enter in background so the system suspend the app.

    Thanks.
     

    Attached Files:

    Last edited: Nov 1, 2017
  2. mrvv

    mrvv

    Joined:
    May 2, 2016
    Posts:
    5
    did you check project settings->player->run in background ?