我无法通过 ExoPlayer 框架运行 DRM Playready 内容。我认为这与我的drmSessionManager 有关
manifestUrl 和 LicenseUrl 都已经过测试,但很难实现我的更改,因为没有实现任何 DRM 内容(WideVine 或 PlayReady)的真实具体示例
普通 Dash 内容适用于 ExoPlayer,但是当我尝试播放任何受 DRM 保护的内容时,它会失败。
DataSource.Factory dataSourceFactory =
new DefaultHttpDataSourceFactory(Util.getUserAgent(this, "ExoPlayerDASHPR"));
try {
drmSessionManager = buildDrmSessionManager(C.PLAYREADY_UUID, drmLicenseUrl, true);
} catch (Exception e) {
System.out.println(e);
}
player = ExoPlayerFactory.newSimpleInstance(new DefaultRenderersFactory(this), new DefaultTrackSelector(), drmSessionManager);
playerView.setPlayer(player);
DashMediaSource mediaSource = new DashMediaSource.Factory(new DefaultDashChunkSource.Factory(dataSourceFactory), dataSourceFactory).createMediaSource(manifestUri);
player.prepare(mediaSource);
player.setPlayWhenReady(true);
}
构建实际 drmSessionManager 的方法(我认为问题出在哪里)
private DefaultDrmSessionManager<FrameworkMediaCrypto> buildDrmSessionManager(
UUID uuid, String licenseUrl, boolean multiSession)
throws UnsupportedDrmException {
HttpMediaDrmCallback httpMediaDrmCallback = new HttpMediaDrmCallback(licenseUrl,
new DefaultHttpDataSourceFactory(Util.getUserAgent(this, "ExoPlayerDASHPR")));
releaseMediaDrm();
mediaDrm = FrameworkMediaDrm.newInstance(uuid);
return new DefaultDrmSessionManager<>(uuid, mediaDrm, httpMediaDrmCallback, null, multiSession);
}
期望它通过我在 Android 设备中的 WebView 播放 PlayReady 内容。我 100% 确定该设备支持 PlayReady,因为它是 NVidia Shield。
下面的错误信息。
2019-10-18 09:56:18.272 31508-31555/com.example.exoplayer_dashpr E/ExoPlayerImplInternal: Playback error.
com.google.android.exoplayer2.ExoPlaybackException
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.shouldWaitForKeys(MediaCodecRenderer.java:842)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:739)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:574)
at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:518)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:301)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:193)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: com.google.android.exoplayer2.drm.DrmSession$DrmSessionException: com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 500
at com.google.android.exoplayer2.drm.DefaultDrmSession.onError(DefaultDrmSession.java:422)
at com.google.android.exoplayer2.drm.DefaultDrmSession.onKeysError(DefaultDrmSession.java:417)
at com.google.android.exoplayer2.drm.DefaultDrmSession.onKeyResponse(DefaultDrmSession.java:379)
at com.google.android.exoplayer2.drm.DefaultDrmSession.access$100(DefaultDrmSession.java:41)
at com.google.android.exoplayer2.drm.DefaultDrmSession$PostResponseHandler.handleMessage(DefaultDrmSession.java:472)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 500
at com.google.android.exoplayer2.upstream.DefaultHttpDataSource.open(DefaultHttpDataSource.java:211)
at com.google.android.exoplayer2.upstream.DataSourceInputStream.checkOpened(DataSourceInputStream.java:102)
at com.google.android.exoplayer2.upstream.DataSourceInputStream.read(DataSourceInputStream.java:82)
at com.google.android.exoplayer2.upstream.DataSourceInputStream.read(DataSourceInputStream.java:76)
at com.google.android.exoplayer2.util.Util.toByteArray(Util.java:128)
at com.google.android.exoplayer2.drm.HttpMediaDrmCallback.executePost(HttpMediaDrmCallback.java:159)
at com.google.android.exoplayer2.drm.HttpMediaDrmCallback.executeKeyRequest(HttpMediaDrmCallback.java:134)
at com.google.android.exoplayer2.drm.DefaultDrmSession$PostRequestHandler.handleMessage(DefaultDrmSession.java:503)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.os.HandlerThread.run(HandlerThread.java:65)