Simple mp3 player

This commit is contained in:
RainLoop Team 2015-04-10 12:17:49 +04:00
parent 351c12c002
commit 1d943356f5
23 changed files with 336 additions and 121 deletions

View file

@ -6,10 +6,9 @@
var
window = require('window'),
ko = require('ko'),
buzz = require('buzz'),
Enums = require('Common/Enums'),
Links = require('Common/Links'),
Audio = require('Common/Audio'),
Settings = require('Storage/Settings')
;
@ -21,8 +20,6 @@
{
var self = this;
this.buzz = null;
this.enableSoundNotification = ko.observable(false);
this.soundNotificationIsSupported = ko.observable(false);
@ -145,14 +142,9 @@
NotificationUserStore.prototype.initNotificationPlayer = function ()
{
if (buzz && buzz.isSupported() && (buzz.isOGGSupported() || buzz.isMP3Supported()))
if (Audio && Audio.supported)
{
this.soundNotificationIsSupported(true);
this.buzz = new buzz.sound(Links.sound('new-mail'), {
'preload': 'none',
'formats': ['mp3', 'ogg']
});
}
else
{
@ -163,9 +155,9 @@
NotificationUserStore.prototype.playSoundNotification = function (bSkipSetting)
{
if (this.buzz && (bSkipSetting ? true : this.enableSoundNotification()))
if (Audio && Audio.supported && (bSkipSetting ? true : this.enableSoundNotification()))
{
this.buzz.play();
Audio.playNotification();
}
};