It was a great opportunity to experiment with a project I've been eyeing for a while:
Not all of these technologies are fully-baked, or at least they haven't been around long enough to play together completely seamlessly, and I think it shows in the final app (it has some glitches). I'm sure with more time I could have made it tighter, but it seems to work pretty well.
I found PhoneGap pretty easy to work with, except I hadn't used Xcode before, so I spent a while learning Xcode conventions before I could get totally up and running. The latest release of PhoneGap seems to be easier to setup.
My only complaint: the app is noticeably slower when built natively with PhoneGap when compared to running my code inside of mobile safari, in a regular browser window. I'm not sure what that's about - you'd think the opposite would be true. I'm sure this will get better over time.
PhoneGap just gives you a browser window; unless you want to build up your own UI elements you need some kind of framework. I originally used JQTouch (JQT) after watching this excellent PeepCode screencast, but the latest version of JQT was not working with the latest version of Mobile Safari in iOS 4, so I switched to a recently-announced project still in alpha testing, jQuery Mobile.
HTML5 Media Elements make it much easier to deliver audio to the browser. The Stoop app uses the audio tag, and I found the JavaScript API, including events, very useful.
HTTP Streaming: The first version of the app was rejected by Apple because some audio files were longer than ten minutes. iPhone app store guidelines say you have to use Apple's HTTP streaming protocol in this case. It turned out to be really straightforward to use the provided Apple-provided mediafilesegmenter to split our MP3s into 10-second chunks. A few files were over 64kbps so I downsampled them with ffmpeg and LAME (the guidelines also require you to offer at least one stream at that bitrate).
CloudFront: I'm trying as much as possible to get out of the business of running servers when there are cloud services that can do it better. There's no good reason for an app like this to need its own custom server dishing out static audio files, so I uploaded all the segmented files to Amazon S3, then setup a CloudFront CDN distribution. Whenever you listen to a Stoop story, it's coming from an Amazon CDN node. This was very easy to setup. I'm experimenting with s3stat as a way to get listening statistics.
8 comments:
Did you happen to check out Rhodes?
http://rhomobile.com/products/rhodes/
I haven't checked it out yet either, but it aims to do the same thing as PhoneGap except with ruby.
no, but I'd be interested in trying it for a future app. I'd also recommend people look at Appcelerator, Titanium, and a few others.
What kind of audio player do you use in your app?
Im working on a project now with phonegap and jquery
But i don't find a good player yet.
Can you help me?
Thnx. Michael
Hey,
I know your article is a year old, but it really helped me to understand a bit more about phonegap. What I really would like to know is if you can still recommend using it for creating my first app. I am very confirm with HTML, PHP, CSS, JavaScript, jQuery and don't wanna change to xCode or those SDKs.
Could you solve the speed issue?
Thank you in advance.
Hi irfancue, I did not end up maintaining this app due to low usage, but since I wrote this Phonegap and jQuery Mobile have gone through many revisions including speedups. I would totally build my next mobile app this way.
Hi, thanks for your post. Did you finally found a nice player for your apps?
Post a Comment