我在我的应用程序中放置了一个视频视图,它工作正常,但是当您打开页面时,它需要永远加载/缓冲。
无论如何我可以解决这个问题吗?我的意思是这是一个3秒视频。加载时间应该不会太长。正确的?
code:
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();
}
}
Thanks
为什么不直接放置代码而不是子类化它呢?
private class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
protected Bitmap doInBackground(String... urls) {
return loadImageFromNetwork(urls[0]);
}
protected void onPostExecute(Bitmap result) {
mImageView.setImageBitmap(result);
}
}
只需替换 doInBackground 方法中的内容即可。如果执行后有任何事情要做,请放在 onPostExecute 中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)