简体   繁体   English

MediaPlayer为WAV文件抛出IOException

[英]MediaPlayer throws IOException for wav file

I have an audio recording app on android, and I've encountered a strange issue on a friend's phone. 我在android上有一个录音应用程序,但是在朋友的电话上遇到了一个奇怪的问题。

One of the recordings did not work and throws: 其中一个录音不起作用并抛出:

E/MediaPlayer-JNI(5996): QCMediaPlayer mediaplayer NOT present
E/MediaPlayer(5996): Unable to create media player
E/com.audioRec.player.MediaPlayer(5996): setDataSourceFD failed.: status=0x80000000
E/com.audioRec.player.MediaPlayer(5996): java.io.IOException: setDataSourceFD failed.: status=0x80000000

but it is playing with success on windows media player, vlc player, etc !!!!!!!!! 但它在Windows Media Player,VLC Player等上成功运行!

Could someone take a look over the header of the "RecordingNotOk.wav" file?

Here are both recordings 这都是录音

For the RecordingNotOk.wav file, it sounds like the specified size of the data chunk is bigger than the file size: 00 F8 0A 00 in little endian is 718848 bytes while the whole file size is only 716844 and the actual data size available for this chunk is only 716800 对于RecordingNotOk.wav文件,听起来数据块的指定大小大于文件大小:00 F8 0A 00(小字节序)为718848字节,而整个文件大小仅为716844,实际可用的数据大小可用于此块只有716800

This number can be found here (3rd line after 'data'): 可以在此处找到此数字(“数据”之后的第三行):

52 49 46 46  24 F0 0A 00  57 41 56 45  66 6D 74 20  RIFF $ð?? WAVE fmt 
10 00 00 00  01 00 02 00  80 3E 00 00  00 FA 00 00  ???? ???? >?? ?ú??
04 00 10 00  64 61 74 61  00 F8 0A 00  00 00 00 00  ???? data ?ø?? ????

Basically it seems that your file has been truncated. 基本上看来,您的文件已被截断。 Some players might ignore this and try to play whatever is available up to the end of the file. 一些播放器可能会忽略此内容,并尝试播放直到文件末尾的所有可用内容。 I guess on Android it tries to read the whole file first according to the expected size hence the IOException 我猜在Android上它会尝试根据预期大小首先读取整个文件,因此出现IOException

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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