Android YouTube app Play Video Intent

前端 未结 18 1313
太阳男子
太阳男子 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条回答
  •  野性不改
    2020-11-22 11:35

    Replying to old question, just to inform you guys that package have changed, heres the update

    Intent videoClient = new Intent(Intent.ACTION_VIEW);
    videoClient.setData("VALID YOUTUBE LINK WITH HTTP");
    videoClient.setClassName("com.google.android.youtube", "com.google.android.youtube.WatchActivity");
    startActivity(videoClient);
    

    This works very well, but when you call normal Intent with ACTION_VIEW with valid youtube URL user gets the Activity selector anyways.

提交回复
热议问题