Try to play current audio after DOM is loaded
This commit is contained in:
parent
6ade74df7e
commit
f63d7d9c1f
@ -408,10 +408,13 @@ fn interactive_script(total_sections: usize, base_path: &str) -> Markup {
|
|||||||
|
|
||||||
toggleText(true);
|
toggleText(true);
|
||||||
|
|
||||||
window.addEventListener('load', () => {{
|
document.addEventListener('DOMContentLoaded', () => {{
|
||||||
|
playCurrentAudio();
|
||||||
|
|
||||||
Array({total_sections}).fill().forEach((_, i) => {{
|
Array({total_sections}).fill().forEach((_, i) => {{
|
||||||
const audio = new Audio(`{base_path}.${{i}}.mp3`);
|
if(i > 0) {{
|
||||||
audio.preload = 'metadata';
|
new Audio(`{base_path}.${{i}}.mp3`).preload = 'metadata';
|
||||||
|
}}
|
||||||
}});
|
}});
|
||||||
}});
|
}});
|
||||||
"#)))
|
"#)))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user