UNPKG

rx-player

Version:
46 lines (45 loc) 2.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = shouldPatchOutDolbyVisionConfigDataFromMp4; var starts_with_1 = require("../utils/starts_with"); var browser_version_1 = require("./browser_version"); /** * This function returns true if the potential `dvcC` ISOBMFF box should be * removed from a segment. * * Explanation: * * We had a problem for some years on LG devices with retro-compatible * Dolby Vision contents (e.g. which, when Dolby Vision is found to not * be compatible to the device, is actually announced as e.g. hevc instead, * with the RxPlayer knowing its compatible to both thanks to DASH * supplementalCodecs + codecs signaling). * * Those failed to play, presumably because the device still noticed the * Dolby Vision metadata, even though we did not want to play it as Dolby * Vision. * * We found out more recently that this issue has been known by Dolby, seems * to affect Chrome version < 94, and even proposed a generic work-around for * everybody: * https://professionalsupport.dolby.com/s/article/Guidelines-to-developers-building-DASH-HLS-player-apps-for-LG-WebOS-Chromecast-and-other-Chromium-based-app-development-platforms?language=en_US * * @param {Array.<string>} codecs * @returns {Boolean} */ function shouldPatchOutDolbyVisionConfigDataFromMp4(codecs, chosenCodec) { var chromeVersion = (0, browser_version_1.getChromeVersion)(); // Seen to affect older LG device with a chrome version inferior to 94 if (chromeVersion === null || chromeVersion >= 94) { return false; } var hasDolbyVision = codecs.some(function (c) { return (0, starts_with_1.default)(c, "dvh1") || (0, starts_with_1.default)(c, "dvhe"); }); if (!hasDolbyVision) { // NOTE: Technically we could still have a dvcC box here, shouldn't we patch it out // regardless when not playing Dolby Vision? I'm unsure... return false; } return (chosenCodec !== undefined && !(0, starts_with_1.default)(chosenCodec, "dvh1") && !(0, starts_with_1.default)(chosenCodec, "dvhe")); }