简体   繁体   中英

Open video URL in native player from Google Chrome

I'm trying to open a remote video (let's say it's located at http://www.example.com/video.mp4 ) with the default Android player launched directly from Google Chrome, making use of the brand new intent:// .

This is the URI I called through an href tag:

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

Of course, this URI doesn't work, and Chrome returns error "Unable to perform navigation". I've also tried the same URI omitting scheme=file .

Here's the documentation I've been following: https://developer.chrome.com/multidevice/android/intents

Thanks in advance!

A quick browse of the Gallery App in AOSP shows that it can be launched from a browser. It has a category of BROWSABLE and DEFAULT . This means given the correct intent URL you should be able to launch it.

Obviously specifying a package should work, but that is not flexible, what if there are two gallery apps.

The following Intent scheme url works:

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

Note:

  1. scheme = http (it needs to be that or https),
  2. there is a // before the domain, if that is not there the URL is not constructed correctly in the player
  3. action = android.intent.action.VIEW
  4. type = video/mp4 - if this is not in place the video will open in the browser

I have created a demo that works

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM