fix(player): load files sequentially (sinse the throughput is common)
This commit is contained in:
parent
b0d0d47da2
commit
c26706cba4
1 changed files with 3 additions and 7 deletions
|
|
@ -12,14 +12,10 @@ export async function loadFiles(
|
|||
if (!urls.length) {
|
||||
throw NO_URLS
|
||||
}
|
||||
const fileLoads = urls.map((url, index) =>
|
||||
// loads can start simultaneously
|
||||
window.fetch(url).then(r => processAPIStreamResponse(r, index === 0))
|
||||
)
|
||||
try {
|
||||
for (let fileLoad of fileLoads) {
|
||||
// binary data should be added sequentially
|
||||
const data = await fileLoad
|
||||
for (let url of urls) {
|
||||
const response = await window.fetch(url)
|
||||
const data = await processAPIStreamResponse(response, url !== url[0])
|
||||
onData(data)
|
||||
}
|
||||
} catch(e) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue