I try to call a function when a Javascript object is audio()loaded, but it does not work with onload.
audio()
onload
myaud.onload = audioDone;
But it works with an object image(). How can I make it work with an object audio()?thanks
image()
An element <audio>has a specific set of events called media events , and is onloadnot one of them.
<audio>
You can check if the sound is loaded and can be played using the event canplaythrough
canplaythrough
myaud.addEventListener('canplaythrough', audioDone, false);
Source: https://habr.com/ru/post/1623571/More articles:Renaming a fat can with Maven - javaRegex for finding duplicate patterns in a phone number? Or maybe not? - javascriptHow to get column names and their parquet data types using pyspark? - apache-sparkStack Distribution for Functions - c ++How to synchronize Redis with local memory cache? - cachingНеверная ошибка пакета (возможно, CocoaPods вызвала ошибку) - iosWhat is the best way to delete multiple entries from a store? ExtJS - javascriptIterate a collection using forEach () on multiple threads or with forEach () and lambdas - javaHow should I format (Android) / Chrome getUserMedia () restrictions? - androidКак вертикально выравнивать значки на панели навигации? - htmlAll Articles