mirror of
https://github.com/samsonjs/media.git
synced 2026-03-29 10:05:48 +00:00
Don't require samples to specify whether they're encrypted.
This wasn't actually used for anything other than showing a toast, which is now generated based on the manifest instead.
This commit is contained in:
parent
099bbe048f
commit
ae55b12bd8
6 changed files with 51 additions and 41 deletions
|
|
@ -18,7 +18,6 @@ package com.google.android.exoplayer.demo;
|
|||
import com.google.android.exoplayer.demo.Samples.Sample;
|
||||
import com.google.android.exoplayer.demo.full.FullPlayerActivity;
|
||||
import com.google.android.exoplayer.demo.simple.SimplePlayerActivity;
|
||||
import com.google.android.exoplayer.util.Util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
|
@ -33,7 +32,6 @@ import android.widget.AdapterView.OnItemClickListener;
|
|||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* An activity for selecting from a number of samples.
|
||||
|
|
@ -76,11 +74,6 @@ public class SampleChooserActivity extends Activity {
|
|||
}
|
||||
|
||||
private void onSampleSelected(Sample sample) {
|
||||
if (Util.SDK_INT < 18 && sample.isEncypted) {
|
||||
Toast.makeText(getApplicationContext(), R.string.drm_not_supported, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
return;
|
||||
}
|
||||
Class<?> playerActivityClass = sample.fullPlayer ? FullPlayerActivity.class
|
||||
: SimplePlayerActivity.class;
|
||||
Intent mpdIntent = new Intent(this, playerActivityClass)
|
||||
|
|
|
|||
|
|
@ -26,16 +26,13 @@ package com.google.android.exoplayer.demo;
|
|||
public final String contentId;
|
||||
public final String uri;
|
||||
public final int type;
|
||||
public final boolean isEncypted;
|
||||
public final boolean fullPlayer;
|
||||
|
||||
public Sample(String name, String contentId, String uri, int type, boolean isEncrypted,
|
||||
boolean fullPlayer) {
|
||||
public Sample(String name, String contentId, String uri, int type, boolean fullPlayer) {
|
||||
this.name = name;
|
||||
this.contentId = contentId;
|
||||
this.uri = uri;
|
||||
this.type = type;
|
||||
this.isEncypted = isEncrypted;
|
||||
this.fullPlayer = fullPlayer;
|
||||
}
|
||||
|
||||
|
|
@ -46,19 +43,17 @@ package com.google.android.exoplayer.demo;
|
|||
"http://www.youtube.com/api/manifest/dash/id/bf5bb2419360daf1/source/youtube?"
|
||||
+ "as=fmp4_audio_clear,fmp4_sd_hd_clear&sparams=ip,ipbits,expire,as&ip=0.0.0.0&"
|
||||
+ "ipbits=0&expire=19000000000&signature=255F6B3C07C753C88708C07EA31B7A1A10703C8D."
|
||||
+ "2D6A28B21F921D0B245CDCF36F7EB54A2B5ABFC2&key=ik0", DemoUtil.TYPE_DASH, false,
|
||||
false),
|
||||
+ "2D6A28B21F921D0B245CDCF36F7EB54A2B5ABFC2&key=ik0", DemoUtil.TYPE_DASH, false),
|
||||
new Sample("Google Play (DASH)", "3aa39fa2cc27967f",
|
||||
"http://www.youtube.com/api/manifest/dash/id/3aa39fa2cc27967f/source/youtube?"
|
||||
+ "as=fmp4_audio_clear,fmp4_sd_hd_clear&sparams=ip,ipbits,expire,as&ip=0.0.0.0&ipbits=0&"
|
||||
+ "expire=19000000000&signature=7181C59D0252B285D593E1B61D985D5B7C98DE2A."
|
||||
+ "5B445837F55A40E0F28AACAA047982E372D177E2&key=ik0", DemoUtil.TYPE_DASH, false,
|
||||
false),
|
||||
+ "5B445837F55A40E0F28AACAA047982E372D177E2&key=ik0", DemoUtil.TYPE_DASH, false),
|
||||
new Sample("Super speed (SmoothStreaming)", "uid:ss:superspeed",
|
||||
"http://playready.directtaps.net/smoothstreaming/SSWSS720H264/SuperSpeedway_720.ism",
|
||||
DemoUtil.TYPE_SS, false, false),
|
||||
DemoUtil.TYPE_SS, false),
|
||||
new Sample("Dizzy (Misc)", "uid:misc:dizzy",
|
||||
"http://html5demos.com/assets/dizzy.mp4", DemoUtil.TYPE_OTHER, false, false),
|
||||
"http://html5demos.com/assets/dizzy.mp4", DemoUtil.TYPE_OTHER, false),
|
||||
};
|
||||
|
||||
public static final Sample[] YOUTUBE_DASH_MP4 = new Sample[] {
|
||||
|
|
@ -66,14 +61,12 @@ package com.google.android.exoplayer.demo;
|
|||
"http://www.youtube.com/api/manifest/dash/id/bf5bb2419360daf1/source/youtube?"
|
||||
+ "as=fmp4_audio_clear,fmp4_sd_hd_clear&sparams=ip,ipbits,expire,as&ip=0.0.0.0&"
|
||||
+ "ipbits=0&expire=19000000000&signature=255F6B3C07C753C88708C07EA31B7A1A10703C8D."
|
||||
+ "2D6A28B21F921D0B245CDCF36F7EB54A2B5ABFC2&key=ik0", DemoUtil.TYPE_DASH, false,
|
||||
true),
|
||||
+ "2D6A28B21F921D0B245CDCF36F7EB54A2B5ABFC2&key=ik0", DemoUtil.TYPE_DASH, true),
|
||||
new Sample("Google Play", "3aa39fa2cc27967f",
|
||||
"http://www.youtube.com/api/manifest/dash/id/3aa39fa2cc27967f/source/youtube?"
|
||||
+ "as=fmp4_audio_clear,fmp4_sd_hd_clear&sparams=ip,ipbits,expire,as&ip=0.0.0.0&ipbits=0&"
|
||||
+ "expire=19000000000&signature=7181C59D0252B285D593E1B61D985D5B7C98DE2A."
|
||||
+ "5B445837F55A40E0F28AACAA047982E372D177E2&key=ik0", DemoUtil.TYPE_DASH, false,
|
||||
true),
|
||||
+ "5B445837F55A40E0F28AACAA047982E372D177E2&key=ik0", DemoUtil.TYPE_DASH, true),
|
||||
};
|
||||
|
||||
public static final Sample[] YOUTUBE_DASH_WEBM = new Sample[] {
|
||||
|
|
@ -81,21 +74,21 @@ package com.google.android.exoplayer.demo;
|
|||
"http://www.youtube.com/api/manifest/dash/id/bf5bb2419360daf1/source/youtube?"
|
||||
+ "as=fmp4_audio_clear,webm2_sd_hd_clear&sparams=ip,ipbits,expire,as&ip=0.0.0.0&ipbits=0&"
|
||||
+ "expire=19000000000&signature=A3EC7EE53ABE601B357F7CAB8B54AD0702CA85A7."
|
||||
+ "446E9C38E47E3EDAF39E0163C390FF83A7944918&key=ik0", DemoUtil.TYPE_DASH, false, true),
|
||||
+ "446E9C38E47E3EDAF39E0163C390FF83A7944918&key=ik0", DemoUtil.TYPE_DASH, true),
|
||||
new Sample("Google Play", "3aa39fa2cc27967f",
|
||||
"http://www.youtube.com/api/manifest/dash/id/3aa39fa2cc27967f/source/youtube?"
|
||||
+ "as=fmp4_audio_clear,webm2_sd_hd_clear&sparams=ip,ipbits,expire,as&ip=0.0.0.0&ipbits=0&"
|
||||
+ "expire=19000000000&signature=B752B262C6D7262EC4E4EB67901E5D8F7058A81D."
|
||||
+ "C0358CE1E335417D9A8D88FF192F0D5D8F6DA1B6&key=ik0", DemoUtil.TYPE_DASH, false, true),
|
||||
+ "C0358CE1E335417D9A8D88FF192F0D5D8F6DA1B6&key=ik0", DemoUtil.TYPE_DASH, true),
|
||||
};
|
||||
|
||||
public static final Sample[] SMOOTHSTREAMING = new Sample[] {
|
||||
new Sample("Super speed", "uid:ss:superspeed",
|
||||
"http://playready.directtaps.net/smoothstreaming/SSWSS720H264/SuperSpeedway_720.ism",
|
||||
DemoUtil.TYPE_SS, false, true),
|
||||
DemoUtil.TYPE_SS, true),
|
||||
new Sample("Super speed (PlayReady)", "uid:ss:pr:superspeed",
|
||||
"http://playready.directtaps.net/smoothstreaming/SSWSS720H264PR/SuperSpeedway_720.ism",
|
||||
DemoUtil.TYPE_SS, true, true),
|
||||
DemoUtil.TYPE_SS, true),
|
||||
};
|
||||
|
||||
public static final Sample[] WIDEVINE_GTS = new Sample[] {
|
||||
|
|
@ -103,42 +96,42 @@ package com.google.android.exoplayer.demo;
|
|||
"http://www.youtube.com/api/manifest/dash/id/d286538032258a1c/source/youtube?"
|
||||
+ "as=fmp4_audio_cenc,fmp4_sd_hd_cenc&sparams=ip,ipbits,expire,as&ip=0.0.0.0&ipbits=0"
|
||||
+ "&expire=19000000000&signature=41EA40A027A125A16292E0A5E3277A3B5FA9B938."
|
||||
+ "0BB075C396FFDDC97E526E8F77DC26FF9667D0D6&key=ik0", DemoUtil.TYPE_DASH, true, true),
|
||||
+ "0BB075C396FFDDC97E526E8F77DC26FF9667D0D6&key=ik0", DemoUtil.TYPE_DASH, true),
|
||||
new Sample("WV: HDCP not required", "48fcc369939ac96c",
|
||||
"http://www.youtube.com/api/manifest/dash/id/48fcc369939ac96c/source/youtube?"
|
||||
+ "as=fmp4_audio_cenc,fmp4_sd_hd_cenc&sparams=ip,ipbits,expire,as&ip=0.0.0.0&ipbits=0"
|
||||
+ "&expire=19000000000&signature=315911BDCEED0FB0C763455BDCC97449DAAFA9E8."
|
||||
+ "5B41E2EB411F797097A359D6671D2CDE26272373&key=ik0", DemoUtil.TYPE_DASH, true, true),
|
||||
+ "5B41E2EB411F797097A359D6671D2CDE26272373&key=ik0", DemoUtil.TYPE_DASH, true),
|
||||
new Sample("WV: HDCP required", "e06c39f1151da3df",
|
||||
"http://www.youtube.com/api/manifest/dash/id/e06c39f1151da3df/source/youtube?"
|
||||
+ "as=fmp4_audio_cenc,fmp4_sd_hd_cenc&sparams=ip,ipbits,expire,as&ip=0.0.0.0&ipbits=0"
|
||||
+ "&expire=19000000000&signature=A47A1E13E7243BD567601A75F79B34644D0DC592."
|
||||
+ "B09589A34FA23527EFC1552907754BB8033870BD&key=ik0", DemoUtil.TYPE_DASH, true, true),
|
||||
+ "B09589A34FA23527EFC1552907754BB8033870BD&key=ik0", DemoUtil.TYPE_DASH, true),
|
||||
new Sample("WV: Secure video path required", "0894c7c8719b28a0",
|
||||
"http://www.youtube.com/api/manifest/dash/id/0894c7c8719b28a0/source/youtube?"
|
||||
+ "as=fmp4_audio_cenc,fmp4_sd_hd_cenc&sparams=ip,ipbits,expire,as&ip=0.0.0.0&ipbits=0"
|
||||
+ "&expire=19000000000&signature=2847EE498970F6B45176766CD2802FEB4D4CB7B2."
|
||||
+ "A1CA51EC40A1C1039BA800C41500DD448C03EEDA&key=ik0", DemoUtil.TYPE_DASH, true, true),
|
||||
+ "A1CA51EC40A1C1039BA800C41500DD448C03EEDA&key=ik0", DemoUtil.TYPE_DASH, true),
|
||||
new Sample("WV: HDCP + secure video path required", "efd045b1eb61888a",
|
||||
"http://www.youtube.com/api/manifest/dash/id/efd045b1eb61888a/source/youtube?"
|
||||
+ "as=fmp4_audio_cenc,fmp4_sd_hd_cenc&sparams=ip,ipbits,expire,as&ip=0.0.0.0&ipbits=0"
|
||||
+ "&expire=19000000000&signature=61611F115EEEC7BADE5536827343FFFE2D83D14F."
|
||||
+ "2FDF4BFA502FB5865C5C86401314BDDEA4799BD0&key=ik0", DemoUtil.TYPE_DASH, true, true),
|
||||
+ "2FDF4BFA502FB5865C5C86401314BDDEA4799BD0&key=ik0", DemoUtil.TYPE_DASH, true),
|
||||
new Sample("WV: 30s license duration", "f9a34cab7b05881a",
|
||||
"http://www.youtube.com/api/manifest/dash/id/f9a34cab7b05881a/source/youtube?"
|
||||
+ "as=fmp4_audio_cenc,fmp4_sd_hd_cenc&sparams=ip,ipbits,expire,as&ip=0.0.0.0&ipbits=0"
|
||||
+ "&expire=19000000000&signature=88DC53943385CED8CF9F37ADD9E9843E3BF621E6."
|
||||
+ "22727BB612D24AA4FACE4EF62726F9461A9BF57A&key=ik0", DemoUtil.TYPE_DASH, true, true),
|
||||
+ "22727BB612D24AA4FACE4EF62726F9461A9BF57A&key=ik0", DemoUtil.TYPE_DASH, true),
|
||||
};
|
||||
|
||||
public static final Sample[] MISC = new Sample[] {
|
||||
new Sample("Dizzy", "uid:misc:dizzy", "http://html5demos.com/assets/dizzy.mp4",
|
||||
DemoUtil.TYPE_OTHER, false, true),
|
||||
DemoUtil.TYPE_OTHER, true),
|
||||
new Sample("Dizzy (https->http redirect)", "uid:misc:dizzy2", "https://goo.gl/MtUDEj",
|
||||
DemoUtil.TYPE_OTHER, false, true),
|
||||
DemoUtil.TYPE_OTHER, true),
|
||||
new Sample("Apple AAC 10s", "uid:misc:appleaacseg", "https://devimages.apple.com.edgekey.net/"
|
||||
+ "streaming/examples/bipbop_4x3/gear0/fileSequence0.aac",
|
||||
DemoUtil.TYPE_OTHER, false, true),
|
||||
DemoUtil.TYPE_OTHER, true),
|
||||
};
|
||||
|
||||
private Samples() {}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import com.google.android.exoplayer.demo.full.player.DefaultRendererBuilder;
|
|||
import com.google.android.exoplayer.demo.full.player.DemoPlayer;
|
||||
import com.google.android.exoplayer.demo.full.player.DemoPlayer.RendererBuilder;
|
||||
import com.google.android.exoplayer.demo.full.player.SmoothStreamingRendererBuilder;
|
||||
import com.google.android.exoplayer.demo.full.player.UnsupportedDrmException;
|
||||
import com.google.android.exoplayer.text.CaptionStyleCompat;
|
||||
import com.google.android.exoplayer.text.SubtitleView;
|
||||
import com.google.android.exoplayer.util.Util;
|
||||
|
|
@ -52,6 +53,7 @@ import android.widget.MediaController;
|
|||
import android.widget.PopupMenu;
|
||||
import android.widget.PopupMenu.OnMenuItemClickListener;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* An activity that plays media using {@link DemoPlayer}.
|
||||
|
|
@ -256,6 +258,16 @@ public class FullPlayerActivity extends Activity implements SurfaceHolder.Callba
|
|||
|
||||
@Override
|
||||
public void onError(Exception e) {
|
||||
if (e instanceof UnsupportedDrmException) {
|
||||
// Special case DRM failures.
|
||||
UnsupportedDrmException unsupportedDrmException = (UnsupportedDrmException) e;
|
||||
int stringId = unsupportedDrmException.reason == UnsupportedDrmException.REASON_NO_DRM
|
||||
? R.string.drm_error_not_supported
|
||||
: unsupportedDrmException.reason == UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME
|
||||
? R.string.drm_error_unsupported_scheme
|
||||
: R.string.drm_error_unknown;
|
||||
Toast.makeText(getApplicationContext(), stringId, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
playerNeedsPrepare = true;
|
||||
updateButtonVisibilities();
|
||||
showControls();
|
||||
|
|
|
|||
|
|
@ -144,8 +144,8 @@ public class DashRendererBuilder implements RendererBuilder,
|
|||
DrmSessionManager drmSessionManager = null;
|
||||
if (hasContentProtection) {
|
||||
if (Util.SDK_INT < 18) {
|
||||
callback.onRenderersError(new UnsupportedOperationException(
|
||||
"Protected content not supported on API level " + Util.SDK_INT));
|
||||
callback.onRenderersError(
|
||||
new UnsupportedDrmException(UnsupportedDrmException.REASON_NO_DRM));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
|
@ -155,8 +155,12 @@ public class DashRendererBuilder implements RendererBuilder,
|
|||
// HD streams require L1 security.
|
||||
filterHdContent = videoAdaptationSet != null && videoAdaptationSet.hasContentProtection()
|
||||
&& !drmSessionManagerData.second;
|
||||
} catch (UnsupportedSchemeException e) {
|
||||
callback.onRenderersError(
|
||||
new UnsupportedDrmException(UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME, e));
|
||||
} catch (Exception e) {
|
||||
callback.onRenderersError(e);
|
||||
callback.onRenderersError(
|
||||
new UnsupportedDrmException(UnsupportedDrmException.REASON_UNKNOWN, e));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,15 +111,19 @@ public class SmoothStreamingRendererBuilder implements RendererBuilder,
|
|||
DrmSessionManager drmSessionManager = null;
|
||||
if (manifest.protectionElement != null) {
|
||||
if (Util.SDK_INT < 18) {
|
||||
callback.onRenderersError(new UnsupportedOperationException(
|
||||
"Protected content not supported on API level " + Util.SDK_INT));
|
||||
callback.onRenderersError(
|
||||
new UnsupportedDrmException(UnsupportedDrmException.REASON_NO_DRM));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
drmSessionManager = V18Compat.getDrmSessionManager(manifest.protectionElement.uuid, player,
|
||||
drmCallback);
|
||||
} catch (UnsupportedSchemeException e) {
|
||||
callback.onRenderersError(
|
||||
new UnsupportedDrmException(UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME, e));
|
||||
} catch (Exception e) {
|
||||
callback.onRenderersError(e);
|
||||
callback.onRenderersError(
|
||||
new UnsupportedDrmException(UnsupportedDrmException.REASON_UNKNOWN, e));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,11 @@
|
|||
|
||||
<string name="on">[on]</string>
|
||||
|
||||
<string name="drm_not_supported">Protected content not supported on API levels below 18</string>
|
||||
<string name="drm_error_not_supported">Protected content not supported on API levels below 18</string>
|
||||
|
||||
<string name="drm_error_unsupported_scheme">This device does not support the required DRM scheme</string>
|
||||
|
||||
<string name="drm_error_unknown">An unknown DRM error occurred</string>
|
||||
|
||||
<string name="failed">Playback failed</string>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue