Skip to content

HLS Widevine VOD playback stops with "Playback failed" at the second (and every subsequent) key rotation #6903

@kapvode

Description

@kapvode

Issue description

When I play the video, it stops at the point where it needs to load the third key. The message on the screen is "Playback failed".

The exception message on an Android 7.0 device is:

com.google.android.exoplayer2.ExoPlaybackException: android.media.MediaCodec$CryptoException: Error decrypting data: requested key has not been loaded

On an Android 9.0 device, the exception message is:

com.google.android.exoplayer2.ExoPlaybackException: android.media.MediaCodec$CryptoException: Crypto key not available

If I press play, the video resumes until the next key rotation, when it stops with the same error. I can keep repeating this.

Reproduction steps

I downloaded the 720p version of Tears of Steel from YouTube, using youtube-dl, and renamed it to tears.mp4.

youtube-dl -F 'https://www.youtube.com/watch?v=41hv2tW5Lc4'
22           mp4        1280x534   720p 1382k , avc1.64001F, mp4a.40.2@192k (44100Hz) (best)
youtube-dl -f 22 'https://www.youtube.com/watch?v=41hv2tW5Lc4'

I used the pre-compiled Shaka Packager v2.4.1 Linux binary.

I prepared two versions of the video: one with a clear lead, and one without (remove the --clear_lead 10 line). The content ID is test.

packager \
    --enable_widevine_encryption \
    --clear_lead 10 \
    --key_server_url https://license.uat.widevine.com/cenc/getcontentkey/widevine_test \
    --signer widevine_test \
    --aes_signing_key 1ae8ccd0e7985cc0b6203a55855a1034afc252980e970ca90e5202689f947ab9 \
    --aes_signing_iv d58ce954203b7c9a9a9d467f59839249 \
    --content_id 74657374 \
    --crypto_period_duration 10 \
    --protection_scheme cenc \
    --segment_duration 10 \
    --hls_master_playlist_output index.m3u8 \
    --mpd_output index.mpd \
    --generate_static_live_mpd \
    input=../tears.mp4,stream=audio,segment_template='audio-$Number%03d$.mp4',playlist_name='audio.m3u8',init_segment='audio-init.mp4' \
    input=../tears.mp4,stream=video,segment_template='video-$Number%03d$.mp4',playlist_name='video.m3u8',init_segment='video-init.mp4'

I tried playing the stream in the demo app:

{
    "name": "Test stream",
    "uri": "http://web-server/stream/index.{m3u8|mpd}",
    "drm_scheme": "widevine",
    "drm_license_url": "http://cwip-shaka-proxy.appspot.com/no_auth",
    "drm_multi_session": true
}

Playing the HLS version results in the described behavior. If it has the clear lead, the error happens a bit later. It always happens when the third key is about to be loaded.

The MPD version works fine.

Link to test content

Already explained.

A full bug report captured from the device

I hope the reproduction steps are enough. If not, I will capture one later.

Version of ExoPlayer being used

I used the demo app from r2.11.1.

Device(s) and version(s) of Android being used

Huawei P10 Lite (WAS-LX1), Android 7.0, API 24.

Wileyfox Swift, Android 9.0, API 28.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions