Android YouTube app Play Video Intent

前端 未结 18 1466
太阳男子
太阳男子 2020-11-22 11:17

I have created a app where you can download YouTube videos for android. Now, I want it so that if you play a video in the YouTube native app you can download it too. To do t

18条回答
  •  猫巷女王i
    2020-11-22 11:34

    Try this:

    public class abc extends Activity implements OnPreparedListener{
    
      /** Called when the activity is first created. */
    
      @Override
        public void onCreate(Bundle savedInstanceState)
      {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=cxLG2wtE7TM")));          
    
    
        @Override
          public void onPrepared(MediaPlayer mp) {
            // TODO Auto-generated method stub
    
        }
      }
    }
    

提交回复
热议问题