File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -545,17 +545,24 @@ function renderLiveViewHTML(file) {
545545 // fetch music
546546 frameDocument . querySelectorAll ( 'audio' ) . forEach ( async ( audio ) => {
547547
548- // if audio is external
549- if ( audio . src ) {
548+ // if audio is an mp3 file
549+ if ( audio . src . endsWith ( '.mp3' ) ) {
550550
551551 const linkHref = new URL ( audio . src ) ;
552552 const fileName = linkHref . pathname . slice ( 1 ) ;
553553
554554 if ( linkHref . origin == window . location . origin ) {
555555
556- const resp = await git . getFile ( selectedFile . dir . split ( ',' ) , linkHref . pathname . slice ( 1 ) ) ;
557-
558- audio . src = 'data:text/plain;base64,' + resp ;
556+ // if audio file is in current directory
557+ if ( ! ( linkHref . pathname . slice ( 1 ) . includes ( '/' ) ) ) {
558+
559+ const resp = await git . getFile ( selectedFile . dir . split ( ',' ) , linkHref . pathname . slice ( 1 ) ) ;
560+
561+ //fileWrapper.querySelectorAll('.item.file').forEach(fileElem => {
562+
563+ audio . src = 'data:text/plain;base64,' + resp . content ;
564+
565+ }
559566
560567 }
561568
You can’t perform that action at this time.
0 commit comments