gpt4 book ai didi

javascript - 在 Google Chrome 的 native 播放器中打开视频 URL

转载 作者:太空狗 更新时间:2023-10-29 16:14:14 26 4
gpt4 key购买 nike

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

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

intent://www.example.com/video.mp4#Intent;scheme=file;action=android.intent.action.VIEW;end;

当然,这个 URI 不起作用,Chrome 返回错误“无法执行导航”。我还尝试了相同的 URI,省略了 scheme=file

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

提前致谢!

最佳答案

在 AOSP 中快速浏览 Gallery App 会发现它可以从浏览器启动。 It has a category of BROWSABLE and DEFAULT .这意味着只要提供正确的 Intent 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

注意:

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

我创建了一个 demo that works

关于javascript - 在 Google Chrome 的 native 播放器中打开视频 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34516817/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com