2021-02-17 00:51:56 +01:00
|
|
|
/**
|
|
|
|
* Checks whether video we're trying to play is protected by DRM.
|
|
|
|
* @param {*} video video we're trying to check
|
|
|
|
*/
|
|
|
|
export function hasDrm(video) {
|
2021-02-18 00:13:34 +01:00
|
|
|
// if video is not playing, we cannot know whether autodetection will work or not
|
|
|
|
if (!video || !(video.currentTime > 0 && !video.paused && !video.ended && video.readyState > 2)) {
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
|
2021-02-18 19:03:32 +01:00
|
|
|
return video.mediaKeys instanceof MediaKeys;
|
2021-02-17 00:51:56 +01:00
|
|
|
}
|