简体   繁体   中英

Can't play .amr file in wp8

I use AudioVideoCaptureDevice to record the voice and save it to isolated storage with amr format

dev = await AudioVideoCaptureDevice.OpenForAudioOnlyAsync();
dev.AudioEncodingFormat = CameraCaptureAudioFormat.Amr;

I can play it by windows media player. But I can't play it with SoundEffect in WP8.

using (IsolatedStorageFileStream sourceFile = ISF.OpenFile("\\data\\test.amr", FileMode.Open, FileAccess.Read))
{
   byte[] b = new byte[sourceFile.Length];
   sourceFile.Read(b, 0, b.Length);
   SoundEffect sound = new SoundEffect(b, microphone.SampleRate, AudioChannels.Mono);
   soundInstance = sound.CreateInstance();
   soundInstance.Play();
}

Please help me to know why and help me to solve this problem. Thanks.

this is not working because souneffect only accepts .wav file...| it does not support any other format except that ... so change your file format it should work fine...

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