├── .gitignore ├── LICENSE ├── README.md ├── package.json ├── plugin.xml └── src └── ios └── BackgroundAudio.m /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Aubrey Hewes 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Looking for contributors 2 | 3 | Hey there, I'm looking for active contributors to help move the development of this forward in a stable and timely fashion. This module was created for a specific project and I haven't had a need for this module in quite some time, so my personal time is not actively allocated to it. If you are interested in actively contributing, please contact me, Thanks! 4 | 5 | # Background Audio for iOS 6 | 7 | Support an iOS application playing audio in the background. 8 | 9 | When included within a cordova build then the application will support background audio for iOS 10 | out of the box. No further action is necessary. 11 | 12 | This negates having to use location/other solutions that may not be accepted by Apple. 13 | 14 | # Installation 15 | 16 | ## Cordova 17 | 18 | cordova plugin add cordova-plugin-background-audio 19 | # OR 20 | cordova plugin add https://github.com/danielsogl/cordova-plugin-background-audio.git # latest 21 | 22 | ## Ionic 23 | 24 | ionic plugin add cordova-plugin-background-audio 25 | # OR 26 | ionic plugin add https://github.com/danielsogl/cordova-plugin-background-audio.git # latest 27 | 28 | ## PhoneGap 29 | 30 | phonegap local plugin add cordova-plugin-background-audio 31 | # or 32 | phonegap local plugin add https://github.com/danielsogl/cordova-plugin-background-audio.git # latest 33 | 34 | ### PhoneGap Build (build.phonegap.com) 35 | 36 | **DEPRECATED**.. no longer seems to work? Possibly requires updating the plugin to latest pgb spec? 37 | see [#9](/../../issues/9) 38 | 39 | Add the following to your `config.xml` 40 | 41 | 42 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-plugin-background-audio", 3 | "version": "1.1.0", 4 | "description": "\n\t\tBackground Audio for iOS\n\n\t\tWhen included within a cordova/phonegap build then the application will support background audio for iOS\n\t\tout of the box. No further action is necessary.\n\n\t\tThis negates having to use location/other solutions that may not be accepted by Apple.\n\t", 5 | "cordova": { 6 | "id": "com.danielsogl.cordova.backgroundaudio", 7 | "platforms": [ 8 | "ios" 9 | ] 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/danielsogl/cordova-plugin-background-audio.git" 14 | }, 15 | "keywords": [ 16 | "background-audio", 17 | "background", 18 | "audio", 19 | "media", 20 | "ios", 21 | "ecosystem:cordova", 22 | "cordova-ios" 23 | ], 24 | "engines": [ 25 | { 26 | "name": "cordova", 27 | "version": ">=4.0.0" 28 | } 29 | ], 30 | "author": "Daniel Sogl", 31 | "license": "MIT", 32 | "bugs": { 33 | "url": "https://github.com/danielsogl/cordova-plugin-background-audio/issues" 34 | }, 35 | "homepage": "https://github.com/danielsogl/cordova-plugin-background-audio#readme" 36 | } 37 | -------------------------------------------------------------------------------- /plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | background-audio 8 | 9 | 10 | Background Audio for iOS 11 | 12 | When included within a cordova/phonegap build then the application will support background audio for iOS 13 | out of the box. No further action is necessary. 14 | 15 | This negates having to use location/other solutions that may not be accepted by Apple. 16 | 17 | 18 | background-audio,background,audio,media,ios 19 | 20 | MIT 21 | 22 | Daniel Sogl 23 | 24 | https://github.com/danielsogl/cordova-plugin-background-audio.git 25 | https://github.com/danielsogl/cordova-plugin-background-audio/issues 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | audio 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/ios/BackgroundAudio.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface BackgroundAudio : CDVPlugin 5 | {} 6 | @end 7 | 8 | @implementation BackgroundAudio 9 | 10 | - (void)pluginInitialize { 11 | // initializations go here. 12 | AVAudioSession *audioSession = [AVAudioSession sharedInstance]; 13 | BOOL ok; 14 | NSError *setCategoryError = nil; 15 | ok = [audioSession setCategory:AVAudioSessionCategoryPlayback 16 | error:&setCategoryError]; 17 | if (!ok) { 18 | NSLog(@"%s setCategoryError=%@", __PRETTY_FUNCTION__, setCategoryError); 19 | } 20 | } 21 | 22 | @end 23 | --------------------------------------------------------------------------------