stayAwake property

bool stayAwake
final

By default, when the screen is locked, all the app's processing stops, including audio playback. You can set this flag to keep your audio playing even when locked.

On Android, this sets the player "wake mode" to PARTIAL_WAKE_LOCK.

On iOS, this will happen automatically as long as:

  • the category is .playAndRecord (thus setting this is forbidden when respectSilence is set)
  • the UIBackgroundModes audio key has been added to your app’s Info.plist (check our FAQ for more details on that)

Implementation

final bool stayAwake;