All Projects → vadimf → phonegap-audio-payer

vadimf / phonegap-audio-payer

Licence: Apache-2.0 license
iOS Native Audio player for PhoneGap 3 plugin

Programming Languages

objective c
16641 projects - #2 most used programming language
shell
77523 projects
CSS
56736 projects
javascript
184084 projects - #8 most used programming language

iOS Native audio player for PhoneGap 3.0

Why?

Working on a phonegap radio application we noticed that when the application is running in background mode the songs are not alsways skipped with HTML5 radio player. Which is quite understandable - this is what you find in apple documentation:

As long as it is playing audio or video content or recording audio content, the app continues to run in the background. However, if recording or playback stops, the system suspends the app.

CDVSound audio plugin introduced serious lags, so we decided to develop a simple plugin that solves three issues:

  • Playlists can be played in background
  • Song title, artist, etc is shown on iPhone lock screen
  • There are no lags (or they are minimal)

Feel free to fork and improve.

Installation

Add the following frameworks to your project:

  • AVFoundation.framework
  • CoreAudio.framework
  • MediaPlayer.framework
  • AudioToolbox.framework

Add the following lines to your info.plist file:

<key>UIBackgroundModes</key>
<array>
	<string>audio</string>
</array>

Add AudioPlayerPlugin.js to /www/js folder.

Add the following lines to your confix.xml file: <feature name="AudioPlayerPlugin"> <param name="ios-package" value="AudioPlayerPlugin" /> </feature>

Add the following files into your XCode project:

  • AudioPlayerPlugin.m
  • AudioPlayerPlugin.h
  • GBAudioPlayer.m
  • GBAudioPlayer.h

Usage

Check index.html file for the code example.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].