From c0cad7f396891e67810c87a9debafa0c7b82fcff Mon Sep 17 00:00:00 2001 From: olly Date: Wed, 25 May 2016 03:49:23 -0700 Subject: [PATCH] Load demo app samples from json. Also handle .exolist.json links. This lets you put a list of samples somewhere (e.g. on the web). Clicking it opens the app and displays the samples it defines. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=123198928 --- demo/src/main/AndroidManifest.xml | 12 + .../src/main/assets/sample_media.exolist.json | 380 ++++++++++++++++++ .../exoplayer/demo/PlayerActivity.java | 1 - .../exoplayer/demo/SampleChooserActivity.java | 245 +++++++++-- .../android/exoplayer/demo/Samples.java | 297 -------------- .../demo/{ui => }/TrackSelectionHelper.java | 3 +- demo/src/main/res/values/strings.xml | 2 + 7 files changed, 598 insertions(+), 342 deletions(-) create mode 100644 demo/src/main/assets/sample_media.exolist.json delete mode 100644 demo/src/main/java/com/google/android/exoplayer/demo/Samples.java rename demo/src/main/java/com/google/android/exoplayer/demo/{ui => }/TrackSelectionHelper.java (99%) diff --git a/demo/src/main/AndroidManifest.xml b/demo/src/main/AndroidManifest.xml index 1d5e9605de..0c54dadcbf 100644 --- a/demo/src/main/AndroidManifest.xml +++ b/demo/src/main/AndroidManifest.xml @@ -38,6 +38,18 @@ + + + + + + + + + + + + sampleGroups = new ArrayList<>(); - SampleGroup group = new SampleGroup("YouTube DASH"); - group.addAll(Samples.YOUTUBE_DASH_MP4); - group.addAll(Samples.YOUTUBE_DASH_WEBM); - sampleGroups.add(group); - group = new SampleGroup("Widevine DASH Policy Tests (GTS)"); - group.addAll(Samples.WIDEVINE_GTS); - sampleGroups.add(group); - group = new SampleGroup("Widevine HDCP Capabilities Tests"); - group.addAll(Samples.WIDEVINE_HDCP); - sampleGroups.add(group); - group = new SampleGroup("Widevine DASH: MP4,H264"); - group.addAll(Samples.WIDEVINE_H264_MP4_CLEAR); - group.addAll(Samples.WIDEVINE_H264_MP4_SECURE); - sampleGroups.add(group); - group = new SampleGroup("Widevine DASH: WebM,VP9"); - group.addAll(Samples.WIDEVINE_VP9_WEBM_CLEAR); - group.addAll(Samples.WIDEVINE_VP9_WEBM_SECURE); - sampleGroups.add(group); - group = new SampleGroup("Widevine DASH: MP4,H265"); - group.addAll(Samples.WIDEVINE_H265_MP4_CLEAR); - group.addAll(Samples.WIDEVINE_H265_MP4_SECURE); - sampleGroups.add(group); - group = new SampleGroup("SmoothStreaming"); - group.addAll(Samples.SMOOTHSTREAMING); - sampleGroups.add(group); - group = new SampleGroup("HLS"); - group.addAll(Samples.HLS); - sampleGroups.add(group); - group = new SampleGroup("Misc"); - group.addAll(Samples.MISC); - sampleGroups.add(group); - group = new SampleGroup("Extensions"); - group.addAll(Samples.EXTENSION); - sampleGroups.add(group); + Intent intent = getIntent(); + String dataUri = intent.getDataString(); + String[] uris; + if (dataUri != null) { + uris = new String[] {dataUri}; + } else { + uris = new String[] { + "asset:///sample_media.exolist.json", + }; + } + SampleListLoader loaderTask = new SampleListLoader(); + loaderTask.execute(uris); + } + private void onSampleGroups(final List groups, boolean sawError) { + if (sawError) { + Toast.makeText(getApplicationContext(), R.string.sample_list_load_error, Toast.LENGTH_LONG) + .show(); + } ExpandableListView sampleList = (ExpandableListView) findViewById(R.id.sample_list); - sampleList.setAdapter(new SampleAdapter(this, sampleGroups)); + sampleList.setAdapter(new SampleAdapter(this, groups)); sampleList.setOnChildClickListener(new OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView parent, View view, int groupPosition, int childPosition, long id) { - onSampleSelected(sampleGroups.get(groupPosition).samples.get(childPosition)); + onSampleSelected(groups.get(groupPosition).samples.get(childPosition)); return true; } }); @@ -102,6 +100,150 @@ public class SampleChooserActivity extends Activity { startActivity(intent); } + private final class SampleListLoader extends AsyncTask> { + + private boolean sawError; + + @Override + protected List doInBackground(String... uris) { + List result = new ArrayList<>(); + Context context = getApplicationContext(); + String userAgent = Util.getUserAgent(context, "ExoPlayerDemo"); + DataSource dataSource = new DefaultDataSource(context, null, userAgent, false); + for (String uri : uris) { + DataSpec dataSpec = new DataSpec(Uri.parse(uri)); + InputStream inputStream = new DataSourceInputStream(dataSource, dataSpec); + try { + readSampleGroups(new JsonReader(new InputStreamReader(inputStream, "UTF-8")), result); + } catch (IOException e) { + Log.e(TAG, "Error loading sample list: " + uri, e); + sawError = true; + } finally { + Util.closeQuietly(dataSource); + } + } + return result; + } + + @Override + protected void onPostExecute(List result) { + onSampleGroups(result, sawError); + } + + private void readSampleGroups(JsonReader reader, List groups) throws IOException { + reader.beginArray(); + while (reader.hasNext()) { + readSampleGroup(reader, groups); + } + reader.endArray(); + } + + private void readSampleGroup(JsonReader reader, List groups) throws IOException { + String groupName = ""; + ArrayList samples = new ArrayList<>(); + + reader.beginObject(); + while (reader.hasNext()) { + switch (reader.nextName()) { + case "name": + groupName = reader.nextString(); + break; + case "samples": + reader.beginArray(); + while (reader.hasNext()) { + samples.add(readSample(reader)); + } + reader.endArray(); + break; + } + } + reader.endObject(); + + SampleGroup group = getGroup(groupName, groups); + group.samples.addAll(samples); + } + + private Sample readSample(JsonReader reader) throws IOException { + String sampleName = null; + String uri = null; + int type = Util.TYPE_OTHER; + UUID drmUuid = null; + String drmContentId = null; + String drmProvider = null; + boolean useExtensionDecoders = false; + + reader.beginObject(); + while (reader.hasNext()) { + switch (reader.nextName()) { + case "name": + sampleName = reader.nextString(); + break; + case "uri": + uri = reader.nextString(); + break; + case "type": + type = getType(reader.nextString()); + break; + case "drm": + String[] drmComponents = reader.nextString().split(":", -1); + drmUuid = getDrmUuid(drmComponents[0]); + drmContentId = drmComponents[1]; + drmProvider = drmComponents[2]; + break; + case "use_extension_decoders": + useExtensionDecoders = reader.nextBoolean(); + break; + } + } + reader.endObject(); + + if (sampleName == null || uri == null) { + throw new ParserException("Invalid sample (name or uri missing)"); + } + return new Sample(sampleName, uri, type, drmUuid, drmContentId, drmProvider, + useExtensionDecoders); + } + + private SampleGroup getGroup(String groupName, List groups) { + for (int i = 0; i < groups.size(); i++) { + if (Util.areEqual(groupName, groups.get(i).title)) { + return groups.get(i); + } + } + SampleGroup group = new SampleGroup(groupName); + groups.add(group); + return group; + } + + private UUID getDrmUuid(String typeString) throws ParserException { + switch (typeString.toLowerCase()) { + case "widevine": + return C.WIDEVINE_UUID; + case "playready": + return C.PLAYREADY_UUID; + default: + throw new ParserException("Unsupported drm type: " + typeString); + } + } + + private int getType(String typeString) { + if (typeString == null) { + return Util.TYPE_OTHER; + } + switch (typeString.toLowerCase()) { + case "dash": + return Util.TYPE_DASH; + case "smoothstreaming": + return Util.TYPE_SS; + case "hls": + return Util.TYPE_HLS; + default: + return Util.TYPE_OTHER; + } + } + + } + private static final class SampleAdapter extends BaseExpandableListAdapter { private final Context context; @@ -188,8 +330,27 @@ public class SampleChooserActivity extends Activity { this.samples = new ArrayList<>(); } - public void addAll(Sample[] samples) { - Collections.addAll(this.samples, samples); + } + + private static class Sample { + + public final String name; + public final String uri; + public final int type; + public final UUID drmSchemeUuid; + public final String drmContentId; + public final String drmProvider; + public final boolean useExtensionDecoders; + + public Sample(String name, String uri, int type, UUID drmSchemeUuid, String drmContentId, + String drmProvider, boolean useExtensionDecoders) { + this.name = name; + this.uri = uri; + this.type = type; + this.drmSchemeUuid = drmSchemeUuid; + this.drmContentId = drmContentId; + this.drmProvider = drmProvider; + this.useExtensionDecoders = useExtensionDecoders; } } diff --git a/demo/src/main/java/com/google/android/exoplayer/demo/Samples.java b/demo/src/main/java/com/google/android/exoplayer/demo/Samples.java deleted file mode 100644 index de21755770..0000000000 --- a/demo/src/main/java/com/google/android/exoplayer/demo/Samples.java +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright (C) 2014 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.google.android.exoplayer.demo; - -import com.google.android.exoplayer.C; -import com.google.android.exoplayer.util.Util; - -import java.util.UUID; - -/** - * Holds statically defined sample definitions. - */ -/* package */ final class Samples { - - public static class Sample { - - public final String name; - public final String uri; - public final int type; - public final UUID drmSchemeUuid; - public final String drmContentId; - public final String drmProvider; - public final boolean useExtensionDecoders; - - public static Sample newSample(String name, String uri, int type) { - return new Sample(name, uri, type, null, null, null, false); - } - - public static Sample newExtensionSample(String name, String uri, int type) { - return new Sample(name, uri, type, null, null, null, true); - } - - public static Sample newDrmProtectedSample(String name, String uri, int type, UUID drmScheme, - String drmContentId, String drmProvider) { - return new Sample(name, uri, type, drmScheme, drmContentId, drmProvider, false); - } - - private Sample(String name, String uri, int type, UUID drmSchemeUuid, String drmContentId, - String drmProvider, boolean useExtensionDecoders) { - this.name = name; - this.uri = uri; - this.type = type; - this.drmSchemeUuid = drmSchemeUuid; - this.drmContentId = drmContentId; - this.drmProvider = drmProvider; - this.useExtensionDecoders = useExtensionDecoders; - } - - } - - public static final Sample[] YOUTUBE_DASH_MP4 = new Sample[] { - Sample.newSample("Google Glass (MP4,H264)", - "http://www.youtube.com/api/manifest/dash/id/bf5bb2419360daf1/source/youtube?" - + "as=fmp4_audio_clear,fmp4_sd_hd_clear&sparams=ip,ipbits,expire,source,id,as&ip=0.0.0.0&" - + "ipbits=0&expire=19000000000&signature=51AF5F39AB0CEC3E5497CD9C900EBFEAECCCB5C7." - + "8506521BFC350652163895D4C26DEE124209AA9E&key=ik0", Util.TYPE_DASH), - Sample.newSample("Google Play (MP4,H264)", - "http://www.youtube.com/api/manifest/dash/id/3aa39fa2cc27967f/source/youtube?" - + "as=fmp4_audio_clear,fmp4_sd_hd_clear&sparams=ip,ipbits,expire,source,id,as&ip=0.0.0.0&" - + "ipbits=0&expire=19000000000&signature=A2716F75795F5D2AF0E88962FFCD10DB79384F29." - + "84308FF04844498CE6FBCE4731507882B8307798&key=ik0", Util.TYPE_DASH), - }; - - public static final Sample[] YOUTUBE_DASH_WEBM = new Sample[] { - Sample.newSample("Google Glass (WebM,VP9)", - "http://www.youtube.com/api/manifest/dash/id/bf5bb2419360daf1/source/youtube?" - + "as=fmp4_audio_clear,webm2_sd_hd_clear&sparams=ip,ipbits,expire,source,id,as&ip=0.0.0.0&" - + "ipbits=0&expire=19000000000&signature=249B04F79E984D7F86B4D8DB48AE6FAF41C17AB3." - + "7B9F0EC0505E1566E59B8E488E9419F253DDF413&key=ik0", Util.TYPE_DASH), - Sample.newSample("Google Play (WebM,VP9)", - "http://www.youtube.com/api/manifest/dash/id/3aa39fa2cc27967f/source/youtube?" - + "as=fmp4_audio_clear,webm2_sd_hd_clear&sparams=ip,ipbits,expire,source,id,as&ip=0.0.0.0&" - + "ipbits=0&expire=19000000000&signature=B1C2A74783AC1CC4865EB312D7DD2D48230CC9FD." - + "BD153B9882175F1F94BFE5141A5482313EA38E8D&key=ik0", Util.TYPE_DASH), - }; - - public static final Sample[] SMOOTHSTREAMING = new Sample[] { - Sample.newSample("Super speed", - "http://playready.directtaps.net/smoothstreaming/SSWSS720H264/SuperSpeedway_720.ism", - Util.TYPE_SS), - Sample.newDrmProtectedSample("Super speed (PlayReady)", - "http://playready.directtaps.net/smoothstreaming/SSWSS720H264PR/SuperSpeedway_720.ism", - Util.TYPE_SS, C.PLAYREADY_UUID, null, null), - }; - - private static final String WIDEVINE_GTS_H264_MPD = - "https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd"; - private static final String WIDEVINE_GTS_VP9_MPD = - "https://storage.googleapis.com/wvmedia/cenc/vp9/tears/tears.mpd"; - private static final String WIDEVINE_GTS_H265_MPD = - "https://storage.googleapis.com/wvmedia/cenc/hevc/tears/tears.mpd"; - public static final Sample[] WIDEVINE_GTS = new Sample[] { - Sample.newDrmProtectedSample("WV: HDCP not specified", WIDEVINE_GTS_H264_MPD, Util.TYPE_DASH, - C.WIDEVINE_UUID, "d286538032258a1c", "widevine_test"), - Sample.newDrmProtectedSample("WV: HDCP not required", WIDEVINE_GTS_H264_MPD, Util.TYPE_DASH, - C.WIDEVINE_UUID, "48fcc369939ac96c", "widevine_test"), - Sample.newDrmProtectedSample("WV: HDCP required", WIDEVINE_GTS_H264_MPD, Util.TYPE_DASH, - C.WIDEVINE_UUID, "e06c39f1151da3df", "widevine_test"), - Sample.newDrmProtectedSample("WV: Secure video path required (MP4,H264)", WIDEVINE_GTS_H264_MPD, - Util.TYPE_DASH, C.WIDEVINE_UUID, "0894c7c8719b28a0", "widevine_test"), - Sample.newDrmProtectedSample("WV: Secure video path required (WebM,VP9)", WIDEVINE_GTS_VP9_MPD, - Util.TYPE_DASH, C.WIDEVINE_UUID, "0894c7c8719b28a0", "widevine_test"), - Sample.newDrmProtectedSample("WV: Secure video path required (MP4,H265)", WIDEVINE_GTS_H265_MPD, - Util.TYPE_DASH, C.WIDEVINE_UUID, "0894c7c8719b28a0", "widevine_test"), - Sample.newDrmProtectedSample("WV: HDCP + secure video path required", WIDEVINE_GTS_H264_MPD, - Util.TYPE_DASH, C.WIDEVINE_UUID, "efd045b1eb61888a", "widevine_test"), - Sample.newDrmProtectedSample("WV: 30s license duration (fails at ~30s)", WIDEVINE_GTS_H264_MPD, - Util.TYPE_DASH, C.WIDEVINE_UUID, "f9a34cab7b05881a", "widevine_test"), - }; - - public static final Sample[] WIDEVINE_HDCP = new Sample[] { - Sample.newDrmProtectedSample("WV: HDCP: None (not required)", WIDEVINE_GTS_H264_MPD, - Util.TYPE_DASH, C.WIDEVINE_UUID, "HDCP_None", "widevine_test"), - Sample.newDrmProtectedSample("WV: HDCP: 1.0 required", WIDEVINE_GTS_H264_MPD, Util.TYPE_DASH, - C.WIDEVINE_UUID, "HDCP_V1", "widevine_test"), - Sample.newDrmProtectedSample("WV: HDCP: 2.0 required", WIDEVINE_GTS_H264_MPD, Util.TYPE_DASH, - C.WIDEVINE_UUID, "HDCP_V2", "widevine_test"), - Sample.newDrmProtectedSample("WV: HDCP: 2.1 required", WIDEVINE_GTS_H264_MPD, Util.TYPE_DASH, - C.WIDEVINE_UUID, "HDCP_V2_1", "widevine_test"), - Sample.newDrmProtectedSample("WV: HDCP: 2.2 required", WIDEVINE_GTS_H264_MPD, Util.TYPE_DASH, - C.WIDEVINE_UUID, "HDCP_V2_2", "widevine_test"), - Sample.newDrmProtectedSample("WV: HDCP: No digital output", WIDEVINE_GTS_H264_MPD, - Util.TYPE_DASH, C.WIDEVINE_UUID, "HDCP_NO_DIGTAL_OUTPUT", "widevine_test"), - }; - - public static final Sample[] WIDEVINE_H264_MP4_CLEAR = new Sample[] { - Sample.newSample("WV: Clear SD & HD (MP4,H264)", - "https://storage.googleapis.com/wvmedia/clear/h264/tears/tears.mpd", - Util.TYPE_DASH), - Sample.newSample("WV: Clear SD (MP4,H264)", - "https://storage.googleapis.com/wvmedia/clear/h264/tears/tears_sd.mpd", - Util.TYPE_DASH), - Sample.newSample("WV: Clear HD (MP4,H264)", - "https://storage.googleapis.com/wvmedia/clear/h264/tears/tears_hd.mpd", - Util.TYPE_DASH), - Sample.newSample("WV: Clear UHD (MP4,H264)", - "https://storage.googleapis.com/wvmedia/clear/h264/tears/tears_uhd.mpd", - Util.TYPE_DASH), - }; - - public static final Sample[] WIDEVINE_H264_MP4_SECURE = new Sample[] { - Sample.newDrmProtectedSample("WV: Secure SD & HD (MP4,H264)", WIDEVINE_GTS_H264_MPD, - Util.TYPE_DASH, C.WIDEVINE_UUID, "", "widevine_test"), - Sample.newDrmProtectedSample("WV: Secure SD (MP4,H264)", - "https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears_sd.mpd", Util.TYPE_DASH, - C.WIDEVINE_UUID, "", "widevine_test"), - Sample.newDrmProtectedSample("WV: Secure HD (MP4,H264)", - "https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears_hd.mpd", Util.TYPE_DASH, - C.WIDEVINE_UUID, "", "widevine_test"), - Sample.newDrmProtectedSample("WV: Secure UHD (MP4,H264)", - "https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears_uhd.mpd", Util.TYPE_DASH, - C.WIDEVINE_UUID, "", "widevine_test"), - }; - - public static final Sample[] WIDEVINE_VP9_WEBM_CLEAR = new Sample[] { - Sample.newSample("WV: Clear SD & HD (WebM,VP9)", - "https://storage.googleapis.com/wvmedia/clear/vp9/tears/tears.mpd", - Util.TYPE_DASH), - Sample.newSample("WV: Clear SD (WebM,VP9)", - "https://storage.googleapis.com/wvmedia/clear/vp9/tears/tears_sd.mpd", - Util.TYPE_DASH), - Sample.newSample("WV: Clear HD (WebM,VP9)", - "https://storage.googleapis.com/wvmedia/clear/vp9/tears/tears_hd.mpd", - Util.TYPE_DASH), - Sample.newSample("WV: Clear UHD (WebM,VP9)", - "https://storage.googleapis.com/wvmedia/clear/vp9/tears/tears_uhd.mpd", - Util.TYPE_DASH), - }; - - public static final Sample[] WIDEVINE_VP9_WEBM_SECURE = new Sample[] { - Sample.newDrmProtectedSample("WV: Secure SD & HD (WebM,VP9)", WIDEVINE_GTS_VP9_MPD, - Util.TYPE_DASH, C.WIDEVINE_UUID, "", "widevine_test"), - Sample.newDrmProtectedSample("WV: Secure SD (WebM,VP9)", - "https://storage.googleapis.com/wvmedia/cenc/vp9/tears/tears_sd.mpd", Util.TYPE_DASH, - C.WIDEVINE_UUID, "", "widevine_test"), - Sample.newDrmProtectedSample("WV: Secure HD (WebM,VP9)", - "https://storage.googleapis.com/wvmedia/cenc/vp9/tears/tears_hd.mpd", Util.TYPE_DASH, - C.WIDEVINE_UUID, "", "widevine_test"), - Sample.newDrmProtectedSample("WV: Secure UHD (WebM,VP9)", - "https://storage.googleapis.com/wvmedia/cenc/vp9/tears/tears_uhd.mpd", Util.TYPE_DASH, - C.WIDEVINE_UUID, "", "widevine_test"), - }; - - public static final Sample[] WIDEVINE_H265_MP4_CLEAR = new Sample[] { - Sample.newSample("WV: Clear SD & HD (MP4,H265)", - "https://storage.googleapis.com/wvmedia/clear/hevc/tears/tears.mpd", - Util.TYPE_DASH), - Sample.newSample("WV: Clear SD (MP4,H265)", - "https://storage.googleapis.com/wvmedia/clear/hevc/tears/tears_sd.mpd", - Util.TYPE_DASH), - Sample.newSample("WV: Clear HD (MP4,H265)", - "https://storage.googleapis.com/wvmedia/clear/hevc/tears/tears_hd.mpd", - Util.TYPE_DASH), - Sample.newSample("WV: Clear UHD (MP4,H265)", - "https://storage.googleapis.com/wvmedia/clear/hevc/tears/tears_uhd.mpd", - Util.TYPE_DASH), - }; - - public static final Sample[] WIDEVINE_H265_MP4_SECURE = new Sample[] { - Sample.newDrmProtectedSample("WV: Secure SD & HD (MP4,H265)", WIDEVINE_GTS_H265_MPD, - Util.TYPE_DASH, C.WIDEVINE_UUID, "", "widevine_test"), - Sample.newDrmProtectedSample("WV: Secure SD (MP4,H265)", - "https://storage.googleapis.com/wvmedia/cenc/hevc/tears/tears_sd.mpd", Util.TYPE_DASH, - C.WIDEVINE_UUID, "", "widevine_test"), - Sample.newDrmProtectedSample("WV: Secure HD (MP4,H265)", - "https://storage.googleapis.com/wvmedia/cenc/hevc/tears/tears_hd.mpd", Util.TYPE_DASH, - C.WIDEVINE_UUID, "", "widevine_test"), - Sample.newDrmProtectedSample("WV: Secure UHD (MP4,H265)", - "https://storage.googleapis.com/wvmedia/cenc/hevc/tears/tears_uhd.mpd", Util.TYPE_DASH, - C.WIDEVINE_UUID, "", "widevine_test"), - }; - - public static final Sample[] HLS = new Sample[] { - Sample.newSample("Apple master playlist", - "https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/" - + "bipbop_4x3_variant.m3u8", Util.TYPE_HLS), - Sample.newSample("Apple master playlist advanced", - "https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/" - + "bipbop_16x9_variant.m3u8", Util.TYPE_HLS), - Sample.newSample("Apple TS media playlist", - "https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear1/" - + "prog_index.m3u8", Util.TYPE_HLS), - Sample.newSample("Apple AAC media playlist", - "https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear0/" - + "prog_index.m3u8", Util.TYPE_HLS), - Sample.newSample("Apple ID3 metadata", "http://devimages.apple.com/samplecode/adDemo/ad.m3u8", - Util.TYPE_HLS), - }; - - public static final Sample[] MISC = new Sample[] { - Sample.newSample("Dizzy", "http://html5demos.com/assets/dizzy.mp4", Util.TYPE_OTHER), - Sample.newSample("Apple AAC 10s", "https://devimages.apple.com.edgekey.net/" - + "streaming/examples/bipbop_4x3/gear0/fileSequence0.aac", Util.TYPE_OTHER), - Sample.newSample("Apple TS 10s", "https://devimages.apple.com.edgekey.net/streaming/examples/" - + "bipbop_4x3/gear1/fileSequence0.ts", Util.TYPE_OTHER), - Sample.newSample("Android screens (Matroska)", "http://storage.googleapis.com/exoplayer-test-me" - + "dia-1/mkv/android-screens-lavf-56.36.100-aac-avc-main-1280x720.mkv", Util.TYPE_OTHER), - Sample.newSample("Big Buck Bunny (MP4 Video)", - "http://redirector.c.youtube.com/videoplayback?id=604ed5ce52eda7ee&itag=22&source=youtube&" - + "sparams=ip,ipbits,expire,source,id&ip=0.0.0.0&ipbits=0&expire=19000000000&signature=" - + "513F28C7FDCBEC60A66C86C9A393556C99DC47FB.04C88036EEE12565A1ED864A875A58F15D8B5300" - + "&key=ik0", Util.TYPE_OTHER), - Sample.newSample("Screens 360P (WebM,VP9,No Audio)", - "https://storage.googleapis.com/exoplayer-test-media-1/gen-3/screens/dash-vod-single-segmen" - + "t/video-vp9-360.webm", Util.TYPE_OTHER), - Sample.newSample("Screens 480p (FMP4,H264,No Audio)", - "https://storage.googleapis.com/exoplayer-test-media-1/gen-3/screens/dash-vod-single-segmen" - + "t/video-avc-baseline-480.mp4", Util.TYPE_OTHER), - Sample.newSample("Screens 1080p (FMP4,H264, No Audio)", - "https://storage.googleapis.com/exoplayer-test-media-1/gen-3/screens/dash-vod-single-segmen" - + "t/video-137.mp4", Util.TYPE_OTHER), - Sample.newSample("Screens (FMP4,AAC Audio)", - "https://storage.googleapis.com/exoplayer-test-media-1/gen-3/screens/dash-vod-single-segmen" - + "t/audio-141.mp4", Util.TYPE_OTHER), - Sample.newSample("Google Play (MP3 Audio)", - "http://storage.googleapis.com/exoplayer-test-media-0/play.mp3", Util.TYPE_OTHER), - Sample.newSample("Google Play (Ogg/Vorbis Audio)", - "https://storage.googleapis.com/exoplayer-test-media-1/ogg/play.ogg", Util.TYPE_OTHER), - Sample.newSample("Google Glass (WebM Video with Vorbis Audio)", - "http://demos.webmproject.org/exoplayer/glass_vp9_vorbis.webm", Util.TYPE_OTHER), - Sample.newSample("Google Glass (VP9 in MP4/ISO-BMFF)", - "http://demos.webmproject.org/exoplayer/glass.mp4", Util.TYPE_OTHER), - Sample.newSample("Google Glass DASH - VP9 and Opus", - "http://demos.webmproject.org/dash/201410/vp9_glass/manifest_vp9_opus.mpd", - Util.TYPE_DASH), - Sample.newSample("Big Buck Bunny (FLV Video)", - "http://vod.leasewebcdn.com/bbb.flv?ri=1024&rs=150&start=0", Util.TYPE_OTHER), - }; - - public static final Sample[] EXTENSION = new Sample[] { - Sample.newExtensionSample("Google Glass DASH - VP9 Only", - "http://demos.webmproject.org/dash/201410/vp9_glass/manifest_vp9.mpd", - Util.TYPE_DASH), - Sample.newExtensionSample("Google Glass DASH - VP9 and Vorbis", - "http://demos.webmproject.org/dash/201410/vp9_glass/manifest_vp9_vorbis.mpd", - Util.TYPE_DASH), - Sample.newExtensionSample("Google Glass DASH - VP9 and Opus", - "http://demos.webmproject.org/dash/201410/vp9_glass/manifest_vp9_opus.mpd", - Util.TYPE_DASH), - }; - - private Samples() {} - -} diff --git a/demo/src/main/java/com/google/android/exoplayer/demo/ui/TrackSelectionHelper.java b/demo/src/main/java/com/google/android/exoplayer/demo/TrackSelectionHelper.java similarity index 99% rename from demo/src/main/java/com/google/android/exoplayer/demo/ui/TrackSelectionHelper.java rename to demo/src/main/java/com/google/android/exoplayer/demo/TrackSelectionHelper.java index a7259546bf..4f29f37a33 100644 --- a/demo/src/main/java/com/google/android/exoplayer/demo/ui/TrackSelectionHelper.java +++ b/demo/src/main/java/com/google/android/exoplayer/demo/TrackSelectionHelper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.google.android.exoplayer.demo.ui; +package com.google.android.exoplayer.demo; import com.google.android.exoplayer.DefaultTrackSelector; import com.google.android.exoplayer.DefaultTrackSelector.TrackInfo; @@ -22,7 +22,6 @@ import com.google.android.exoplayer.TrackGroup; import com.google.android.exoplayer.TrackGroupArray; import com.google.android.exoplayer.TrackRenderer; import com.google.android.exoplayer.TrackSelection; -import com.google.android.exoplayer.demo.R; import com.google.android.exoplayer.util.MimeTypes; import android.annotation.SuppressLint; diff --git a/demo/src/main/res/values/strings.xml b/demo/src/main/res/values/strings.xml index bb3d45103d..7ca3229f7d 100644 --- a/demo/src/main/res/values/strings.xml +++ b/demo/src/main/res/values/strings.xml @@ -49,4 +49,6 @@ Permission to access storage was denied + One or more sample lists failed to load +