rx-player
Version:
Canal+ HTML5 Video Player
26 lines (24 loc) • 1.11 kB
text/typescript
import config from "../config";
import EnvDetector from "./env_detector";
/**
* We noticed that the PlayStation 5 may have the HTMLMediaElement on which the
* content is played stop on a `MEDIA_ERR_DECODE` error if it encounters
* encrypted media data whose key is not usable due to policy restrictions (the
* most usual issue being non-respect of HDCP restrictions).
*
* This is not an usual behavior, other platforms just do not attempt to decode
* the encrypted media data and stall the playback instead (which is a much
* preferable behavior for us as we have some advanced mechanism to restart
* playback when this happens).
*
* Consequently, we have to specifically consider platforms with that
* fail-on-undecipherable-data issue, to perform a work-around in that case.
* @returns {boolean}
*/
export default function mayMediaElementFailOnUndecipherableData(): boolean {
const { FORCE_MEDIA_ELEMENT_FAIL_ON_UNDECIPHERABLE_DATA } = config.getCurrent();
return (
FORCE_MEDIA_ELEMENT_FAIL_ON_UNDECIPHERABLE_DATA ||
EnvDetector.device === EnvDetector.DEVICES.PlayStation5
);
}