aboutsummaryrefslogtreecommitdiff
path: root/webAO/client.js
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2018-05-22 21:52:58 -0500
committeroldmud0 <oldmud0@users.noreply.github.com>2018-05-22 21:52:58 -0500
commit4ff26c72e9ec8e702c8305e0b7a9acff5b2f5040 (patch)
tree21b4f6b197c840eaa30d388d94627c5ca200b557 /webAO/client.js
parent91f9a9e5b22ab6c3f3cb1e63dfe8d6724e8bd84d (diff)
Move music to viewport
Diffstat (limited to 'webAO/client.js')
-rw-r--r--webAO/client.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/webAO/client.js b/webAO/client.js
index e177bd8..f9b122e 100644
--- a/webAO/client.js
+++ b/webAO/client.js
@@ -261,6 +261,7 @@ class Client {
}
handleMC(args) {
+ const music = viewport.music;
music.pause();
music.src = MUSIC_HOST + args[1];
music.play();
@@ -273,8 +274,9 @@ class Client {
}
handleRMC(args) {
- music.pause();
- music = new Audio(this.musicList[args[1]]);
+ viewport.music.pause();
+ viewport.music = new Audio(this.musicList[args[1]]);
+ const music = viewport.music;
// Music offset + drift from song loading
music.totime = args[1];
music.offset = new Date().getTime() / 1000;
@@ -486,6 +488,9 @@ class Viewport {
this.sfxaudio = new Audio(AO_HOST + 'sounds/general/sfx-blipmale.wav');
this.sfxplayed = 0;
+ this.music = new Audio();
+ this.music.play();
+
this.updater = null;
this.bgname = "gs4";
@@ -920,6 +925,3 @@ if (typeof(String.prototype.trim) === "undefined")
let client = new Client(serverIP);
let viewport = new Viewport();
-
-let music = new Audio();
-music.play(); \ No newline at end of file