cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jcesarmobile (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-12422) Media does not play when the App is in the background on iOS
Date Tue, 07 Feb 2017 19:37:41 GMT

    [ https://issues.apache.org/jira/browse/CB-12422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15856630#comment-15856630
] 

jcesarmobile commented on CB-12422:
-----------------------------------

Yes, I've tried and it works.
On the SO question you link you said that you didn't add background mode because your app
might be rejected.

I'm reopening the issue just to document that background audio mode is needed to play sound
with the screen locked.
The plugin can't write on the .plist because there is no way of doing it conditionally, so
it will always write on the plist and enable background audio for all users, which, as you
said, can make Apple to reject your app if you don't really need background audio

When playAudioWhenScreenIsLocked is set to true, the native AVAudioSessionCategoryPlayback
will be used instead of AVAudioSessionCategorySoloAmbient (default)

AVAudioSessionCategoryPlayback doc:
{quote}
AVAudioSessionCategoryPlayback	
The category for playing recorded music or other sounds that are central to the successful
use of your app.
When using this category, your app audio continues with the Silent switch set to silent or
when the screen locks. (The switch is called the Ring/Silent switch on iPhone.) To continue
playing audio when your app transitions to the background (for example, when the screen locks),
add the audio value to the UIBackgroundModes key in your information property list file.
{quote}

> Media does not play when the App is in the background on iOS
> ------------------------------------------------------------
>
>                 Key: CB-12422
>                 URL: https://issues.apache.org/jira/browse/CB-12422
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Media
>    Affects Versions: 3.5.0
>         Environment: iOS 8+
>            Reporter: Remi Boardman
>            Assignee: jcesarmobile
>              Labels: background, background-audio, ios, media
>
> While trying to trigger a sound to play in the App (running in the background or screen
locked) via a button press on an external bluetooth device, I receive the error:
> _"message":"","code":4_
> I've also tried creating a new blank app and wrapping the play method in a timeout so
that it triggers a short while after I lock the screen or minimise the App. I do not hear
a sound until I reopen the App and I don't get any errors in console this way.
> I have set the _playAudioWhenScreenIsLocked_ option to true, despite this being true
by default.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message