teaching machines

Mobile Web: Adam King

November 29, 2012 by . Filed under cs491 mobile, fall 2012, postmortems.

My mobile web project ending up mostly being rather disappointing compared to what I originally planned due to constant struggling with JavaScript/HTML/Cordova and time constraints.  However, it was probably one of the largest learning experiences of all of the projects.  The app is a simple media player and recorder.  I created a CordovaPlugin to get the track and artist of .mp3 or .amr files from the SD card.  A split list allows a user to load into the media player or pop up a dialog to delete the file from the SD card.  A third page  allows a user to enter a file name and record for a max of two minutes, which is then saved to the SD card.  Most buttons are in a control group and use custom icons since, surprisingly, icons for playing/pausing/recording/stopping do not seem to be provided.

I learned a significant amount about JavaScript/JQuery Mobile, especially concerning being able to get/modify/set attributes, text values, etc. of lots of different elements.  This was helpful in passing needed values instead of needing to create arrays or variables to pass values.

I also learned about some of the nuances of the Android OS, issues with the emulator, and reported bugs/issues with Cordova.

– Android seems to scan for files rather rarely, so when files are added or deleted in the app it could take minutes to days before the updates are reflected in the content resolver.  To remedy this, I added code in the plugin to insert or delete into/from the content resolver.  Alternatively, I think the media scanner could be called but the coding seemed messier to use, especially within a plugin.

– The emulator broke down once for about an hour before I made a new one, saying it was unable to create a media player.

– A progress bar tracks the duration of the playing track.  I wanted to allow for seeking, but after reading some posts from users and Cordova devs and doing some debugging I found Cordova’s call to get the track duration doesn’t return the value immediately, making the value -1.  After pausing/stopping the track and playing again, the duration generally loads.

With more time to add features and to look into JavaScript and JQuery Mobile as well as better ways to store variables/information, I would like to add things like album artwork, album names, etc.  These things would be easier to test on a real device as well, versus using an emulator with Windows sample music.