Skip to content

Commit eb2e59b

Browse files
authored
Update live-view.js
1 parent 3285a4d commit eb2e59b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

live-view.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,27 @@ function renderLiveViewHTML(file) {
541541
}
542542

543543
})
544+
545+
// fetch music
546+
frameDocument.querySelectorAll('audio').forEach(async (audio) => {
547+
548+
// if audio is external
549+
if (audio.src) {
550+
551+
const linkHref = new URL(audio.src);
552+
const fileName = linkHref.pathname.slice(1);
553+
554+
if (linkHref.origin == window.location.origin) {
555+
556+
const resp = await git.getFile(selectedFile.dir.split(','), linkHref.pathname.slice(1));
557+
558+
audio.src = 'data:text/plain;base64,' + resp;
559+
560+
}
561+
562+
}
563+
564+
})
544565

545566
}
546567

0 commit comments

Comments
 (0)