## Intent

You can use an intent to directly launch the player of mpv-android.

package: `is.xyz.mpv`
action: `android.intent.action.VIEW`

- data: URI with scheme `rtmp, rtmps, rtp, rtsp, mms, mmst, mmsh, tcp, udp` (as supported by FFmpeg)
  or
- data: URI with scheme `content, file, http, https`
  type: `video/*` or `audio/*`
  or
- data: URI with scheme `http, https` and file extension `mkv, mp4, webm, mov, flac, mp3, ogg, m3u, m3u8`

If you need to force an URL to be opened in mpv regardless of the file extension set the MIME type to `video/any`.
extras: (all optional)

- `decode_mode` (Byte): if set to 2, hardware decoding will be disabled
- `subs` (ParcelableArray of Uri): list of subtitle URIs to be added as additional tracks
- `subs.enable` (ParcelableArray of Uri): specifies which of the subtitles should be selected by default, subset of previous array
- `position` (Int): starting point of video playback in milliseconds
- `title` (String): media title to show for this file

Examples

##### Kotlin

    val intent = Intent(Intent.ACTION_VIEW)
    intent.setDataAndType(Uri.parse("https://example.org/media.png"), "video/any")
    intent.setPackage("is.xyz.mpv")
    val subtitle = Uri.parse("https://example.org/subtitle.srt")
    intent.putExtra("subs", arrayOf<Uri>(subtitle))
    startActivity(intent)

##### HTML (Chrome)

    <a href="intent://example.org/media.png#Intent;type=video/any;package=is.xyz.mpv;scheme=https;end;">Click me</a>

##### Command line (e.g. adb or Termux)

    am start -a android.intent.action.VIEW -t video/any -p is.xyz.mpv -d "https://example.org/media.png"

## Result Intent

Once the activity exits mpv-android will deliver a result intent back to the invoker.
action: `is.xyz.mpv.MPVActivity.result`
code:

- `RESULT_CANCELED`: playback did not start due to an error
- `RESULT_OK`: playback ended normally or user exited

data: the same URI mpv was launched with
extras:

- `position` (Int): last playback position in milliseconds. not present if playback finished normally
- `duration` (Int): total media length in milliseconds. not present if playback finished normally

## Notes

This API was inspired by the counterpart in MXPlayer.
Note that only Java code is powerful enough to use the full features of this specification or receive result intents.