Problem with mp3 playback on htc sensation

110 views
Skip to first unread message

Paykz0r

unread,
Jun 23, 2011, 6:52:48 PM6/23/11
to phonegap
Hi there.

I am developing a game using phonegap for android/ios.

So far everything was straight.
I was testing using galaxy tab and htc wildfire for a few weeks.
Now i was getting a htc sensation, and my game doesn't play any
background music on it,
but the usual sfx.

the sfx are wave file format,
and the music is mp3.

i trid to switch over to adpcm for music, but that didn't helped...

So is it aa known bug?
Do i miss something?
Anything i could try?

Greetings and thanks for reading

Simon MacDonald

unread,
Jun 23, 2011, 9:27:58 PM6/23/11
to phon...@googlegroups.com
Run "adb logcat" to see what is going wrong.

Simon

> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com
>

--
Simon Mac Donald
http://hi.im/simonmacdonald

Paykz0r

unread,
Jun 25, 2011, 1:14:54 PM6/25/11
to phonegap
Well, i have run "aLogcat" on the sensation and saved the debug to sd,
if that works too.

I have manualy filtered some system logs etc.

this is what came out:

W/System.err(22336): at
com.phonegap.CallbackServer.run(CallbackServer.java:178)
W/System.err(22336): at java.lang.Thread.run(Thread.java:1027)
W/System.err(22336): java.net.SocketException: Permission denied

W/System.err(22336): at
com.phonegap.CallbackServer.run(CallbackServer.java:178)
W/System.err(22336): at java.lang.Thread.run(Thread.java:1027)
D/dalvikvm(22336): GC_CONCURRENT freed 385K, 51% free 3077K/6215K,
external 0K/0K, paused 2ms+5ms
W/System.err(22336): java.net.SocketException: Permission denied

W/System.err(22336): at
com.phonegap.CallbackServer.run(CallbackServer.java:178)
W/System.err(22336): at java.lang.Thread.run(Thread.java:1027)
D/webview (22336): [WebView::UPDATE_SELECTION] ====== start
W/System.err(22336): java.net.SocketException: Permission denied


W/System.err(22336): at
com.phonegap.CallbackServer.run(CallbackServer.java:178)
W/System.err(22336): at java.lang.Thread.run(Thread.java:1027)
D/AudioHardwareMSM8660( 130): enableDevice(2 0)
I/AudioHardwareMSM8660( 130): AudioHardware pcm playback is going to
standby.
W/System.err(22336): java.net.SocketException: Permission denied

W/System.err(22336): at
com.phonegap.CallbackServer.run(CallbackServer.java:178)
W/System.err(22336): at java.lang.Thread.run(Thread.java:1027)
D/MediaPlayer(22336): reset() in
D/MediaPlayer(22336): reset() out
D/webview (22336): [WebView::UPDATE_SELECTION] ====== start
D/MediaPlayer(22336): start() in
D/AudioSystem( 130): linearToSpecifyHtcVolume(volume:100, streamType:
3, audio_devices:2)
D/MediaPlayer(22336): start() out
W/System.err(22336): java.net.SocketException: Permission denied

W/System.err(22336): at
com.phonegap.CallbackServer.run(CallbackServer.java:178)
W/System.err(22336): at java.lang.Thread.run(Thread.java:1027)
D/AudioHardwareMSM8660( 130): curr_out_device = 2
D/AudioHardwareMSM8660( 130): read batter temp = 341
D/AudioHardwareMSM8660( 130): enableDevice(2 1)
D/AudioHardwareMSM8660( 130): ACDB -> send_audio_cal, acdb_id = 15,
path = 0
D/AudioHardwareMSM8660( 130): ACDB ->
ACDB_CMD_GET_AUDPROC_COMMON_TABLE
D/AudioHardwareMSM8660( 130): ACDB -> AUDIO_SET_AUDPROC_CAL
D/AudioHardwareMSM8660( 130): ACDB ->
ACDB_CMD_GET_AUDPROC_GAIN_DEP_VOLTBL_STEP_COPP
D/AudioHardwareMSM8660( 130): ACDB -> AUDIO_SET_AUDPROC_VOL_CAL
W/AudioFlinger( 130): write blocked for 96 msecs, 41 delayed writes,
thread 0x1d6a8
W/System.err(22336): java.net.SocketException: Permission denied

