I have two applications, the first one is iOS application that record sound and save it in *.caf files. the second one is Java application that need to read this *.caf sound files and to play them.

I looking for Java code that can read/play these *.caf sound files

有帮助吗?

解决方案

Unfortunately, I believe the short answer is there isn't any. At least not any free code that I could find at the moment (I conducted a relatively extensive search recently for free SPIs and turned up all sorts, such as APE - but nothing for caf.) JavaFX, the other potential candidate for Java media, doesn't currently support it either:

Audio: MP3; AIFF containing uncompressed PCM; WAV containing uncompressed PCM; MPEG-4 multimedia container with Advanced Audio Coding (AAC) audio

I would suggest your best option, short of implementing this yourself, would be one of two options:

  • Alter your other application so that it saved in a more widely accepted file type - there are others out there that can do lossless audio rather well, such as FLAC, which does have an SPI. Alternatively, use WAV or AIFF (or just mp3 if you're happy with a lossy format.)
  • Use a native library to play back the caf file for each platform you wish to support, and use JNI / JNA to go between Java and native code.
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top