apache / apache/cordova-plugin-media

Stalled Playback on iOS in sleep mode after a few seconds of streaming large audio file

Open
#281 4 comments 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

If I stream a large (40mb, 1 hour AAC) file from a URL, then put the device into sleep mode, it stops playback after around 20 seconds, with 'Stalled Playback' message.

### What is expected to happen?

Should continue to play. Playing smaller files (e.g. 20MB. 30 minute AAC) works fine.

### What does actually happen?

See above.

## Information

I have `playAudioWhenScreenIsLocked` set to true, and also in plist file `UIBackgroundModes` set to `audio` and `fetch`, as well as `UIRequiresPersistentWiFi` set to true.

iOS is closing the network connection, but I thought with `UIRequiresPersistentWiFi` it shouldn't?

### Command or Code

`this.mediaObject.play({ playAudioWhenScreenIsLocked: true });`

### Environment, Platform, Device

Test device: iPhone 7, iOS 13.5.1

### Version information

```
Ionic:

Ionic CLI : 6.10.0 (C:\Users\dave\AppData\Roaming\npm\node_modules\@ionic\cli)
Ionic Framework : @ionic/angular 4.11.10
@angular-devkit/build-angular : 0.13.10
@angular-devkit/schematics : 7.3.9
@angular/cli : 7.3.9
@ionic/angular-toolkit : 1.5.1

Cordova:

Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.0.0, browser 6.0.0, ios 5.1.1

cordova-android-support-gradle-release 3.0.1 "cordova-android-support-gradle-release"
cordova-annotated-plugin-android 1.0.4 "cordova-annotated-plugin-android"
cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
cordova-plugin-androidx-adapter 1.1.1 "cordova-plugin-androidx-adapter"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-doze-optimize 0.1.3 "DozeOptimize"
cordova-plugin-facebook4 6.4.0 "Facebook Connect"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-firebasex 9.1.1 "Google Firebase Plugin"
cordova-plugin-googleplus 8.5.0 "Google SignIn"
cordova-plugin-inappbrowser 3.2.0 "InAppBrowser"
cordova-plugin-ionic 5.4.7 "cordova-plugin-ionic"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 5.0.0 "cordova-plugin-ionic-webview"
cordova-plugin-media 5.0.3 "Media"
cordova-plugin-music-controls2 3.0.4 "Music Controls"
cordova-plugin-network-information 2.0.2 "Network Information"
cordova-plugin-purchases 1.1.0 "Purchases"
cordova-plugin-screen-orientation 3.0.2 "Screen Orientation"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"

Utility:

cordova-res : 0.14.0
native-run : 1.0.0

System:

Android SDK Tools : 26.1.1 (C:\Users\dave\AppData\Local\Android\Sdk)
NodeJS : v10.16.0 (C:\Program Files\nodejs\node.exe)
npm : 6.9.0
OS : Windows 10
```

## 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

No source file or test is named. Start by reproducing the issue with mediaObject.play({ playAudioWhenScreenIsLocked: true }) using a large remote AAC file on the listed iOS environment, then investigate the plugin's iOS background playback path; done means playback continues after the device enters sleep mode.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.