W/System.err(22336): at
com.phonegap.CallbackServer.run(CallbackServer.java:178)
W/System.err(22336): at java.lang.Thread.run(Thread.java:1027)
W/System.err(22336): java.net.SocketException: Permission denied

W/System.err(22336): at
com.phonegap.CallbackServer.run(CallbackServer.java:178)
W/System.err(22336): at java.lang.Thread.run(Thread.java:1027)
D/dalvikvm(22336): GC_CONCURRENT freed 395K, 51% free 3076K/6215K,
external 0K/0K, paused 2ms+2ms
W/System.err(22336): java.net.SocketException: Permission denied

W/System.err(22336): at
com.phonegap.CallbackServer.run(CallbackServer.java:178)
W/System.err(22336): at java.lang.Thread.run(Thread.java:1027)
D/MediaPlayer(22336): reset() in
D/MediaPlayer(22336): reset() out
D/MediaPlayer(22336): start() in
D/AudioSystem( 130): linearToSpecifyHtcVolume(volume:100, streamType:
3, audio_devices:2)
D/MediaPlayer(22336): start() out
W/System.err(22336): java.net.SocketException: Permission denied

W/System.err(22336): at
com.phonegap.CallbackServer.run(CallbackServer.java:178)
W/System.err(22336): at java.lang.Thread.run(Thread.java:1027)
W/System.err(22336): java.net.SocketException: Permission denied

W/System.err(22336): at
com.phonegap.CallbackServer.run(CallbackServer.java:178)
W/System.err(22336): at java.lang.Thread.run(Thread.java:1027)
D/MediaPlayer(22336): reset() in
D/MediaPlayer(22336): reset() out
D/MediaPlayer(22336): start() in
D/AudioSystem( 130): linearToSpecifyHtcVolume(volume:100, streamType:
3, audio_devices:2)
D/MediaPlayer(22336): start() out
W/System.err(22336): java.net.SocketException: Permission denied

W/System.err(22336): at
com.phonegap.CallbackServer.run(CallbackServer.java:178)
W/System.err(22336): at java.lang.Thread.run(Thread.java:1027)
D/webview (22336): [WebView::UPDATE_SELECTION] ====== start
W/System.err(22336): java.net.SocketException: Permission denied


Greetings,
Chris

Simon MacDonald

unread,
Jun 25, 2011, 8:32:05 PM6/25/11
to phon...@googlegroups.com
Make sure your app has the following permission:

<uses-permission android:name="android.permission.INTERNET" />

If it does upgrade to the latest PhoneGap 0.9.5.1 as you may be
running into a but we had with phones with proxies. If that upgrade
does not work then check in your PhoneGap.js and find the line that
says:

PhoneGap.UsePolling = false;

and make it:

PhoneGap.UsePolling = true;

Let us know if that fixes the problem and what the solution was.

Paykz0r

unread,
Jul 3, 2011, 3:39:20 PM7/3/11
to phonegap
Hmhm...
polling did change something.

the onerror callback of the mp3 file gets called.
That was not the case before...

And for the permission...
the mp3 is in local resources. Do you think that this permission
really could help?
(i would give it a try anyway)

Another devices (samsung galaxy s) plays the mp3, but you can not
control volume using buttons.


On 26 Jun., 02:32, Simon MacDonald <simon.macdon...@gmail.com> wrote:
> Make sure your app has the following permission:
>
> <uses-permission android:name="android.permission.INTERNET" />
>
> If it does upgrade to the latest PhoneGap 0.9.5.1 as you may be
> running into a but we had with phones with proxies.  If that upgrade
> does not work then check in your PhoneGap.js and find the line that
> says:
>
> PhoneGap.UsePolling = false;
>
> and make it:
>
> PhoneGap.UsePolling = true;
>
> Let us know if that fixes the problem and what the solution was.
>
> Simon Mac Donaldhttp://hi.im/simonmacdonald

