aboutsummaryrefslogtreecommitdiff
path: root/webAO/client.js
diff options
context:
space:
mode:
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