forked from mpv-android/mpv-android
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintent.html
More file actions
83 lines (76 loc) · 3.06 KB
/
intent.html
File metadata and controls
83 lines (76 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!DOCTYPE html>
<html>
<head>
<title>Intent specification</title>
<link href="default.css" rel="stylesheet">
</head>
<body>
<h2 id="intent">Intent</h2>
<p>You can use an intent to directly launch the player of mpv-android.</p>
<p>package: <code>is.xyz.mpv</code><br>
action: <code>android.intent.action.VIEW</code></p>
<ul>
<li>
data: URI with scheme <code>rtmp, rtmps, rtp, rtsp, mms, mmst, mmsh, tcp, udp</code>
(as supported by <a href="http://ffmpeg.org/ffmpeg-protocols.html" target="_blank" rel="noopener">FFmpeg</a>)<br>
<i>or</i>
</li>
<li>
data: URI with scheme <code>content, file, http, https</code><br>
type: <code>video/*</code> or <code>audio/*</code><br>
<i>or</i>
</li>
<li>
data: URI with scheme <code>http, https</code> and file extension <code>mkv, mp4, webm, mov, flac, mp3, ogg, m3u, m3u8</code><br>
</li>
</ul>
<p>If you need to force an URL to be opened in mpv regardless of the file
extension set the MIME type to <code>video/any</code>.<br>
extras: <i>(optional)</i></p>
<ul>
<li>
<code>decode_mode</code> (Byte): if set to 2, hardware decoding will be disabled
</li>
<li>
<code>subs</code> (ParcelableArray of Uri): list of subtitle URIs to be added as additional tracks
</li>
<li>
<code>subs.enable</code> (ParcelableArray of Uri): specifies which of the subtitles should be selected by default, subset of previous array
</li>
<li>
<code>position</code> (Int): starting point of video playback in milliseconds
</li>
</ul>
<details>
<summary>Examples</summary>
<div style="margin-left: 1em;">
<h5>Kotlin</h5>
<pre>val intent = Intent(Intent.ACTION_VIEW)
intent.setDataAndType(Uri.parse("https://example.org/media.png"), "video/any")
intent.setPackage("is.xyz.mpv")
startActivity(intent)</pre>
<h5>HTML (Chrome)</h5>
<pre><a href="intent://example.org/media.png#Intent;type=video/any;package=is.xyz.mpv;scheme=https;end;">Click me</a></pre>
<h5>Command line (e.g. adb or Termux)</h5>
<pre>am start -a android.intent.action.VIEW -t video/any -p is.xyz.mpv -d "https://example.org/media.png" </pre>
</div>
</details>
<h2 id="result-intent">Result Intent</h2>
<p>Once the activity exits mpv-android will deliver a result intent back to the invoker.<br>
action: <code>is.xyz.mpv.MPVActivity.result</code><br>
code:</p>
<ul>
<li><code>RESULT_CANCELED</code>: playback did not start due to an error</li>
<li><code>RESULT_OK</code>: playback ended normally or user exited</li>
</ul>
<p>data: the same URI mpv was launched with<br>
extras:</p>
<ul>
<li><code>position</code> (Int): last playback position in milliseconds. not present if playback finished normally</li>
<li><code>duration</code> (Int): total media length in milliseconds. not present if playback finished normally</li>
</ul>
<h2 id="notes">Notes</h2>
<p>This API was inspired by the counterpart in <a href="http://mx.j2inter.com/api" target="_blank" rel="noopener">MXPlayer</a>.<br>
Note that only Java code is powerful enough to use the full features of this specification or receive result intents.</p>
</body>
</html>