SoundPool.load and FileDescriptor

All your problems with Audio, Video and Images.

SoundPool.load and FileDescriptor

Postby mswiege » Fri Jun 04, 2010 5:37 pm

I tried using the load function of the SoundPool that takes a FileDescriptor, because I wanted to be able to set the offset and length. The File is not stored in the Ressources but a file on the storage card. Even though neither the load nor the play function of the SoundPool throw any Exception or print anything to the console, the sound is not played. Using the same code, but use the file path string in the SoundPool constructor works perfectly.

This is how I have tried the loading (start equals 0 and length is the length of the file in miliseconds):
Code: Select all
FileInputStream fileIS = new FileInputStream(new File(mFile));
mStreamID = mSoundPool.load(fileIS.getFD(), start, length, 0);
mPlayingStreamID = mSoundPool.play(mStreamID, 1f, 1f, 1, 0, 1f);


If I would use this, it works:
Code: Select all
mStreamID = mSoundPool.load(mFile, 0);
mPlayingStreamID = mSoundPool.play(mStreamID, 1f, 1f, 1, 0, 1f);


Any ideas anyone?

Thanks
mswiege
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Jun 04, 2010 5:29 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 22 guests