简体   繁体   中英

WAV file MediaPlayer

I'm trying to play a WAV file from the SD card. It works on some phones (Nexus S, Nexus One etc.) but not in Xperia Mini series.

Code:

// On some phones, this line works, but on Xperia Mini 
// series phones MediaPlayer.create()
// returns null from this line below.
MediaPlayer mp = MediaPlayer.create(this, Uri.fromFile(new File(filePath)));

The LogCat error message can be found here .

Any ideas? It certainly works on some phones, but other phones just reject the wav file.

Seems to be the same issue (and solution) as this one: Android - play sound on button click - Null pointer exception

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM