From 0ee5f4bfd0f21fb62b142c6d7d07743db36a9616 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 5 Nov 2015 08:51:53 +0000 Subject: [PATCH] Added small audio functionality framework --- src/js/audio-controller.js | 5 +++++ src/js/audio-player.js | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/src/js/audio-controller.js b/src/js/audio-controller.js index 83e9fe7..926def0 100644 --- a/src/js/audio-controller.js +++ b/src/js/audio-controller.js @@ -27,6 +27,11 @@ function getWindow() { function play() { console.log("CLICK!"); + playerWindow.webContents.executeJavascript("audioPlayer.play()"); +} + +function setType(type) { + playerWindow.webContents.executeJavascript("changeType(" + type + ");"); } ipc.on('play', function () { diff --git a/src/js/audio-player.js b/src/js/audio-player.js index e69de29..a5a3cdd 100644 --- a/src/js/audio-player.js +++ b/src/js/audio-player.js @@ -0,0 +1,8 @@ +var audioPlayer = new Audio(); +var audioPath, audioType; + +function changeType(type) { + audioType = type; + audioPath = 'audio/' + type + '.mp3'; + audioPlayer.src = audioPath; +} \ No newline at end of file