Skip to content

Commit

Permalink
feat!: update playready key system checks
Browse files Browse the repository at this point in the history
Adds new playready key system checks:

isPlayreadyLegacySupported
isPlayreadySupported
isPlayreadyHardwareSupported

BREAKING CHANGE:

The original isPlayreadySupported has been renamed to
isPlayreadyLegacySupported. The new isPlayreadySupported
now checks com.microsoft.playready.recommendation.

com.microsoft.playready is deprecated by Microsoft.

https://learn.microsoft.com/en-us/playready/overview/key-system-strings
  • Loading branch information
martinstark committed Jun 13, 2024
1 parent 01ac036 commit 0051866
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ Tiny MSE video and audio DRM detection library.

The package exports the following asynchronous methods:

> isPlayreadySupported
> isPlayreadyLegacySupported
>
> isPlayreadyChromecastSupported
>
> isPlayreadyRecommendedSupported
> isPlayreadySupported
>
> isPlayreadyHardwareSupported
>
> isWidevineSupported
>
Expand Down
18 changes: 13 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,30 @@ const isMediaKeySupported = async (keySystem: TKeySystem): Promise<boolean> => {
}
};

export const isPlayreadySupported = async (): Promise<boolean> => {
export const isPlayreadyLegacySupported = async (): Promise<boolean> => {
if (!navigator.requestMediaKeySystemAccess) return false;

return isMediaKeySupported({ ks: "com.microsoft.playready" });
};

export const isPlayreadyChromecastSupported = async (): Promise<boolean> => {
export const isPlayreadySupported = async (): Promise<boolean> => {
if (!navigator.requestMediaKeySystemAccess) return false;

return isMediaKeySupported({ ks: "com.chromecast.playready" });
return isMediaKeySupported({ ks: "com.microsoft.playready.recommendation" });
};

export const isPlayreadyHardwareSupported = async (): Promise<boolean> => {
if (!navigator.requestMediaKeySystemAccess) return false;

return isMediaKeySupported({
ks: "com.microsoft.playready.recommendation.3000",
});
};

export const isPlayreadyRecommendedSupported = async (): Promise<boolean> => {
export const isPlayreadyChromecastSupported = async (): Promise<boolean> => {
if (!navigator.requestMediaKeySystemAccess) return false;

return isMediaKeySupported({ ks: "com.microsoft.playready.recommended" });
return isMediaKeySupported({ ks: "com.chromecast.playready" });
};

export const isWidevineSupported = async (): Promise<boolean> => {
Expand Down

0 comments on commit 0051866

Please sign in to comment.