diff --git a/.gitignore b/.gitignore index f4f46a5..2e1f7d3 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,6 @@ testem.log # System Files .DS_Store Thumbs.db + +# Environment variables should be hidden for testing only +/src/environments diff --git a/src/app/services/audio.service.ts b/src/app/services/audio.service.ts index f7f1c41..0cae671 100644 --- a/src/app/services/audio.service.ts +++ b/src/app/services/audio.service.ts @@ -5,5 +5,26 @@ import { Injectable } from '@angular/core'; }) export class AudioService { - constructor() { } + player = new Audio(); + + constructor() { + + } + + play() { + this.player.play(); + } + + pause() { + this.player.pause(); + } + + toggle() { + if (this.player.paused) this.player.play(); + else this.player.pause(); + } + + setSong(path: string) { + this.player.src = path; + } } diff --git a/tslint.json b/tslint.json index f0adae9..0147588 100644 --- a/tslint.json +++ b/tslint.json @@ -6,6 +6,7 @@ "deprecation": { "severity": "warning" }, + "curly": false, "component-class-suffix": true, "contextual-lifecycle": true, "directive-class-suffix": true, @@ -89,4 +90,4 @@ "rulesDirectory": [ "codelyzer" ] -} \ No newline at end of file +}