cordova-plugin-media
cordova-plugin-media copied to clipboard
Stalled Playback on iOS in sleep mode after a few seconds of streaming large audio file
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 ([email protected])
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
any solution here ? I am facing same issue..
did you enable background mode -> audio on xcode capabilities?
Hi @21pg
It's works for me:
On xCode check Signing & Capabilities -> Background Modes
you have to enable the option Audio, AirPlay, and Picture in Picture
Anybody find a solution to this? Updating Capabilities in XCode doesn't help.