[Android-development] playing sound on Qt/Android

Christian Strømme christian.stromme at theqtcompany.com
Wed Nov 26 11:24:41 CET 2014



On 26/11/14 07:18 , maitai at virtual-winds.org wrote:
> Hello,
>
> What is the best way to play mp3 on Android with a 5.3.2 widget-based
> application (no QML)?
>

QMediaPlayer is the right class for playing mp3s, also on Android. If 
you need low-latency playback, e.g., sound effects when pressing a 
button, QSoundEffect is the right class (requires an uncompressed audio 
source).


> I have tried using QMultimedia and it works perfectly on windows/linux
> but fails on Android. It's not clear to me whether the problem is in
> ministro or just that it's not supported. I get this output in the
> console:
>
> V/MediaPlayer-JNI(14123): native_setup
> V/MediaPlayer(14123): constructor
> V/MediaPlayer(14123): setListener
> V/MediaPlayer-JNI(14123): setVolume: left 1.000000  right 1.000000
> V/MediaPlayer(14123): MediaPlayer::setVolume(1.000000, 1.000000)
> D/Qt MediaPlayer(14123): null
> V/MediaPlayer-JNI(14123): reset
> V/MediaPlayer(14123): reset
> V/MediaPlayer-JNI(14123): release
> V/MediaPlayer(14123): setListener
> V/MediaPlayer(14123): disconnect
> V/MediaPlayer(14123): destructor
> V/MediaPlayer(14123): disconnect
> I/dalvikvm(14123): threadid=13: stack overflow on call to
> Ljava/lang/Exception;.<init>:V
> I/dalvikvm(14123):   method requires 4+20+4=28 bytes, fp is 0x7b0cf310
> (16 left)
> I/dalvikvm(14123):   expanding stack end (0x7b0cf300 to 0x7b0cf000)
> I/dalvikvm(14123): Shrank stack (to 0x7b0cf300, curFrame is 0x7b0cf33c)
> W/dalvikvm(14123): Exception thrown (Ljava/lang/StackOverflowError;)
> while throwing internal exception (Ljava/lang/IllegalStateException;)
>

This log output seems a bit strange to me. Is this reproducible with a 
small example using only one mediaplayer and one source?

> Is there an alternative way to play mp3? If not I hope at least I can
> use QSound/QSoundEffect to play .wav ...
>
> Thanks,
> Philippe Lelong
> _______________________________________________
> Android-development mailing list
> Android-development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/android-development
>

--
Christian



More information about the Android-development mailing list