4
我在我的應用程序中放入了一個videoview,它工作正常,但是當您打開該頁面時,它會永久加載/緩衝。爲什麼videoview如此之慢?
無論如何我可以解決這個問題。我的意思是這是一個3秒視頻。加載不需要很長時間。對?
代碼:
package jslsoftware.co.nr;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.VideoView;
import android.widget.MediaController;
public class videoview1 extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.video1);
Uri vidFile = Uri.parse("http://jslserver1.yolasite.com/resources/3gp_videos/Animal.3gp");
VideoView videoView = (VideoView) findViewById(R.id.videoView1);
videoView.setVideoURI(vidFile);
videoView.setMediaController(new MediaController(this));
videoView.start();
}
}
感謝
我閱讀了那個鏈接,並且以不讓事情陷入困境的方式進行了很多探索。但現在我對代碼不太好(剛開始)。你能夠提供給我一些使用單獨線程的代碼,或者給我說明我需要做什麼來將它安裝到我的代碼中。非常感謝你的幫助! – scott1218 2012-04-10 03:49:49
在你的代碼中定義另一個類,並將你的視頻調用放在後臺服務中。我將用代碼編輯我的答案。 – MACMAN 2012-04-10 03:55:11
非常感謝你! – scott1218 2012-04-10 04:05:12