apache / apache/cordova-plugin-media

iOS: unable to play external .mp3 files AVAudioSession setActive:withOptions:error

Open
#269 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
391
Forks
762
PR merge metrics
No merged PRs in 30d

Description

# Bug Report

## Problem

### What is expected to happen?

Should play an external .mp3 file in iOS.

### What does actually happen?

An error message:

[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.

## Information

Hi, I'm trying to use Media plugin in my ionic application, but its given an error when I call play method after creating an media object.

### Command or Code

```
context.fileAudio = context.media.create(audio);
context.fileAudio.play();
context.fileAudio.onStatusUpdate.subscribe((status) => {
//some code
});

```

### Environment, Platform, Device

"@ionic-native/media": "^4.20.0",
"cordova-plugin-media": "^5.0.3",

Tested with iOS 12.0, 13.1 (iPhone 7 and iPhone 11)

### Version information

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 3.2.4
Cordova Platforms : android 6.4.0 ios 5.1.1
Ionic Framework : ionic-angular 3.9.9

System:

ios-deploy : 1.9.4
ios-sim : 8.0.2
npm : 6.4.1
OS : macOS
Xcode : Xcode 11.3 Build version 11C29

## Checklist

- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the external .mp3 case with the shown media.create() and play() calls on iOS, then inspect the iOS media implementation around AVAudioSession setActive:withOptions:error:. Done means external .mp3 playback works without the reported running-I/O deactivation error on the listed iOS versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, javascript, objective-c
Domain
audio-video-rtc, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.