Grape.Audio Class
Represents a sound. It decides from the extension of the given url which to use.
Constructor
Grape.Audio
-
opts -
url1 -
url2 -
url3
Parameters:
-
optsObjectAudio options
-
url1StringAudio URL
-
url2StringAudio URL fallback if url1 extension is not supported
-
url3StringAudio URL fallback if url2 extension is not supported
Item Index
Methods
Methods
getResourceKey
()
An abstract method which should return the same key when the resource is the same, it is used as cache key. A typical key is the url.
loadResource
-
onFinish -
onError -
onProgress
This method is called when we want to load the resource and it is not in the cache.
Parameters:
-
onFinishFunctionShould be called when the resource is ready. The parameter is the loaded data.
-
onErrorFunctionShould be called when an error occurs
-
onProgressFunctionShould be called when the loading progress changes (0-100)
play
()
Plays the audio.
process
-
(*)
This method is called after load is called. If load is called multiple times, this method is not called more than once. It should initialize the resource with the loaded data.
Parameters:
-
(*)Objectdata The loaded data (passed to the onFinish method in loadResource
