1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 1× | import { inject as service } from '@ember/service'; import { on } from '@ember/object/evented'; import Controller from '@ember/controller'; export default Controller.extend({ audio: service(), initAudioFile: on('init', function() { this.get('audio').load('Eb5.mp3').asSound('piano-note'); }), actions: { playSound() { this.get('audio').getSound('piano-note').play(); } } }); |