HTML中的“href”值可在Android上的YouTube应用或市场(Google Play)中打开视频

时间:2016-08-18 18:00:28

标签: android html android-intent youtube-api android-youtube-api

我正在制作一个显示360视频的网页,但我最近注意到Android浏览器中的360功能不受支持,因此视频无法正确显示,所以搜索了很多后我发现最好的选择是尝试在YouTube应用中打开视频,并使用" Android Intent"在本开发人员教程中解释:

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

所以我需要为YouTube视频构建href地址,但不幸的是我不知道android编程,也无法找到YouTube App xml清单来填充选项,任何人都可以帮助我吗?

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;

非常感谢任何帮助或教程......谢谢!!

2 个答案:

答案 0 :(得分:9)

1)意图解决方案:

<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:

也许您需要删除 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)链接解决方案:

您可以在设置&gt;中获得更多信息。 应用&gt; Youtube &gt; 默认情况下打开&gt; 支持的链接

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

请参阅:https://youtu.be/8xn9iq3lG_w并尝试,在此处: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

答案 1 :(得分:1)

您可以使用:       window.location的= “意图://扫描/#意图;方案= YouTube的;包= com.google.youtube;端”

我不确定...但是试试。