开发者

android multiple videoView problem, Galaxy Tab specific

I am having problems with multiple videoViews specifically on Galaxy Tab.

In my app, I have two different video files which I want to play simultaneously. So I designed my app to have two videoViews side by side. Tried to run it on two non Galaxy tabs and it worked. Easy as that.

But then, I tried to test it on my Galaxy Tab and the problem comes out. The two video file doesn't play. At some point, the fir开发者_JS百科st video file plays and then stops and pops up the Cannot Play Video error. I spent almost two days looking for the cause of the problem and I failed. That's why I resorted to guessing what could be the cause.

My suspicion was that it cannot render two videos at the same time, so I tried to play only the sound of the first file using MediaPlayer and play the other one in the videoView. And I think my suspicioin was right because it works, the first video file plays only the sound, and the other one plays the full video and the sound.

I am looking for someone with this kind of problem, or someone who knows a workaround for this. I will post my simple code here for you to take a look at it. I would really appreciate your help! Thanks in advance.

junmats.

final videoView v1 = (VideoView) findViewById(R.id.videoView1);
final videoView v2 = (VideoView) findViewById(R.id.videoView2); 

   Thread th1 = new Thread(new Runnable() {
        @Override
        public void run() {
            Uri uriFile = Uri.parse(myFile);
            v1.setVideoURI(uriFile);
            v1.start();
        }
    });
    th1.start();

    Thread th2 = new Thread(new Runnable() {
        @Override
        public void run() {
            Uri uriFile = Uri.parse(
            v2.setVideoURI(uriFile);
                  v2.start();
        }
    });
    th2.start();


This seems to be dependent on the kernel version so it may not be supported on certain devices... http://code.google.com/p/android/issues/detail?id=17802

You may have to wait for an update.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