Load an audio file and store it to the buffer.
audio = T("audio", src="public/audio/sample.ogg,mp3", loop=true).load(); // src [String] The url of an audio file to load // loop [Boolean] Looping
audio.src // [String] The url of an audio file to load audio.loop // [Boolean] Looping audio.currentTime // [Number] Current position in msec of the buffer audio.reversed // [Boolean] Play backwards audio.isLoaded // [Readonly] 'true' when loaded audio and stored audio.duration // [Readonly] The duration of the buffer
// Async load an audio file and store it to the buffer audio.load(); // Return new T("audio") instance which refers to the same buffer audio.clone(); // Return new T("audio") instance which has the extracted buffer audio.slice(begin=0, end=1000);
// Script to be run when the audio has reach the end audio.onended = function() {}; // Script to be run when the audio has reach the end and loop audio.onlooped = function() {}; // Scripts to be run when the meta data is loaded audio.onloadedmetadata = function(res) {}; // Scripts to be run when an audio data is loaded // In Firefox, will be kept waiting.. audio.onloadeddata = function(res) {}; // Scripts to be run when an error occurs when the file is being loaded audio.onerror = function() {};
audio.clone().set("reversed", true).play();
audio.slice(280, 280+214).play();