3

Android 用の Widevine ライブラリで、非常に厄介な問題に直面しています。何らかの理由で、Widevine で HLS をストリーミングしようとすると、一部のデバイス (特に Samsung デバイス) で再生しようとすると次のエラーが発生します。

WV_Info_GetCodecConfig ESDS がエラー 2002 を返しました

この後、再生が始まらないので、メディアプレーヤーと DrmClient を停止し、リセットして解放します。

@Override
    public void onCompletion(MediaPlayer mp) {
        mPlayIndicator.setEnabled(false);
        mSurfaceView.setVisibility(View.INVISIBLE);
        mTimelineSeekBar.setMax(0);

        if (PlayerEnvConfig.USE_DEBUG_LOGGING) {
            Log.d("VideoPlayer", "ClosingVideoThread");
        }

        hideLoading();

        if (mScheduleTaskExecutor != null) {
            mScheduleTaskExecutor.shutdown();
        }

        if (mp != null) {

            if (PlayerEnvConfig.USE_DEBUG_LOGGING) {
                Log.d("VideoPlayer", "Stop Playing");
            }

            if (mp.isPlaying()) {
                mp.stop(); // It's always safe to call stop()
            }

            if (PlayerEnvConfig.USE_DEBUG_LOGGING) {
                Log.d("VideoPlayer", "Reset");
            }

            mp.reset();

            if (PlayerEnvConfig.USE_DEBUG_LOGGING) {
                Log.d("VideoPlayer", "Release");
            }

            mp.release(); // release resources internal to the MediaPlayer

            mMediaPlayer = null; // remove reference to MediaPlayer to allow GC
        }

        // IMPORTANT: It is important to release the DRM client after releasing the media player other wise there are
        // situations where the media player it is left in a bad state and does not play any more DRM protected content
        // until the restart of the device.

        // If the video is DRM protected then release the resource associated with the DRM.
        if (mIsDrmProtected) {
            mDrmManager.releaseDrmClient();
        }

        if (!mStopEventFired) {
            // Fire the event into the bus to the subscribed views to replace the views accordingly
            fireStopVideoPlaybackEvent();
        }
    }

DrmClient を解放する DrmManager のコード:

@SuppressLint("NewApi")
public void releaseDrmClient() {
    BusProvider.getInstance().unregister(this);

    if (mDrmManagerClient != null) {

        if (PlayerEnvConfig.USE_DEBUG_LOGGING) {
            Log.d("DRMManager", "Releasing DRM");
        }

        mDrmManagerClient.removeAllRights();

        // Starting from API 16 they included this function to release the drm client.
        int currentApiVersion = android.os.Build.VERSION.SDK_INT;
        if (currentApiVersion >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
            mDrmManagerClient.release();
        }

        // Set to null so will be removed by the garbage collector
        mDrmManagerClient = null;

        if (PlayerEnvConfig.USE_DEBUG_LOGGING) {
            Log.d("DRMManager", "Releasing DRM Finally");
        }
    }
}

まあ、それは再生されません。このコードはすべて、ログに表示されるとおりに実行されていることを確認できます。しかし、ここに非常に大きな問題があります。この状況の後、ビデオがまだ再生されているかのように、プロセスがバックグラウンドに残されます (プロセスであるデバイスのどこを見つけることもできません)。次のエラーが常に表示されます。ログ。

WVSession::SetWarning: status=2014、desc=MPEG2-TS 継続カウンタ エラー

最初に安定したデバイスが非常に熱くなり、2番目に使用されたwiresharkがトラフィックを盗聴し、バックグラウンドで行われたリクエストを確認できるため、私は気づきました。

これは、HLS と Widevine を使用していて、最後の 1 つが再生に失敗した場合にのみ発生します。(権利は実際には正しく取得およびインストールされますが、再生しようとすると失敗します)。

なぜこれが起こっているのか、特にそれを回避する方法を知っている人はいますか??

ところで:メディアプレーヤーはフラグメントに埋め込まれており、このフラグメントは別のフラグメント内にあります。

ありがとう!

4

0 に答える 0