I'm using this Code to stream an MP3 audio file in background mode in Phonegap. But the Problem is: With this Code there is no way to get the current position and all the other phonegap functions with this Code. I tried the native quicktime/childbrowser method to play the file. This works great and shows timeline etc. BUT there is no way to hide the quicktime player and browse in the app and there is also no way to save the position and set the position in the audio files. Any Ideas to solve the issue?
Asked
Active
Viewed 4,790 times
4
-
I think you have to write a plugin for that – ilija139 Oct 31 '11 at 20:28
-
no way to solve that in javascript? Is it possible to get the position or go to a position with this audio object? – Bonsai Oct 31 '11 at 20:32
-
1Sorry I didn't understand the question, I thought you wanted to play local file, stored on the iPhone. To get the position and other info. use this properties of the `myaudio` object: `startTime`, `duration`, `currentTime`, `playbackRate`, `volume`, `seeking`. Note that streamed music like in the sample code is by default not seekable, so check the `seekable` property. – ilija139 Oct 31 '11 at 20:56
-
Thanks! That allready helped me a lot! But i think for such a small app is would be too much effort to build an own player. How hard would it be to show and hide the quicktime window/panel with a button in cocoa? – Bonsai Oct 31 '11 at 21:10
-
@Bonsai is a file within the app or a external stream? for stream, there is a plugin for that https://github.com/devgeeks/phonegap-plugins/tree/AudioStreamer/iPhone/AudioStream – RaphaelDDL Nov 07 '11 at 17:31
1 Answers
1
One other option (if you are not scared of code in development) is a plugin for streaming audio (including fixed length files like mp3's) for PhoneGap on iOS.
https://github.com/devgeeks/phonegap-plugins/tree/AudioStreamer/iPhone/AudioStream
It's currently in development and may have bugs, but it is fairly feature rich.
I also have an example iPhone project that uses it:
https://github.com/devgeeks/ExampleAudioStreamer
If you give it a try and find any bugs let me know. I am pretty quick to squash them as I am trying to get it ready to fold in to the main PhoneGap plugins repo.

Devgeeks
- 5,659
- 4
- 28
- 35
-
2If anyone stumbles on this, I have not done anything with that plugin in aaagggeees... in the end I ended up using html5 audio for my iOS app. I made an example project showing how I did that as well: https://github.com/devgeeks/ExampleHTML5AudioStreaming – Devgeeks Apr 27 '12 at 14:14
-
1
-
Yes it does. It also correctly handles the remote controls (on the lock screen, etc). – Devgeeks Jun 03 '12 at 23:46
-
Devgeeks, I'm about to check this out.. i wonder does it handle resuming playback (seeking) for streams (server range requests) – ladieu Jul 16 '13 at 17:41