all files / tests/dummy/app/controllers/timing/ index.js

20% Statements 1/5
100% Branches 0/0
33.33% Functions 1/3
20% Lines 1/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25                                               
import { inject as service } from '@ember/service';
import { on } from '@ember/object/evented';
import Controller from '@ember/controller';
 
export default Controller.extend({
  audio: service(),
 
  initSound: on('init', function() {
    this.get('audio').load('/ember-audio/Db5.mp3').asSound('delayed-note');
  }),
 
  actions: {
    playInOneSecond1() {
      const audio = this.get('audio');
      const currentTime = audio.get('audioContext.currentTime');
      audio.getSound('delayed-note').playAt(currentTime + 1);
    },
 
    playInOneSecond2() {
      this.get('audio').getSound('delayed-note').playIn(1);
    }
  }
});