Javascript media player not working on Android (working on browsers and iOS)

  • Replies:1
Barney Beebs
  • Forum posts: 4

Oct 10, 2012, 12:44:26 PM via Website

I am creating an app which plays audio using a JS audio player. The idea is to use Phonegap and deploy it on multiple platforms. It’s working fine on iOS, Firefox (when .ogg is used) and Chrome. When I try to run it using the Android emulator it doesn’t run. It does when I use a website URL and not a locally saved ogg file. Therefore I think it is something simple, a little over my head though!

Not sure how to load files on the site, but I’m sure you can get the idea. The ogg file is located in the assets folder of the Android project on my computer.

Here is the log from eclipse:
110-09 12:38:26.140: E/MediaPlayer(876): Error (-38,0) 10-09 12:38:26.370: D/CordovaLog(876): Uncaught TypeError: Cannot call method 'confirm' of undefined 10-09 12:38:26.370: D/CordovaLog(876): file:///android_asset/www/scripts/html5audio.js: Line 75 : Uncaught TypeError: Cannot call method 'confirm' of undefined 10-09 12:38:26.370: E/Web Console(876): Uncaught TypeError: Cannot call method 'confirm' of undefined at file:///android_asset/www/scripts/html5audio.js:75 10-09 12:38:26.440: E/MediaPlayer(876): error (1, -2147483648) 10-09 12:38:26.500: E/MediaPlayer(876): Error (1,-2147483648)

And here is the bit of JS which seems to be causing the problem, line 75 is highlighted:
1// navigator.notification.alert('Streaming failed. Possibly due to a network error.', null, 'Stream error', 'OK');
2***LINE 75***navigator.notification.confirm(
3 'Streaming failed. Possibly due to a network error.', // message
4 onConfirmRetry, // callback to invoke with index of button pressed
5 'Stream error', // title
6 'Retry,OK' // buttonLabels

Reply
Barney Beebs
  • Forum posts: 4

Oct 10, 2012, 12:45:45 PM via Website

Here is the JS and HTML http : // jsfiddle . net / barney278 / DVqj4/

Reply