Merge pull request #3643 from dmitrylyzo/fix-tizen5
(cherry picked from commit 08951633445f151cd8396547913411961f54b6b5) Signed-off-by: Joshua Boniface <joshua@boniface.me>
This commit is contained in:
parent
b41ed9477e
commit
00c6d7e1a8
1 changed files with 29 additions and 1 deletions
|
@ -32,6 +32,26 @@ import profileBuilder from '../../scripts/browserDeviceProfile';
|
|||
import { getIncludeCorsCredentials } from '../../scripts/settings/webSettings';
|
||||
import { setBackdropTransparency, TRANSPARENCY_LEVEL } from '../../components/backdrop/backdrop';
|
||||
|
||||
/**
|
||||
* Returns resolved URL.
|
||||
* @param {string} url - URL.
|
||||
* @returns {string} Resolved URL or `url` if resolving failed.
|
||||
*/
|
||||
function resolveUrl(url) {
|
||||
return new Promise((resolve) => {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('HEAD', url, true);
|
||||
xhr.onload = function () {
|
||||
resolve(xhr.responseURL || url);
|
||||
};
|
||||
xhr.onerror = function (e) {
|
||||
console.error(e);
|
||||
resolve(url);
|
||||
};
|
||||
xhr.send(null);
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function tryRemoveElement(elem) {
|
||||
|
@ -1094,7 +1114,15 @@ function tryRemoveElement(elem) {
|
|||
renderAhead: 90
|
||||
};
|
||||
import('libass-wasm').then(({default: SubtitlesOctopus}) => {
|
||||
apiClient.getNamedConfiguration('encoding').then(config => {
|
||||
Promise.all([
|
||||
apiClient.getNamedConfiguration('encoding'),
|
||||
// Worker in Tizen 5 doesn't resolve relative path with async request
|
||||
resolveUrl(options.workerUrl),
|
||||
resolveUrl(options.legacyWorkerUrl)
|
||||
]).then(([config, workerUrl, legacyWorkerUrl]) => {
|
||||
options.workerUrl = workerUrl;
|
||||
options.legacyWorkerUrl = legacyWorkerUrl;
|
||||
|
||||
if (config.EnableFallbackFont) {
|
||||
apiClient.getJSON(fallbackFontList).then((fontFiles = []) => {
|
||||
fontFiles.forEach(font => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue