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