데이터베이스에서 wav 파일을 재생하려고합니다. PHP 파일로 blob 파일을 다시 만듭니다. 우리의 DataInputStream와 inputStream을 교체하는 경우 이 코드는 동영상 파일과 함께 작동 :데이터베이스에서 음악 파일 J2m을 재생하는 방법은 무엇입니까?
공공 무효 playAudio() {
try {
ContentConnection connection = (ContentConnection)Connector.open("http://localhost/P/getXmlMusic.php");
InputStream iStrm = connection.openInputStream();
player = Manager.createPlayer(iStrm,"audio/x-wav");
player.addPlayerListener(this);
player.setLoopCount(4);
player.prefetch();
player.realize();
player.start();
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
오류 : 잘못된 웨이브 미디어 : 플레이어를 실현하지 못했습니다 예상 'RIFF'
NB : 같은 파일을 로컬로 재생할 수 있습니다. 파일은 오케이입니다.
PHP 파일에'header()'를 추가했는지 기억 했습니까? –