Android YouTube app Play Video Intent

前端 未结 18 1125
太阳男子
太阳男子 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:38

    This will work if youtube app installed. If not, a chooser will show up to select other application:

    Uri uri = Uri.parse( "https://www.youtube.com/watch?v=bESGLojNYSo" );
    uri = Uri.parse( "vnd.youtube:" + uri.getQueryParameter( "v" ) );
    startActivity( new Intent( Intent.ACTION_VIEW, uri ) );
    

提交回复
热议问题