Closed stevemayhew closed 1 week ago
It's possible I'm misunderstanding, but wouldn't you use key rotation to allow more easily revoking access to content (by denying the next key request, and then playback is forced to stop) - in which case doesn't allowing a player to request all the keys used in the rotation up-front defeat this? In this set-up it seems there's no advantage to the rotation compared to using a single key.
Hey @stevemayhew. We need more information to resolve this issue but there hasn't been an update in 14 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
It's possible I'm misunderstanding, but wouldn't you use key rotation to allow more easily revoking access to content (by denying the next key request, and then playback is forced to stop)
There are two concepts:
- in which case doesn't allowing a player to request all the keys used in the rotation up-front defeat this? In this set-up it seems there's no advantage to the rotation compared to using a single key.
Assume you have a revocation requirement of within 24 hours, but want to rotate encryption keys every 30mins. This mechanism provides the 48 required keys in one license request / response
This capability is implied in the CWIP docs (I will not go into details for obvious reasons).
I think packager is generating the correct encryption sequence for this, but either the metadata (CMAF and MPD/HLS Playlist) or how ExoPlayer is using the metadata is preventing a request the license with all the keys.
If you look at the HLS metadata, the Widevine PSSH boxes all have the same content ID
but only differ in the crypto period index, example:
#EXTM3U
#EXT-X-VERSION:6
## Generated with https://github.com/shaka-project/shaka-packager version 3e71302ba4-debug
#EXT-X-TARGETDURATION:7
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-MAP:URI="video-init.mp4"
#EXT-X-KEY:METHOD=SAMPLE-AES-CTR,URI="data:text/plain;base64,AAAAMHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABAiBIlWkEI4AEjj3JWbBlAo",KEYID=0xbd5fe65fa05650f0977eaf967d80b80f,KEYFORMATVERSIONS="1",KEYFORMAT="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"
#EXT-X-KEY:METHOD=SAMPLE-AES-CTR,URI="data:text/plain;base64,vV/mX6BWUPCXfq+WfYC4Dw==",KEYFORMAT="identity"
#EXTINF:6.006,
video-001.mp4
#EXTINF:6.006,
video-002.mp4
#EXTINF:6.006,
video-003.mp4
#EXTINF:6.006,
video-004.mp4
#EXTINF:6.006,
video-005.mp4
#EXTINF:6.006,
video-006.mp4
#EXTINF:6.006,
video-007.mp4
#EXT-X-KEY:METHOD=SAMPLE-AES-CTR,URI="data:text/plain;base64,AAAAMHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABAiBIlWkEI4AUjj3JWbBlAo",KEYID=0x0ce7a2ffd1795cb49571a8ccacc8dfbc,KEYFORMATVERSIONS="1",KEYFORMAT="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"
#EXT-X-KEY:METHOD=SAMPLE-AES-CTR,URI="data:text/plain;base64,DOei/9F5XLSVcajMrMjfvA==",KEYFORMAT="identity"
So, seems the only way this would work is If the ExoPlayer DrmSessionManager
somehow:
EXT-X-KEY
is the crypto period that was already in the license it had.I'll look at Shaka-player a bit and see how (if) it does this.
This requires either an ExoPlayer change or a packager change to work correctly.
Currently ExoPlayer uses the entire PSSH as a "key" for caching sessions from the Widevine License Server, this will not work correctly if the KID is already fetched by the initial license request and the rotation event only indicates the period has changed.
This is easy to verify:
--mp4_include_pssh_in_stream=false
to the packager parameters above. With this, the actual rotated KID's are in the CencSampleEncryptionInformationGroupEntry for each rotation and the PSSH is only in the m3u8.With this, the content plays perfectly and the DefaultDrmSessionManager
only contacts the license server once.
There are two ways to fix this:
DrmSession
based on the contentId, first period and count of included periods.I've answered my own question. @icbaker The answer is in the CWIP partner documentation "Modular DRM Key Rotation" document.
Basically, if coded correctly, it is possible for the PSSH to request multiple keys for a rotation period. This allows the content key to change without a new PSSH. Each disparate KID would be presented in the moof/traf/sgpd
for the segment, each segment could have a unique key if one wanted to go this far.
The PSSH change would trigger re-authentication and authorization for the content.
This is also roughly described in the DASH-IF IOP in section "9.3 In-band key rotation signalling". Shaka Packager does not (at least I could not figure out how) produce this encoding, but if it did ExoPlayer would support it perfectly.
Using the Shaka Packager I packaged a 10min mp4 source file to DASH and HLS Widevine.
The packager command is:
Packager generates a series of widevine PSSH Boxes with the content ID and a rotation index, e.g.
As well as a a second box that has the list of KeyID's:
These are in the moof for the segments, there is no PSSH in the MPD or the init segment.
When ExoPlayer plays the content it makes a license request for every rotation.
My question is simple, isn't there a way to code the PSSH so ExoPlayer will make a single request and get all the keys?