我有一些代码,它将视频从服务器流式传输到我在我的应用程序中插入的Flash播放器,但有时,在用户按“播放”后由于网络问题,它会收到FileNotFoundException。如何编辑我的代码尝试托盘和托盘din,直到服务器响应? 这是我的代码:
irib1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
rtmpUrl = "rtmp://live.kashef.tv/totalstreamer";
fileName = "irib1-"+ qpm +".sdp";
if (fileName.endsWith(".flv")) {
fileName = "flv:" + fileName;
}
bodyHtml = htmlCode;
bodyHtml = bodyHtml.replaceAll("@FILESRC@",
"\"file=" + fileName
+ "&streamer=" + rtmpUrl + "\"");
webView.loadDataWithBaseURL("http://127.0.0.1",
htmlPre + bodyHtml
+ htmlPost, "text/html", "UTF-8", null);
}
});
这是我的LogCat:
11-24 19:48:01.380: W/System.err(17187): java.io.FileNotFoundException: http://live.kashef.tv/fcs/ident2
11-24 19:48:01.380: W/System.err(17187): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:521)
11-24 19:48:01.380: W/System.err(17187): at dalvik.system.NativeStart.run(Native Method)
11-24 19:48:01.380: W/System.err(17187): at dalvik.system.NativeStart.run(Native Method)