Simon MacDonald

unread,
Jul 5, 2011, 11:18:22 AM7/5/11
to phon...@googlegroups.com
You absolutely need that permission in order for PhoneGap on Android
to work properly. If you don't have that in your Manifest then you'll
have problems.

It's weird that the HW buttons don't work on your Samsung as they work
on mine. We set:

setVolumeControlStream(AudioManager.STREAM_MUSIC);

In our onCreate() method of DroidGap. Do you over-ride that anywhere?

Paykz0r

unread,
Jul 5, 2011, 2:49:07 PM7/5/11
to phonegap
Hmhm, that didn't do the trick.

Also also saw that the game starts on window.onload rather
deviceready.
I changed that, but it didn't helped, too.

So the internet persmission is the only one i have in the manifest
now,
are there more to add?

Thje game doesn't use any internet traffic, photos, contacts or
anything.
Lets say, i only need phonegap for the sound :D

Otherwise it totaly works in all webkit browsers (html5, yeah!)

Well, i didn't changed any java/objective-c functionality at all,
simply because i just know c++ and js.

Greetings,
Chris

On 5 Jul., 17:18, Simon MacDonald <simon.macdon...@gmail.com> wrote:
> You absolutely need that permission in order for PhoneGap on Android
> to work properly.  If you don't have that in your Manifest then you'll
> have problems.
>
> It's weird that the HW buttons don't work on your Samsung as they work
> on mine.  We set:
>
> setVolumeControlStream(AudioManager.STREAM_MUSIC);
>
> In our onCreate() method of DroidGap.  Do you over-ride that anywhere?
>
> Simon Mac Donaldhttp://hi.im/simonmacdonald
>
>
>
>
>
>
>
> On Sun, Jul 3, 2011 at 3:39 PM, Paykz0r <payk...@googlemail.com> wrote:
> > Hmhm...
> > polling did change something.
>
> > the onerror callback of themp3file gets called.
> > That was not the case before...
>
> > And for the permission...
> > themp3is in local resources. Do you think that this permission
> > really could help?
> > (i would give it a try anyway)
>
> > Another devices (samsung galaxy s) plays themp3, but you can not

Simon MacDonald

unread,
Jul 5, 2011, 3:05:51 PM7/5/11
to phon...@googlegroups.com
Yes, you don't want to do anything with PhoneGap until you get the
"deviceready" event. My test app uses the following permissions:

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission
android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />


<uses-permission android:name="android.permission.INTERNET" />

<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.RECORD_VIDEO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission
android:name="android.permission.GET_ACCOUNTS"></uses-permission>

Of which you will need at minimum:

<uses-permission android:name="android.permission.INTERNET" />

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

Paykz0r

unread,
Jul 19, 2011, 6:30:57 AM7/19/11
to phonegap
Well,
I set the minimum permissions, even if i don't see for what it's going
to need internet to play local audio files.

It all didn't helped.

And there is one more thing to note.
As i said, it's only the sensation which doesn't play the mp3s.

But a few days ago, i was flashing cyanogenmod on a htc wildfire.
Since then, the wildfire has exactly the same issue.

It plays wave files, but no mp3 files.

On samsung Galaxy Tab and samsung s9000i
everything still works.

Sorry to say that, but I am only using phonegap for sound.
Everything else is done using html5 anyway...

I am considering to just make a new Android project with webview
object and get sound done on that way.
It's to messy.
You can not define which sounds should be loaded, and which should be
streamed.
Which is a real problem, if file access is limited on android devices,
but not IOS devices.
And it has generaly WAY to few methods/options to make games with
that.
I am kinda dissapointed, to be honest.

