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

Thibaut Brebant edited comment on CB-7684 at 6/10/16 9:22 AM:
--------------------------------------------------------------

We arrived to the same conclusion as [~Stryker908] and GitHub's user 
ionut-movila in his PR: https://github.com/apache/cordova-plugin-media/pull/33.

The problem for us is not only that when a media is finished it's stopping all 
the others, but also that *.release()* is killing all sounds running, even if 
they were played by another plugin (or by WebView's default webaudio system), 
triggering a descriptive:
{code}
AVAudioSession.mm:646: -[AVAudioSession setActive:withOptions:error:]: 
Deactivating an audio session that has running I/O. All I/O should be stopped 
or paused prior to deactivating the audio session.
{code}

We found that *AVAudioSession* is a singleton for the whole app (cf. 
https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioSession_ClassReference/).

Apple says:
{quote}
Most apps never need to deactivate their audio session explicitly. Important 
exceptions include VoIP (Voice over Internet Protocol) apps, turn-by-turn 
navigation apps, and, in some cases, recording apps.
{quote}

(cf. 
https://developer.apple.com/library/ios/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/ConfiguringanAudioSession/ConfiguringanAudioSession.html)

In our project we don't use the recording capacities. We removed all:
{code}
avSession setActive:NO
{code}
and it's is working pretty well (as in PR https://github.com/ionut-movila).

Additionally it may be worth to update the comment:
*// returns whether or not audioSession is available - creates it if necessary*
to something like:
*// returns whether or not audioSession is available - retrieve the instance 
(app singleton) if necessary*.


was (Author: tbrebant):
We arrived to the same conclusion as [~Stryker908] and GitHub's user 
ionut-movila in his PR: https://github.com/apache/cordova-plugin-media/pull/33.

The problem for us is not only that when a media is finished it's stopping all 
the others, but also that *.release()* is killing all sounds running, even if 
they were played by another plugin (or by WebView's default webaudio system), 
triggering a descriptive:
{code}
AVAudioSession.mm:646: -[AVAudioSession setActive:withOptions:error:]: 
Deactivating an audio session that has running I/O. All I/O should be stopped 
or paused prior to deactivating the audio session.
{code}

We found that *AVAudioSession* is a singleton for the whole app (cf. 
https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioSession_ClassReference/).

Apple says:
{quote}
Most apps never need to deactivate their audio session explicitly. Important 
exceptions include VoIP (Voice over Internet Protocol) apps, turn-by-turn 
navigation apps, and, in some cases, recording apps.
{quote}

(cf. 
https://developer.apple.com/library/ios/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/ConfiguringanAudioSession/ConfiguringanAudioSession.html)

In our project we don't use the recording capacities. We removing all:
{code}
avSession setActive:NO
{code}
and it's is working pretty well (as in PR https://github.com/ionut-movila).

Additionally it may be worth to update the comment:
*// returns whether or not audioSession is available - creates it if necessary*
to something like:
*// returns whether or not audioSession is available - retrieve the instance 
(app singleton) if necessary*.

> [Media] CDVSound Kills any and all playing sound files when a single file 
> finishes
> ----------------------------------------------------------------------------------
>
>                 Key: CB-7684
>                 URL: https://issues.apache.org/jira/browse/CB-7684
>             Project: Apache Cordova
>          Issue Type: Sub-task
>          Components: Plugin Media
>    Affects Versions: 3.5.0
>         Environment: iOS
>            Reporter: Nathan Stryker
>
> The CDVSound file will kill all playing media files when ever a single file 
> completes playing. The issue is around like 691 in the method 
> "AudioDidFinishPlaying", with the code:
>     if (self.avSession) {
>         [self.avSession setActive:NO error:nil];
> }
> The reason I think this is a bug is that if a user as Music file A playing in 
> a loop and Music file B plays, when B completes the "setActive:NO" will kill 
> the avSession of both A and B. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to