Change some more variables using 'source' instead of 'content'
This commit is contained in:
parent
a7e7d546c7
commit
ba68616d80
@ -86,8 +86,8 @@ class MediaLoader {
|
|||||||
const token = this._token;
|
const token = this._token;
|
||||||
const data = (await apiGetMedia([{path, dictionaryName}]))[0];
|
const data = (await apiGetMedia([{path, dictionaryName}]))[0];
|
||||||
if (token === this._token && data !== null) {
|
if (token === this._token && data !== null) {
|
||||||
const sourceArrayBuffer = this._base64ToArrayBuffer(data.content);
|
const contentArrayBuffer = this._base64ToArrayBuffer(data.content);
|
||||||
const blob = new Blob([sourceArrayBuffer], {type: data.mediaType});
|
const blob = new Blob([contentArrayBuffer], {type: data.mediaType});
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
cachedData.data = data;
|
cachedData.data = data;
|
||||||
cachedData.url = url;
|
cachedData.url = url;
|
||||||
@ -96,11 +96,11 @@ class MediaLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_base64ToArrayBuffer(content) {
|
_base64ToArrayBuffer(content) {
|
||||||
const binarySource = window.atob(content);
|
const binaryContent = window.atob(content);
|
||||||
const length = binarySource.length;
|
const length = binaryContent.length;
|
||||||
const array = new Uint8Array(length);
|
const array = new Uint8Array(length);
|
||||||
for (let i = 0; i < length; ++i) {
|
for (let i = 0; i < length; ++i) {
|
||||||
array[i] = binarySource.charCodeAt(i);
|
array[i] = binaryContent.charCodeAt(i);
|
||||||
}
|
}
|
||||||
return array.buffer;
|
return array.buffer;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user