Java me 音频流输出内存错误
我正在尝试从服务器流式传输音频内容(AAC)。玩家开始时没有任何问题,一段时间后抛出记忆错误。我想我需要缓冲音频。任何人请指导我实现(或消除此错误)缓冲 这是我的密码Java me 音频流输出内存错误,java-me,j2mepolish,java-micro-editon-sdk3.0,Java Me,J2mepolish,Java Micro Editon Sdk3.0,我正在尝试从服务器流式传输音频内容(AAC)。玩家开始时没有任何问题,一段时间后抛出记忆错误。我想我需要缓冲音频。任何人请指导我实现(或消除此错误)缓冲 这是我的密码 `HttpConnection c = null; InputStream is = null; try { c = (HttpConnection) Connector.open(streamURL, Connector.READ_WRITE);
`HttpConnection c = null;
InputStream is = null;
try {
c = (HttpConnection) Connector.open(streamURL,
Connector.READ_WRITE);
int rc = c.getResponseCode();
System.out.println("Response Code " + rc);
if (rc != HttpConnection.HTTP_OK) {
showAlert("Server error returned");
} else {
playerForm.append("openInputStream");
is = c.openInputStream();
player = Manager.createPlayer(is, "audio/aac");
player.realize();
// get volume control for player and set volume to max
VolumeControl vc = (VolumeControl) player.getControl("VolumeControl");
if(vc != null)
{
vc.setLevel(100);
}
player.prefetch();
player.start();
}
} catch (Exception f) {
playerForm.append("Exception in player " + f.getMessage() + "\n");
} finally { // Aufräumarbeiten ausführen
if (is != null)
try {
is.close();
} catch (IOException e) {
}
if (c != null)
try {
c.close();
} catch (IOException e) {
}
}`
提前谢谢
问候
安妮什 而不是catch just use Throwable类中的异常,它将处理OutOfMemoryError而不是catch just use Throwable类中的异常,它将处理OutOfMemoryError