mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 18:52:42 +01:00
5afa2c3b62
Summary: Ref T5369. New HTML5 version without flash dependencies. This doesn't play any sounds. Test Plan: Did not play any sounds. Reviewers: btrahan Reviewed By: btrahan Subscribers: joshuaspence, epriestley Maniphest Tasks: T5369 Differential Revision: https://secure.phabricator.com/D9535
38 lines
578 B
JavaScript
38 lines
578 B
JavaScript
/**
|
|
* @requires javelin-install
|
|
* @provides javelin-sound
|
|
* @javelin
|
|
*/
|
|
|
|
|
|
JX.install('Sound', {
|
|
statics: {
|
|
_sounds: {},
|
|
|
|
load: function(uri) {
|
|
var self = JX.Sound;
|
|
|
|
if (!(uri in self._sounds)) {
|
|
self._sounds[uri] = JX.$N(
|
|
'audio',
|
|
{
|
|
src: uri,
|
|
preload: 'auto'
|
|
});
|
|
}
|
|
},
|
|
|
|
play: function(uri) {
|
|
var self = JX.Sound;
|
|
self.load(uri);
|
|
|
|
var sound = self._sounds[uri];
|
|
|
|
try {
|
|
sound.play();
|
|
} catch (ex) {
|
|
JX.log(ex);
|
|
}
|
|
}
|
|
}
|
|
});
|