美文网首页Android
Run exoplayer from command line

Run exoplayer from command line

作者: JaedenKil | 来源:发表于2017-12-29 18:53 被阅读14次

This is currently tested with exoplayer version 2.5.4.
am output:

<INTENT> specifications include these flags and arguments:
    [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
    [-c <CATEGORY> [-c <CATEGORY>] ...]
    [-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
    [--esn <EXTRA_KEY> ...]
    [--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
    [--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
    [--el <EXTRA_KEY> <EXTRA_LONG_VALUE> ...]
    [--ef <EXTRA_KEY> <EXTRA_FLOAT_VALUE> ...]
    [--eu <EXTRA_KEY> <EXTRA_URI_VALUE> ...]
    [--ecn <EXTRA_KEY> <EXTRA_COMPONENT_NAME_VALUE>]
    [--eia <EXTRA_KEY> <EXTRA_INT_VALUE>[,<EXTRA_INT_VALUE...]]
        (mutiple extras passed as Integer[])
    [--eial <EXTRA_KEY> <EXTRA_INT_VALUE>[,<EXTRA_INT_VALUE...]]
        (mutiple extras passed as List<Integer>)
    [--ela <EXTRA_KEY> <EXTRA_LONG_VALUE>[,<EXTRA_LONG_VALUE...]]
        (mutiple extras passed as Long[])
    [--elal <EXTRA_KEY> <EXTRA_LONG_VALUE>[,<EXTRA_LONG_VALUE...]]
        (mutiple extras passed as List<Long>)
    [--efa <EXTRA_KEY> <EXTRA_FLOAT_VALUE>[,<EXTRA_FLOAT_VALUE...]]
        (mutiple extras passed as Float[])
    [--efal <EXTRA_KEY> <EXTRA_FLOAT_VALUE>[,<EXTRA_FLOAT_VALUE...]]
        (mutiple extras passed as List<Float>)
    [--esa <EXTRA_KEY> <EXTRA_STRING_VALUE>[,<EXTRA_STRING_VALUE...]]
        (mutiple extras passed as String[]; to embed a comma into a string,
         escape it using "\,")
    [--esal <EXTRA_KEY> <EXTRA_STRING_VALUE>[,<EXTRA_STRING_VALUE...]]
        (mutiple extras passed as List<String>; to embed a comma into a string,
         escape it using "\,")
    [-f <FLAG>]
    [--grant-read-uri-permission] [--grant-write-uri-permission]
    [--grant-persistable-uri-permission] [--grant-prefix-uri-permission]
    [--debug-log-resolution] [--exclude-stopped-packages]
    [--include-stopped-packages]
    [--activity-brought-to-front] [--activity-clear-top]
    [--activity-clear-when-task-reset] [--activity-exclude-from-recents]
    [--activity-launched-from-history] [--activity-multiple-task]
    [--activity-no-animation] [--activity-no-history]
    [--activity-no-user-action] [--activity-previous-is-top]
    [--activity-reorder-to-front] [--activity-reset-task-if-needed]
    [--activity-single-top] [--activity-clear-task]
    [--activity-task-on-home]
    [--receiver-registered-only] [--receiver-replace-pending]
    [--receiver-foreground] [--receiver-no-abort]
    [--receiver-include-background]
    [--selector]
    [<URI> | <PACKAGE> | <COMPONENT>]

So we can pass in URI.
BUT we can pass one and only one URI, this is the limitation.
Haven't found the solution yet.
Basic on this log(custom log):

PlayerActivityTAG: C.WIDEVINE_UUID.toString() = edef8ba9-79d6-4ace-a3c8-27dcd51d21ed
PlayerActivityTAG: C.PLAYREADY_UUID.toString() = 9a04f079-9840-4286-ab92-e65be0885f95
PlayerActivityTAG: C.PLAYREADY_UUID.toString() = 9a04f079-9840-4286-ab92-e65be0885f95

We can run exoplayer with command:

am start -W -a com.google.android.exoplayer.demo.action.VIEW -c android.intent.category.DEFAULT \
-d "https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd" \
-e drm_scheme_uuid "edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" \
-e drm_license_url "https://proxy.uat.widevine.com/proxy?provider=widevine_test" \
-e extension "mpd" \
"com.google.android.exoplayer2.demo/com.google.android.exoplayer2.demo.PlayerActivity"

Or run mixed stream:

public static final String URI_LIST_EXTRA = "uri_list";
...
if (ACTION_VIEW.equals(action)) {
      uris = new Uri[]{intent.getData()};
      extensions = new String[]{intent.getStringExtra(EXTENSION_EXTRA)};
    } else if (ACTION_VIEW_LIST.equals(action)) {
      String[] uriStrings = intent.getStringArrayExtra(URI_LIST_EXTRA);
      uris = new Uri[uriStrings.length];
      for (int i = 0; i < uriStrings.length; i++) {
        uris[i] = Uri.parse(uriStrings[i]);
      }
      extensions = intent.getStringArrayExtra(EXTENSION_LIST_EXTRA);
      if (extensions == null) {
        extensions = new String[uriStrings.length];
}
am start -W -a com.google.android.exoplayer.demo.action.VIEW_LIST -c android.intent.category.DEFAULT \
--esa uri_list "https://html5demos.com/assets/dizzy.mp4"\,\
"https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears_sd.mpd"\,\
"https://html5demos.com/assets/dizzy.mp4"\,\
"https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears_sd.mpd"\,\
"https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears_sd.mpd" \
-e drm_scheme_uuid "edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" \
-e drm_license_url "https://proxy.uat.widevine.com/proxy?provider=widevine_test" \
"com.google.android.exoplayer2.demo/com.google.android.exoplayer2.demo.PlayerActivity"

相关文章

网友评论

    本文标题:Run exoplayer from command line

    本文链接:https://www.haomeiwen.com/subject/ydrwgxtx.html