From 4ff26c72e9ec8e702c8305e0b7a9acff5b2f5040 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Tue, 22 May 2018 21:52:58 -0500 Subject: Move music to viewport --- webAO/client.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'webAO') 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 -- cgit