在Google Chrome中打开原生播放器中的视频网址

jos*_*mmo 2 javascript video android google-chrome android-intent

我正在尝试http://www.example.com/video.mp4使用直接从谷歌Chrome推出的默认Android播放器打开远程视频(假设它位于此处),使用全新的视频intent://.

这是我通过href标签调用的URI :

intent://www.example.com/video.mp4#Intent;scheme=file;action=android.intent.action.VIEW;end;
Run Code Online (Sandbox Code Playgroud)

当然,此URI不起作用,Chrome会返回错误"无法执行导航".我也尝试过省略相同的URI scheme=file.

这是我一直关注的文档:https://developer.chrome.com/multidevice/android/intents

提前致谢!

Kin*_*lan 6

在AOSP中快速浏览Gallery App可以显示它可以从浏览器启动. 它有一个BROWSABLE和DEFAULT类别.这意味着给定正确的意图URL,您应该能够启动它.

显然指定一个包应该可以工作,但这不灵活,如果有两个图库应用程序会怎样.

以下Intent方案url有效:

intent://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4#Intent;action=android.intent.action.VIEW;scheme=http;type=video/mp4;end
Run Code Online (Sandbox Code Playgroud)

注意:

  1. scheme = http(它需要是那个或https),
  2. 在域之前有一个//,如果不存在,则在播放器中没有正确构造URL
  3. action = android.intent.action.VIEW
  4. type = video/mp4 - 如果没有,视频将在浏览器中打开

我创建了一个可行的演示