gpt4 book ai didi

android - Exoplayer 错误中的 Widevine Drm

转载 作者:行者123 更新时间:2023-11-29 16:57:28 26 4
gpt4 key购买 nike

我正在 Exoplayer Android 上实现一个 OTT 应用程序。我们正在使用 Widewine DRM 保护我们的内容。但是我们收到如下所示的错误。

 06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: com.google.android.exoplayer2.drm.UnsupportedDrmException: android.media.UnsupportedSchemeException: Failed to instantiate drm object.
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: at com.google.android.exoplayer2.drm.FrameworkMediaDrm.newInstance(FrameworkMediaDrm.java:50)
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: at com.cinesoft.cinehome.player.PlayerActivity.buildDrmSessionManager(PlayerActivity.java:483)
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: at com.cinesoft.cinehome.player.PlayerActivity.initPlayer(PlayerActivity.java:398)
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: at com.cinesoft.cinehome.player.PlayerActivity.onPlayRequestResult(PlayerActivity.java:1308)
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: at com.cinesoft.cinehome.api.services.ConnectToServer$3.onResponse(ConnectToServer.java:503)
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: at com.cinesoft.cinehome.api.services.ConnectToServer$3.onResponse(ConnectToServer.java:483)
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: at com.android.volley.toolbox.JsonRequest.deliverResponse(JsonRequest.java:65)
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:99)
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: at android.os.Handler.handleCallback(Handler.java:739)
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: at android.os.Looper.loop(Looper.java:148)
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: at android.app.ActivityThread.main(ActivityThread.java:7325)
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: at java.lang.reflect.Method.invoke(Native Method)
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: Caused by: android.media.UnsupportedSchemeException: Failed to instantiate drm object.
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: at android.media.MediaDrm.native_setup(Native Method)
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: at android.media.MediaDrm.<init>(MediaDrm.java:215)
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: at com.google.android.exoplayer2.drm.FrameworkMediaDrm.<init>(FrameworkMediaDrm.java:57)
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: at com.google.android.exoplayer2.drm.FrameworkMediaDrm.newInstance(FrameworkMediaDrm.java:48)
06-13 17:31:53.641 18652-18652/com.cinesoft.cinehome.android W/System.err: ... 14 more

代码如下所示

mediaDataSourceFactory = buildDataSourceFactory(true);
mainHandler = new Handler();
bandwidthMeter = new DefaultBandwidthMeter();

videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);

trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
eventLogger = new EventLogger(trackSelector);
if (JsonParser.sStr_drmStatus.equalsIgnoreCase("1")) {
AndroidDeviceIdentifier androidDeviceIdentifier = new AndroidDeviceIdentifier();
UUID drmSchemeUuid = null;
drmSchemeUuid = UUID.fromString(androidDeviceIdentifier.getUniqueDeviceIdentifier(PlayerActivity.this));
drmSessionManager = null;
if (drmSchemeUuid != null) {
String drmLicenseUrl = ConnectPortalSettings.WIDEVINE_LICENSE_SERVER_URL;
String[] keyRequestPropertiesArray = new String[]{};
// drmLicenseUrl = intent.getStringExtra(DRM_LICENSE_URL);
// keyRequestPropertiesArray = intent.getStringArrayExtra(DRM_KEY_REQUEST_PROPERTIES);
try {
drmSessionManager = buildDrmSessionManager(drmSchemeUuid, drmLicenseUrl,
keyRequestPropertiesArray);
} catch (UnsupportedDrmException e) {
int errorStringId = Util.SDK_INT < 18 ? R.string.error_drm_not_supported
: (e.reason == UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME
? R.string.error_drm_unsupported_scheme : R.string.error_drm_unknown);
e.printStackTrace();
Log.e("Drm Error Code", String.valueOf(errorStringId));
return;
}
}
@SimpleExoPlayer.ExtensionRendererMode int extensionRendererMode =
((BaseApplication) getApplication()).useExtensionRenderers()
? (false ? SimpleExoPlayer.EXTENSION_RENDERER_MODE_PREFER
: SimpleExoPlayer.EXTENSION_RENDERER_MODE_ON)
: SimpleExoPlayer.EXTENSION_RENDERER_MODE_OFF;
LoadControl loadControl = new DefaultLoadControl();
// 3. Create the player

player = ExoPlayerFactory.newSimpleInstance(this, trackSelector, loadControl,
drmSessionManager, extensionRendererMode);
} else {
LoadControl loadControl = new DefaultLoadControl();
player = ExoPlayerFactory.newSimpleInstance(this, trackSelector, loadControl);
}

请帮我解决这个问题。提前致谢。

最佳答案

转储中有很多数据可能会令人困惑和分散注意力,但您需要关注的错误是:

android.media.UnsupportedSchemeException: Failed to instantiate drm object

你是在模拟器上运行这个吗?您可能需要在真实设备上运行它才能进行测试。在以下位置查看更多信息: https://github.com/google/ExoPlayer/issues/1616

如果您不是在模拟器上运行而是在设备上运行,则可能是您运行它的设备有问题,如下所示: https://github.com/google/ExoPlayer/issues/2260

另外,请注意,当我们关注该错误时,我们也认识到它是:UnsupportedSchemeException

Exception thrown when an attempt is made to construct a MediaDrm object using a crypto scheme UUID that is not supported by the device

来自: https://developer.android.com/reference/android/media/UnsupportedSchemeException.html

关于android - Exoplayer 错误中的 Widevine Drm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44521573/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com