rx-player
Version:
Canal+ HTML5 Video Player
25 lines (24 loc) • 1.06 kB
JavaScript
import config from "../config";
import EnvDetector from "./env_detector";
/**
* Some devices will give an error if you did not ensure that a `setMediaKeys`
* call was performed until the end before making another one.
*
* This is actually spec-compliant, but we were bitten previously by the other
* side of that story, when a `setMediaKeys` took a very long time to resolve
* (thus leading us to not await it).
*
* So this function returns `true` when, in actually reproduced scenarios, we
* encountered situations where both:
* 1. Time to perform a `setMediaKeys` is not excessive
* 2. An issue was encountered due to too-close `setMediaKeys` calls.
*
* @returns {boolean}
*/
export default function shouldAwaitSetMediaKeys() {
const { FORCE_SHOULD_AWAIT_SET_MEDIA_KEYS } = config.getCurrent();
return (FORCE_SHOULD_AWAIT_SET_MEDIA_KEYS ||
EnvDetector.device === EnvDetector.DEVICES.WebOs2021 ||
EnvDetector.device === EnvDetector.DEVICES.WebOs2022 ||
EnvDetector.device === EnvDetector.DEVICES.WebOsOther);
}