| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview Earcons library that uses the HTML5 Audio element to play back | 6 * @fileoverview Earcons library that uses the HTML5 Audio element to play back |
| 7 * auditory cues. | 7 * auditory cues. |
| 8 * | 8 * |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 /** | 48 /** |
| 49 * @override | 49 * @override |
| 50 */ | 50 */ |
| 51 cvox.EarconsBackground.prototype.playEarcon = function(earcon) { | 51 cvox.EarconsBackground.prototype.playEarcon = function(earcon) { |
| 52 goog.base(this, 'playEarcon', earcon); | 52 goog.base(this, 'playEarcon', earcon); |
| 53 if (!this.enabled) { | 53 if (!this.enabled) { |
| 54 return; | 54 return; |
| 55 } | 55 } |
| 56 if (window['console']) { | 56 if (window['console']) { |
| 57 window['console']['log']('Earcon ' + this.getEarconName(earcon)); | 57 window['console']['log']('Earcon ' + earcon); |
| 58 } | 58 } |
| 59 | 59 |
| 60 this.currentAudio = this.audioMap[earcon]; | 60 this.currentAudio = this.audioMap[earcon]; |
| 61 if (!this.currentAudio) { | 61 if (!this.currentAudio) { |
| 62 this.currentAudio = new Audio(chrome.extension.getURL(this.getBaseUrl() + | 62 this.currentAudio = new Audio(chrome.extension.getURL(this.getBaseUrl() + |
| 63 this.getEarconFilename(earcon))); | 63 earcon + '.ogg')); |
| 64 this.audioMap[earcon] = this.currentAudio; | 64 this.audioMap[earcon] = this.currentAudio; |
| 65 } | 65 } |
| 66 try { | 66 try { |
| 67 this.currentAudio.currentTime = 0; | 67 this.currentAudio.currentTime = 0; |
| 68 } catch (e) { | 68 } catch (e) { |
| 69 } | 69 } |
| 70 if (this.currentAudio.paused) { | 70 if (this.currentAudio.paused) { |
| 71 this.currentAudio.volume = 0.7; | 71 this.currentAudio.volume = 0.7; |
| 72 this.currentAudio.play(); | 72 this.currentAudio.play(); |
| 73 } | 73 } |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 | 76 |
| 77 /** | 77 /** |
| 78 * The base URL for loading eracons. | 78 * The base URL for loading eracons. |
| 79 * @type {string} | 79 * @type {string} |
| 80 */ | 80 */ |
| 81 cvox.EarconsBackground.BASE_URL = 'chromevox/background/earcons/'; | 81 cvox.EarconsBackground.BASE_URL = 'chromevox/background/earcons/'; |
| OLD | NEW |