how can i play two video on one screen?

前端 未结 1 1417
天涯浪人
天涯浪人 2021-02-11 07:55

i have to make an application where i need to play two video simultaniously,on screen. here is my code.but the video dose not play.am i doing wrong anywhere? :(

         


        
相关标签:
1条回答
  • 2021-02-11 08:15

    I think you require two separate threads for playing two videos. since IO operations are blocking... One of the video Player may starve for CPU... Call start() in two separate threads.... Hope that helps!!!

    EDIT first remove the start() calls from onCreate().. Create two separate threads

        Thread view1Thrad = new Thread(new Runnable(){
        @Override
        public void run(){
    android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_URGENT_DISPLAY);
        myVideoView.start();
        });
        Thread view2Thrad = new Thread(new Runnable(){
            @Override
            public void run(){
    android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_URGENT_DISPLAY);
            myVideoView2.start();
            });
    

    now start these threads one by one...

    view1Thread.start(); //starts first video
    view2Thread.start(); //starts second video
    

    Hope that helps!!!

    0 讨论(0)
提交回复
热议问题