updated to read cordova instead of phonegap, and also stop and start stream on pause/resume