“href” value in HTML to open video in youtube app or market (Google Play) on Android

11,851

Solution 1

1) Intent solution :

<a href="
intent:
  //8xn9iq3lG_w/
  #Intent;
    scheme=vnd.youtube;
    package=com.google.android.youtube
    S.browser_fallback_url=market://details?id=com.google.android.youtube;
end;
">youtube or market</a>

NB:

Maybe you need to remove spaces in href attribut:

<a href="intent://8xn9iq3lG_w/#Intent;scheme=vnd.youtube;package=com.google.android.youtube;S.browser_fallback_url=market://details?id=com.google.android.youtube;end;">youtube or market</a>

video


2) Link solution :

You get more information in Settings > Apps > Youtube > Open by default > Supported links:

  • youtube.be
  • m.youtube.com
  • youtube.com
  • www.youtube.com

See: https://youtu.be/8xn9iq3lG_w and try, here: http://output.jsbin.com/tubozokebe/

<a target="_blank" href="https://youtu.be/8xn9iq3lG_w">link: https://youtu.be/8xn9iq3lG_w</a> or
<a target="_blank" href="vnd.youtube:8xn9iq3lG_w">link: vnd.youtube:8xn9iq3lG_w</a>

video

Solution 2

You can use: window.location="intent://scan/#Intent;scheme=youtube;package=com.google.youtube;end"

I am not sure about it...But try.

Share:
11,851

Related videos on Youtube

Chico3001
Author by

Chico3001

Updated on June 04, 2022

Comments

  • Chico3001
    Chico3001 about 2 years

    I'm making a Web Page that shows 360 videos, but i recently noticed that 360 functionality in the android browser is not supported, and because of this the video wont shows correctly, so after searching a lot i found that the best option is to try to open the video in the YouTube app making use of an "Android Intent" explained in this developer tutorial:

    https://developer.chrome.com/multidevice/android/intents

    So i need to construct the href address for a YouTube video, but unfortunately i don't know android programming and also can't find the YouTube App xml manifest to fill the options, can anyone help me?

    intent:
       HOST/URI-path <-- I think here needs to be the video URL? 
       #Intent; 
          package=com.google.android.youtube.player.YouTubeIntents; <-- Is this the correct package? or should i use com.google.android.youtube.player? 
          action=createPlayVideoIntentWithOptions(context, UUweNrpFTwA, true, true); <-- Dont know what to put in context field 
          category=[string]; <-- Is category needed? if so what category should i place here?
          component=[string]; <-- Is component needed?
          scheme=youtube; <-- Is this the correct scheme?
       end;
    

    Any help or tutorial will be greatly appreciated... Thanks!!

  • Chico3001
    Chico3001 almost 8 years
    Yes, but this solution wont redirect the user to the playstore if youtube app is not installed, and <a href="intent://scan/#Intent;scheme=zxing;package=com.google.‌​zxing.client.android‌​;end"> Take a QR code </a> will do... thats why i need to change this example and fill the correct information for the youtube app
  • Chico3001
    Chico3001 almost 8 years
    Do you know if is it possible to automatically play the video on full screen?
  • user9342572809
    user9342572809 almost 8 years
    I don't know, I try to add extra but I don't know how to do with html.