mirror of
https://github.com/androidx/media.git
synced 2025-05-17 04:29:55 +08:00
Delete another class from the demo app.
Merge the two MediaDrmCallback classes, since they're pretty much identical. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=123220343
This commit is contained in:
parent
f995509448
commit
ff7819e86a
@ -335,10 +335,10 @@ public class PlayerActivity extends Activity implements SurfaceHolder.Callback,
|
||||
}
|
||||
if (C.PLAYREADY_UUID.equals(uuid)) {
|
||||
return StreamingDrmSessionManager.newPlayReadyInstance(
|
||||
new SmoothStreamingTestMediaDrmCallback(), null, mainHandler, eventLogger);
|
||||
TestMediaDrmCallback.newPlayReadyInstance(), null, mainHandler, eventLogger);
|
||||
} else if (C.WIDEVINE_UUID.equals(uuid)) {
|
||||
return StreamingDrmSessionManager.newWidevineInstance(
|
||||
new WidevineTestMediaDrmCallback(id, provider), null, mainHandler, eventLogger);
|
||||
TestMediaDrmCallback.newWidevineInstance(id, provider), null, mainHandler, eventLogger);
|
||||
} else {
|
||||
throw new UnsupportedDrmException(UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME);
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
package com.google.android.exoplayer.demo;
|
||||
|
||||
import com.google.android.exoplayer.drm.MediaDrmCallback;
|
||||
import com.google.android.exoplayer.drm.StreamingDrmSessionManager;
|
||||
import com.google.android.exoplayer.util.Util;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
@ -30,20 +29,38 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Demo {@link StreamingDrmSessionManager} for smooth streaming test content.
|
||||
* A {@link MediaDrmCallback} for test content.
|
||||
*/
|
||||
@TargetApi(18)
|
||||
public final class SmoothStreamingTestMediaDrmCallback implements MediaDrmCallback {
|
||||
/* package */ final class TestMediaDrmCallback implements MediaDrmCallback {
|
||||
|
||||
private static final String PLAYREADY_TEST_DEFAULT_URI =
|
||||
private static final String WIDEVINE_BASE_URL = "https://proxy.uat.widevine.com/proxy";
|
||||
private static final String PLAYREADY_BASE_URL =
|
||||
"http://playready.directtaps.net/pr/svc/rightsmanager.asmx";
|
||||
private static final Map<String, String> KEY_REQUEST_PROPERTIES;
|
||||
private static final Map<String, String> PLAYREADY_KEY_REQUEST_PROPERTIES;
|
||||
static {
|
||||
HashMap<String, String> keyRequestProperties = new HashMap<>();
|
||||
keyRequestProperties.put("Content-Type", "text/xml");
|
||||
keyRequestProperties.put("SOAPAction",
|
||||
"http://schemas.microsoft.com/DRM/2007/03/protocols/AcquireLicense");
|
||||
KEY_REQUEST_PROPERTIES = keyRequestProperties;
|
||||
PLAYREADY_KEY_REQUEST_PROPERTIES = keyRequestProperties;
|
||||
}
|
||||
|
||||
private final String defaultUrl;
|
||||
private final Map<String, String> keyRequestProperties;
|
||||
|
||||
public static TestMediaDrmCallback newWidevineInstance(String contentId, String provider) {
|
||||
String defaultUrl = WIDEVINE_BASE_URL + "?video_id=" + contentId + "&provider=" + provider;
|
||||
return new TestMediaDrmCallback(defaultUrl, null);
|
||||
}
|
||||
|
||||
public static TestMediaDrmCallback newPlayReadyInstance() {
|
||||
return new TestMediaDrmCallback(PLAYREADY_BASE_URL, PLAYREADY_KEY_REQUEST_PROPERTIES);
|
||||
}
|
||||
|
||||
private TestMediaDrmCallback(String defaultUrl, Map<String, String> keyRequestProperties) {
|
||||
this.defaultUrl = defaultUrl;
|
||||
this.keyRequestProperties = keyRequestProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -56,9 +73,9 @@ public final class SmoothStreamingTestMediaDrmCallback implements MediaDrmCallba
|
||||
public byte[] executeKeyRequest(UUID uuid, KeyRequest request) throws Exception {
|
||||
String url = request.getDefaultUrl();
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
url = PLAYREADY_TEST_DEFAULT_URI;
|
||||
url = defaultUrl;
|
||||
}
|
||||
return Util.executePost(url, request.getData(), KEY_REQUEST_PROPERTIES);
|
||||
return Util.executePost(url, request.getData(), keyRequestProperties);
|
||||
}
|
||||
|
||||
}
|
@ -41,7 +41,8 @@ import java.util.Locale;
|
||||
/**
|
||||
* Helper class for displaying track selection dialogs.
|
||||
*/
|
||||
public class TrackSelectionHelper implements View.OnClickListener, DialogInterface.OnClickListener {
|
||||
/* package */ final class TrackSelectionHelper implements View.OnClickListener,
|
||||
DialogInterface.OnClickListener {
|
||||
|
||||
private final DefaultTrackSelector selector;
|
||||
|
||||
|
@ -1,60 +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.drm.MediaDrmCallback;
|
||||
import com.google.android.exoplayer.util.Util;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.media.MediaDrm.KeyRequest;
|
||||
import android.media.MediaDrm.ProvisionRequest;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* A {@link MediaDrmCallback} for Widevine test content.
|
||||
*/
|
||||
@TargetApi(18)
|
||||
public final class WidevineTestMediaDrmCallback implements MediaDrmCallback {
|
||||
|
||||
private static final String WIDEVINE_GTS_DEFAULT_BASE_URI =
|
||||
"https://proxy.uat.widevine.com/proxy";
|
||||
|
||||
private final String defaultUri;
|
||||
|
||||
public WidevineTestMediaDrmCallback(String contentId, String provider) {
|
||||
String params = "?video_id=" + contentId + "&provider=" + provider;
|
||||
defaultUri = WIDEVINE_GTS_DEFAULT_BASE_URI + params;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] executeProvisionRequest(UUID uuid, ProvisionRequest request) throws IOException {
|
||||
String url = request.getDefaultUrl() + "&signedRequest=" + new String(request.getData());
|
||||
return Util.executePost(url, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] executeKeyRequest(UUID uuid, KeyRequest request) throws IOException {
|
||||
String url = request.getDefaultUrl();
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
url = defaultUri;
|
||||
}
|
||||
return Util.executePost(url, request.getData(), null);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user