On 5 Jul., 21:05, Simon MacDonald <simon.macdon...@gmail.com> wrote:
> Yes, you don't want to do anything with PhoneGap until you get the
> "deviceready" event.  My test app uses the following permissions:
>
>     <uses-permission android:name="android.permission.CAMERA" />
>     <uses-permission android:name="android.permission.VIBRATE" />
>     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
>     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
>     <uses-permission
> android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
>     <uses-permission android:name="android.permission.INTERNET" />
>     <uses-permission android:name="android.permission.RECEIVE_SMS" />
>     <uses-permission android:name="android.permission.RECORD_AUDIO" />
>     <uses-permission android:name="android.permission.RECORD_VIDEO"/>
>     <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
>     <uses-permission android:name="android.permission.READ_CONTACTS" />
>     <uses-permission android:name="android.permission.WRITE_CONTACTS" />
>     <uses-permission
> android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
>     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
>     <uses-permission
> android:name="android.permission.GET_ACCOUNTS"></uses-permission>
>
> Of which you will need at minimum:
>
>     <uses-permission android:name="android.permission.INTERNET" />
>     <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
>
> Simon Mac Donaldhttp://hi.im/simonmacdonald
> ...
>
> Erfahren Sie mehr »

Simon MacDonald

unread,
Jul 19, 2011, 8:40:39 AM7/19/11
to phon...@googlegroups.com
You need the Internet permissions for the Java and JavaScript layers
to be able to communicate via the socket we use.

The fact that the mp3 is not playing on the HTC devices is telling.
Perhaps they are missing a codec. Reproduce the bug running "adb
logcat" so we can see what is going on.

Simon

>> >> >> > W/System.err(22336):    at java.lang.Thread.run(Thread.> ...
>>
>> Erfahren Sie mehr »


>
> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com
>

--

Paykz0r

unread,
Jul 23, 2011, 9:45:13 AM7/23/11
to phonegap
I have interesting news on this.

Sorry for me previous reaction, i was kinda frustrated on this.
But i solved it.

I simply exchanged the music files with some other mp3 files, and they
do work flawlesly!

the files which didn't worked on sensation/cm7 wildfire had following
properties:
MPEG 2, Layer 3
Stereo at 22050Hz / 64Kbps

The new files which worked fine showed these properties:
MPEG 1, Layer 3
Stereo at 44100Hz / 104Kbps

And its even working if i do remove all permissionss from manifest
file.

Maybe this should be noted in some documents.
Hope that helps some ppl.

Greetings,
Christian

On
19 Jul., 14:40, Simon MacDonald <simon.macdon...@gmail.com> wrote:
> You need the Internet permissions for the Java and JavaScript layers
> to be able to communicate via the socket we use.
>
> The fact that themp3is not playing on the HTC devices is telling.

Paykz0r

unread,
Jul 23, 2011, 9:58:15 AM7/23/11
to phonegap
More infos:
It doesn't matter if its MPEG 1 or 2.
It's seems like it was the variable bits per senconds count :)

Jesse Macfadyen

unread,
Jul 23, 2011, 2:55:33 PM7/23/11
to phon...@googlegroups.com
I would recommend using uncompressed sounds ( wav, caf, ... ) anyway.
If you have multiple sounds to play there is considerable hardware
overhead to decompress and mix mp3s, especially if they are different
bitrates.

and avoid vbr obviously.

Cheers,
Jesse

Sent from my iPhone5

Simon MacDonald

unread,
Jul 23, 2011, 3:46:51 PM7/23/11
to phon...@googlegroups.com
Great, I'm just glad you resolved it.

Paykz0r

unread,
Jul 24, 2011, 6:55:08 AM7/24/11
to phonegap
Well, the mp3 is just for music.

For Sfx I am using .wav files.

There is an overhead indeed, but having 25MB wave files for music is
no option for me :/

Well, thanx for your replies.
My next issue is that i can't control volume of multiple sounds.
Any chance that phonegap api is going to implement that soon?

Greetings,
Christian

On 23 Jul., 21:46, Simon MacDonald <simon.macdon...@gmail.com> wrote:
> Great, I'm just glad you resolved it.
>
> Simon Mac Donaldhttp://hi.im/simonmacdonald
Reply all
Reply to author
Forward
0 new messages