Browse Source

修复bug

Alex 1 year ago
parent
commit
e356642cdf
80 changed files with 12936 additions and 998 deletions
  1. 58 22
      App.vue
  2. 26 0
      config/audioUtil.js
  3. 35 2
      manifest.json
  4. 6 0
      node_modules/.package-lock.json
  5. 20 0
      node_modules/howler/LICENSE.md
  6. 564 0
      node_modules/howler/README.md
  7. 1 0
      node_modules/howler/dist/howler.core.min.js
  8. 3248 0
      node_modules/howler/dist/howler.js
  9. 1 0
      node_modules/howler/dist/howler.min.js
  10. 1 0
      node_modules/howler/dist/howler.spatial.min.js
  11. 41 0
      node_modules/howler/package.json
  12. 2587 0
      node_modules/howler/src/howler.core.js
  13. 659 0
      node_modules/howler/src/plugins/howler.spatial.js
  14. 7 0
      package-lock.json
  15. 1 0
      package.json
  16. 2 5
      pages/index/audit/confirm-receipt.vue
  17. 100 105
      pages/index/detail/batch-audit.vue
  18. 137 128
      pages/index/detail/book-audit.vue
  19. 85 64
      pages/index/detail/components/AuditInfo.vue
  20. 24 8
      pages/index/detail/components/BookInfo.vue
  21. 6 4
      pages/index/detail/components/OrderInfo.vue
  22. 1 5
      pages/index/detail/index.vue
  23. 264 246
      pages/index/entry/scan-book.vue
  24. 1 1
      pages/index/offline/check-order.vue
  25. 119 110
      pages/index/wms/bad-out-order.vue
  26. 73 62
      pages/index/wms/speedy-check.vue
  27. 0 1
      pages/login/login.vue
  28. 1 1
      pages/my/components/orderItem.vue
  29. BIN
      static/bap.mp3
  30. 1 1
      static/css/mystyle.css
  31. 0 0
      unpackage/dist/build/app-plus/app-service.js
  32. 0 0
      unpackage/dist/build/app-plus/app.css
  33. 33 0
      unpackage/dist/build/app-plus/manifest.json
  34. 0 0
      unpackage/dist/build/app-plus/pages/index/audit/confirm-receipt.css
  35. 0 0
      unpackage/dist/build/app-plus/pages/index/audit/isbn-order.css
  36. 0 0
      unpackage/dist/build/app-plus/pages/index/audit/sender.css
  37. 0 0
      unpackage/dist/build/app-plus/pages/index/detail/batch-audit.css
  38. 0 0
      unpackage/dist/build/app-plus/pages/index/detail/book-audit.css
  39. 0 0
      unpackage/dist/build/app-plus/pages/index/detail/index.css
  40. 0 0
      unpackage/dist/build/app-plus/pages/index/entry/scan-book.css
  41. 0 0
      unpackage/dist/build/app-plus/pages/index/offline/check-order.css
  42. 0 0
      unpackage/dist/build/app-plus/pages/index/wms/bad-out-order.css
  43. 0 0
      unpackage/dist/build/app-plus/pages/index/wms/order-query-list.css
  44. 0 0
      unpackage/dist/build/app-plus/pages/index/wms/speedy-check.css
  45. 0 0
      unpackage/dist/build/app-plus/pages/login/login.css
  46. 0 0
      unpackage/dist/build/app-plus/pages/my/page/audit-unfinished.css
  47. 0 0
      unpackage/dist/build/app-plus/pages/my/page/user-info.css
  48. BIN
      unpackage/dist/build/app-plus/static/bap.mp3
  49. 1 1
      unpackage/dist/build/app-plus/static/css/mystyle.css
  50. 15 5
      unpackage/dist/cache/.vite/deps/_metadata.json
  51. 16 0
      unpackage/dist/cache/.vite/deps/chunk-TYRVL62N.js
  52. 7 0
      unpackage/dist/cache/.vite/deps/chunk-TYRVL62N.js.map
  53. 2241 0
      unpackage/dist/cache/.vite/deps/howler.js
  54. 3 0
      unpackage/dist/cache/.vite/deps/howler.js.map
  55. 3 6
      unpackage/dist/cache/.vite/deps/pinyin.js
  56. 0 0
      unpackage/dist/cache/.vite/deps/pinyin.js.map
  57. 2495 213
      unpackage/dist/dev/app-plus/app-service.js
  58. 2 2
      unpackage/dist/dev/app-plus/app.css
  59. 33 0
      unpackage/dist/dev/app-plus/manifest.json
  60. 1 1
      unpackage/dist/dev/app-plus/pages/index/detail/batch-audit.css
  61. BIN
      unpackage/dist/dev/app-plus/static/bap.mp3
  62. 1 1
      unpackage/dist/dev/app-plus/static/css/mystyle.css
  63. BIN
      unpackage/res/icons/1024x1024.png
  64. BIN
      unpackage/res/icons/120x120.png
  65. BIN
      unpackage/res/icons/144x144.png
  66. BIN
      unpackage/res/icons/152x152.png
  67. BIN
      unpackage/res/icons/167x167.png
  68. BIN
      unpackage/res/icons/180x180.png
  69. BIN
      unpackage/res/icons/192x192.png
  70. BIN
      unpackage/res/icons/20x20.png
  71. BIN
      unpackage/res/icons/29x29.png
  72. BIN
      unpackage/res/icons/40x40.png
  73. BIN
      unpackage/res/icons/58x58.png
  74. BIN
      unpackage/res/icons/60x60.png
  75. BIN
      unpackage/res/icons/72x72.png
  76. BIN
      unpackage/res/icons/76x76.png
  77. BIN
      unpackage/res/icons/80x80.png
  78. BIN
      unpackage/res/icons/87x87.png
  79. BIN
      unpackage/res/icons/96x96.png
  80. 16 4
      utils/VolumeTTS.js

+ 58 - 22
App.vue

@@ -1,57 +1,93 @@
 <script setup>
-import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
-import {
-    store
-} from '@/store/index.js'
-import { useGlobalEventRemove, useInit } from '@/utils/useBarcodeModule.js'
-import { useRouteMonitor } from '@/utils/useRouteMonitor.js'
+import { onLaunch, onShow, onHide, onUnload } from "@dcloudio/uni-app";
+import { store } from "@/store/index.js";
+import { useGlobalEventRemove, useInit } from "@/utils/useBarcodeModule.js";
+import { useRouteMonitor } from "@/utils/useRouteMonitor.js";
+import { playClickSound } from "@/config/audioUtil.js";
+
+// 存储移动端触摸事件处理函数的引用
+let touchHandler;
 
 onLaunch(() => {
-    console.log('App Launch')
+    console.log("App Launch");
     // 尝试去获取本地的 token 和用户信息,填充到 store 中
     if (!store.token) {
-        let token = uni.getStorageSync('token')
+        let token = uni.getStorageSync("token");
         if (token) {
-            store.setToken(token)
-            let userInfo = uni.getStorageSync('userInfo')
+            store.setToken(token);
+            let userInfo = uni.getStorageSync("userInfo");
             if (userInfo) {
                 if (userInfo.userId) {
-                    store.setUserInfo(userInfo)
+                    store.setUserInfo(userInfo);
                 }
             }
         }
     }
+
+    // 移动端触摸事件处理函数
+    touchHandler = (e) => {
+        console.log("touchHandler", e);
+        playClickSound();
+    };
+
+    // 添加移动端触摸事件监听 - 使用条件编译区分不同平台
+    // #ifdef H5
+    document.addEventListener("touchstart", touchHandler);
+    // #endif
+
     // #ifdef APP-PLUS
+    // 在APP环境中使用uni的API监听触摸事件
+    var globalEvent = uni.requireNativePlugin("globalEvent");
+    globalEvent.addEventListener("touchstart", touchHandler);
     // 初始化扫码模块
-    useInit()
+    useInit();
     // #endif
-})
+});
 onShow(() => {
-    console.log('App Show');
     // #ifdef APP-PLUS
     // 页面显示时重新添加全局监听
     useRouteMonitor((url, from) => {
-        console.log('onShow', url, from)
+        console.log("onShow", url, from);
         // #ifdef APP-PLUS
         // 页面隐藏时移除全局监听
-        useGlobalEventRemove()
+        useGlobalEventRemove();
         // #endif
-    })
+    });
     // #endif
-})
+});
+
 onHide(() => {
-    console.log('App Hide');
-})
+    console.log("App Hide");
+});
+
+// 在应用销毁时移除点击事件监听
+onUnload(() => {
+    // 移除移动端触摸事件监听 - 使用条件编译区分不同平台
+    // #ifdef H5
+    if (touchHandler) {
+        document.removeEventListener("touchstart", touchHandler);
+        touchHandler = null;
+    }
+    // #endif
+
+    // #ifdef APP-PLUS
+    if (touchHandler) {
+        var globalEvent = uni.requireNativePlugin("globalEvent");
+        globalEvent.removeEventListener("click", touchHandler);
+        touchHandler = null;
+    }
+    // #endif
+});
 </script>
 
 <style lang="scss">
 @import "@/uni_modules/uview-plus/index.scss";
 @import "@/static/css/mystyle.css";
-@import '@/static/css/common.scss';
+@import "@/static/css/common.scss";
 
 /*每个页面公共css */
 page {
-    background: #F5F6FA;
+    background: #f5f6fa;
     height: 100%;
 }
 </style>

+ 26 - 0
config/audioUtil.js

@@ -0,0 +1,26 @@
+// audioUtils.js
+import { Howl } from "howler";
+
+const clickSound = new Howl({
+    src: ["./static/bap.mp3"], // Use relative path
+    html5: true, // Force HTML5 Audio to handle mobile playback better
+    preload: true, // Preload the sound
+    volume: 1.0,
+    format: ["mp3"],
+    onplay: function () {
+        console.log("play");
+    },
+});
+
+export function playClickSound() {
+    console.log("Attempting to play click sound");
+    // Check if audio is loaded
+    if (clickSound.state() === "loaded") {
+        clickSound.play();
+    } else {
+        // If not loaded, wait for it to load
+        clickSound.once("load", function () {
+            clickSound.play();
+        });
+    }
+}

+ 35 - 2
manifest.json

@@ -20,7 +20,8 @@
         "modules" : {
             "Speech" : {},
             "Barcode" : {},
-            "Bluetooth" : {}
+            "Bluetooth" : {},
+            "Webview-x5" : {}
         },
         /* 应用发布信息 */
         "distribute" : {
@@ -60,7 +61,39 @@
                 "dSYMs" : false
             },
             /* SDK配置 */
-            "sdkConfigs" : {}
+            "sdkConfigs" : {},
+            "icons" : {
+                "android" : {
+                    "hdpi" : "unpackage/res/icons/72x72.png",
+                    "xhdpi" : "unpackage/res/icons/96x96.png",
+                    "xxhdpi" : "unpackage/res/icons/144x144.png",
+                    "xxxhdpi" : "unpackage/res/icons/192x192.png"
+                },
+                "ios" : {
+                    "appstore" : "unpackage/res/icons/1024x1024.png",
+                    "ipad" : {
+                        "app" : "unpackage/res/icons/76x76.png",
+                        "app@2x" : "unpackage/res/icons/152x152.png",
+                        "notification" : "unpackage/res/icons/20x20.png",
+                        "notification@2x" : "unpackage/res/icons/40x40.png",
+                        "proapp@2x" : "unpackage/res/icons/167x167.png",
+                        "settings" : "unpackage/res/icons/29x29.png",
+                        "settings@2x" : "unpackage/res/icons/58x58.png",
+                        "spotlight" : "unpackage/res/icons/40x40.png",
+                        "spotlight@2x" : "unpackage/res/icons/80x80.png"
+                    },
+                    "iphone" : {
+                        "app@2x" : "unpackage/res/icons/120x120.png",
+                        "app@3x" : "unpackage/res/icons/180x180.png",
+                        "notification@2x" : "unpackage/res/icons/40x40.png",
+                        "notification@3x" : "unpackage/res/icons/60x60.png",
+                        "settings@2x" : "unpackage/res/icons/58x58.png",
+                        "settings@3x" : "unpackage/res/icons/87x87.png",
+                        "spotlight@2x" : "unpackage/res/icons/80x80.png",
+                        "spotlight@3x" : "unpackage/res/icons/120x120.png"
+                    }
+                }
+            }
         },
         "nativePlugins" : {
             "iData-BarcodePlugin" : {

+ 6 - 0
node_modules/.package-lock.json

@@ -14,6 +14,12 @@
         "node": ">= 0.6.x"
       }
     },
+    "node_modules/howler": {
+      "version": "2.2.4",
+      "resolved": "https://registry.npmmirror.com/howler/-/howler-2.2.4.tgz",
+      "integrity": "sha512-iARIBPgcQrwtEr+tALF+rapJ8qSc+Set2GJQl7xT1MQzWaVkFebdJhR3alVlSiUf5U7nAANKuj3aWpwerocD5w==",
+      "license": "MIT"
+    },
     "node_modules/keypress": {
       "version": "0.1.0",
       "resolved": "https://registry.npmmirror.com/keypress/-/keypress-0.1.0.tgz",

+ 20 - 0
node_modules/howler/LICENSE.md

@@ -0,0 +1,20 @@
+Copyright (c) 2013-2020 James Simpson and GoldFire Studios, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 564 - 0
node_modules/howler/README.md

@@ -0,0 +1,564 @@
+[![howler.js](https://s3.amazonaws.com/howler.js/howler-logo.png "howler.js")](https://howlerjs.com)
+
+# Description
+[howler.js](https://howlerjs.com) is an audio library for the modern web. It defaults to [Web Audio API](http://webaudio.github.io/web-audio-api/) and falls back to [HTML5 Audio](https://html.spec.whatwg.org/multipage/embedded-content.html#the-audio-element). This makes working with audio in JavaScript easy and reliable across all platforms.
+
+Additional information, live demos and a user showcase are available at [howlerjs.com](https://howlerjs.com).
+
+Follow on Twitter for howler.js and development-related discussion: [@GoldFireStudios](https://twitter.com/goldfirestudios).
+
+### Features
+* Single API for all audio needs
+* Defaults to Web Audio API and falls back to HTML5 Audio
+* Handles edge cases and bugs across environments
+* Supports all codecs for full cross-browser support
+* Automatic caching for improved performance
+* Control sounds individually, in groups or globally
+* Playback of multiple sounds at once
+* Easy sound sprite definition and playback
+* Full control for fading, rate, seek, volume, etc.
+* Easily add 3D spatial sound or stereo panning
+* Modular - use what you want and easy to extend
+* No outside dependencies, just pure JavaScript
+* As light as 7kb gzipped
+
+### Browser Compatibility
+Tested in the following browsers/versions:
+* Google Chrome 7.0+
+* Internet Explorer 9.0+
+* Firefox 4.0+
+* Safari 5.1.4+
+* Mobile Safari 6.0+ (after user input)
+* Opera 12.0+
+* Microsoft Edge
+
+### Live Demos
+* [Audio Player](https://howlerjs.com/#player)
+* [Radio](https://howlerjs.com/#radio)
+* [Spatial Audio](https://howlerjs.com/#spatial)
+* [Audio Sprites](https://howlerjs.com/#sprite)
+
+# Documentation
+
+### Contents
+* [Quick Start](#quick-start)
+* [Examples](#examples)
+* [Core](#core)
+  * [Options](#options)
+  * [Methods](#methods)
+  * [Global Options](#global-options)
+  * [Global Methods](#global-methods)
+* [Plugin: Spatial](#plugin-spatial)
+  * [Options](#options-1)
+  * [Methods](#methods-1)
+  * [Global Methods](#global-methods-1)
+* [Group Playback](#group-playback)
+* [Mobile Playback](#mobilechrome-playback)
+* [Dolby Audio Playback](#dolby-audio-playback)
+* [Facebook Instant Games](#facebook-instant-games)
+* [Format Recommendations](#format-recommendations)
+* [License](#license)
+
+### Quick Start
+
+Several options to get up and running:
+
+* Clone the repo: `git clone https://github.com/goldfire/howler.js.git`
+* Install with [npm](https://www.npmjs.com/package/howler): `npm install howler`
+* Install with [Yarn](https://yarnpkg.com/en/package/howler): `yarn add howler`
+* Install with [Bower](http://bower.io/): `bower install howler`
+* Hosted CDN: [`cdnjs`](https://cdnjs.com/libraries/howler) [`jsDelivr`](https://www.jsdelivr.com/projects/howler.js)
+
+In the browser:
+
+```html
+<script src="/path/to/howler.js"></script>
+<script>
+    var sound = new Howl({
+      src: ['sound.webm', 'sound.mp3']
+    });
+</script>
+```
+
+As a dependency:
+
+```javascript
+import {Howl, Howler} from 'howler';
+```
+
+```javascript
+const {Howl, Howler} = require('howler');
+```
+
+Included distribution files:
+
+* **howler**: This is the default and fully bundled source that includes `howler.core` and `howler.spatial`. It includes all functionality that howler comes with.
+* **howler.core**: This includes only the core functionality that aims to create parity between Web Audio and HTML5 Audio. It doesn't include any of the spatial/stereo audio functionality.
+* **howler.spatial**: This is a plugin that adds spatial/stereo audio functionality. It requires `howler.core` to operate as it is simply an add-on to the core.
+
+
+### Examples
+
+##### Most basic, play an MP3:
+```javascript
+var sound = new Howl({
+  src: ['sound.mp3']
+});
+
+sound.play();
+```
+
+##### Streaming audio (for live audio or large files):
+```javascript
+var sound = new Howl({
+  src: ['stream.mp3'],
+  html5: true
+});
+
+sound.play();
+```
+
+##### More playback options:
+```javascript
+var sound = new Howl({
+  src: ['sound.webm', 'sound.mp3', 'sound.wav'],
+  autoplay: true,
+  loop: true,
+  volume: 0.5,
+  onend: function() {
+    console.log('Finished!');
+  }
+});
+```
+
+##### Define and play a sound sprite:
+```javascript
+var sound = new Howl({
+  src: ['sounds.webm', 'sounds.mp3'],
+  sprite: {
+    blast: [0, 3000],
+    laser: [4000, 1000],
+    winner: [6000, 5000]
+  }
+});
+
+// Shoot the laser!
+sound.play('laser');
+```
+
+##### Listen for events:
+```javascript
+var sound = new Howl({
+  src: ['sound.webm', 'sound.mp3']
+});
+
+// Clear listener after first call.
+sound.once('load', function(){
+  sound.play();
+});
+
+// Fires when the sound finishes playing.
+sound.on('end', function(){
+  console.log('Finished!');
+});
+```
+
+##### Control multiple sounds:
+```javascript
+var sound = new Howl({
+  src: ['sound.webm', 'sound.mp3']
+});
+
+// Play returns a unique Sound ID that can be passed
+// into any method on Howl to control that specific sound.
+var id1 = sound.play();
+var id2 = sound.play();
+
+// Fade out the first sound and speed up the second.
+sound.fade(1, 0, 1000, id1);
+sound.rate(1.5, id2);
+```
+
+##### ES6:
+```javascript
+import {Howl, Howler} from 'howler';
+
+// Setup the new Howl.
+const sound = new Howl({
+  src: ['sound.webm', 'sound.mp3']
+});
+
+// Play the sound.
+sound.play();
+
+// Change global volume.
+Howler.volume(0.5);
+```
+
+
+More in-depth examples (with accompanying live demos) can be found in the [examples directory](https://github.com/goldfire/howler.js/tree/master/examples).
+
+
+## Core
+
+### Options
+#### src `Array/String` `[]` *`required`*
+The sources to the track(s) to be loaded for the sound (URLs or base64 data URIs). These should be in order of preference, howler.js will automatically load the first one that is compatible with the current browser. If your files have no extensions, you will need to explicitly specify the extension using the `format` property.
+#### volume `Number` `1.0`
+The volume of the specific track, from `0.0` to `1.0`.
+#### html5 `Boolean` `false`
+Set to `true` to force HTML5 Audio. This should be used for large audio files so that you don't have to wait for the full file to be downloaded and decoded before playing.
+#### loop `Boolean` `false`
+Set to `true` to automatically loop the sound forever.
+#### preload `Boolean|String` `true`
+Automatically begin downloading the audio file when the `Howl` is defined. If using HTML5 Audio, you can set this to `'metadata'` to only preload the file's metadata (to get its duration without download the entire file, for example). 
+#### autoplay `Boolean` `false`
+Set to `true` to automatically start playback when sound is loaded.
+#### mute `Boolean` `false`
+Set to `true` to load the audio muted.
+#### sprite `Object` `{}`
+Define a sound sprite for the sound. The offset and duration are defined in milliseconds. A third (optional) parameter is available to set a sprite as looping. An easy way to generate compatible sound sprites is with [audiosprite](https://github.com/tonistiigi/audiosprite).
+```javascript
+new Howl({
+  sprite: {
+    key1: [offset, duration, (loop)]
+  },
+});
+```
+#### rate `Number` `1.0`
+The rate of playback. 0.5 to 4.0, with 1.0 being normal speed.
+#### pool `Number` `5`
+The size of the inactive sounds pool. Once sounds are stopped or finish playing, they are marked as ended and ready for cleanup. We keep a pool of these to recycle for improved performance. Generally this doesn't need to be changed. It is important to keep in mind that when a sound is paused, it won't be removed from the pool and will still be considered active so that it can be resumed later.
+#### format `Array` `[]`
+howler.js automatically detects your file format from the extension, but you may also specify a format in situations where extraction won't work (such as with a SoundCloud stream).
+#### xhr `Object` `null`
+When using Web Audio, howler.js uses an XHR request to load the audio files. If you need to send custom headers, set the HTTP method or enable `withCredentials` ([see reference](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials)), include them with this parameter. Each is optional (method defaults to `GET`, headers default to `null` and withCredentials defaults to `false`). For example:
+```javascript
+// Using each of the properties.
+new Howl({
+  xhr: {
+    method: 'POST',
+    headers: {
+      Authorization: 'Bearer:' + token,
+    },
+    withCredentials: true,
+  }
+});
+
+// Only changing the method.
+new Howl({
+  xhr: {
+    method: 'POST',
+  }
+});
+```
+#### onload `Function`
+Fires when the sound is loaded.
+#### onloaderror `Function`
+Fires when the sound is unable to load. The first parameter is the ID of the sound (if it exists) and the second is the error message/code.
+
+The load error codes are [defined in the spec](http://dev.w3.org/html5/spec-author-view/spec.html#mediaerror):
+* **1** - The fetching process for the media resource was aborted by the user agent at the user's request.
+* **2** - A network error of some description caused the user agent to stop fetching the media resource, after the resource was established to be usable.
+* **3** - An error of some description occurred while decoding the media resource, after the resource was established to be usable.
+* **4** - The media resource indicated by the src attribute or assigned media provider object was not suitable.
+#### onplayerror `Function`
+Fires when the sound is unable to play. The first parameter is the ID of the sound and the second is the error message/code.
+#### onplay `Function`
+Fires when the sound begins playing. The first parameter is the ID of the sound.
+#### onend `Function`
+Fires when the sound finishes playing (if it is looping, it'll fire at the end of each loop). The first parameter is the ID of the sound.
+#### onpause `Function`
+Fires when the sound has been paused. The first parameter is the ID of the sound.
+#### onstop `Function`
+Fires when the sound has been stopped. The first parameter is the ID of the sound.
+#### onmute `Function`
+Fires when the sound has been muted/unmuted. The first parameter is the ID of the sound.
+#### onvolume `Function`
+Fires when the sound's volume has changed. The first parameter is the ID of the sound.
+#### onrate `Function`
+Fires when the sound's playback rate has changed. The first parameter is the ID of the sound.
+#### onseek `Function`
+Fires when the sound has been seeked. The first parameter is the ID of the sound.
+#### onfade `Function`
+Fires when the current sound finishes fading in/out. The first parameter is the ID of the sound.
+#### onunlock `Function`
+Fires when audio has been automatically unlocked through a touch/click event.
+
+
+### Methods
+#### play([sprite/id])
+Begins playback of a sound. Returns the sound id to be used with other methods. Only method that can't be chained.
+* **sprite/id**: `String/Number` `optional` Takes one parameter that can either be a sprite or sound ID. If a sprite is passed, a new sound will play based on the sprite's definition. If a sound ID is passed, the previously played sound will be played (for example, after pausing it). However, if an ID of a sound that has been drained from the pool is passed, nothing will play.
+
+#### pause([id])
+Pauses playback of sound or group, saving the `seek` of playback.
+* **id**: `Number` `optional` The sound ID. If none is passed, all sounds in group are paused.
+
+#### stop([id])
+Stops playback of sound, resetting `seek` to `0`.
+* **id**: `Number` `optional` The sound ID. If none is passed, all sounds in group are stopped.
+
+#### mute([muted], [id])
+Mutes the sound, but doesn't pause the playback.
+* **muted**: `Boolean` `optional` True to mute and false to unmute.
+* **id**: `Number` `optional` The sound ID. If none is passed, all sounds in group are stopped.
+
+#### volume([volume], [id])
+Get/set volume of this sound or the group. This method optionally takes 0, 1 or 2 arguments.
+* **volume**: `Number` `optional` Volume from `0.0` to `1.0`.
+* **id**: `Number` `optional` The sound ID. If none is passed, all sounds in group have volume altered relative to their own volume.
+
+#### fade(from, to, duration, [id])
+Fade a currently playing sound between two volumes. Fires the `fade` event when complete.
+* **from**: `Number` Volume to fade from (`0.0` to `1.0`).
+* **to**: `Number` Volume to fade to (`0.0` to `1.0`).
+* **duration**: `Number` Time in milliseconds to fade.
+* **id**: `Number` `optional` The sound ID. If none is passed, all sounds in group will fade.
+
+#### rate([rate], [id])
+Get/set the rate of playback for a sound. This method optionally takes 0, 1 or 2 arguments.
+* **rate**: `Number` `optional` The rate of playback. 0.5 to 4.0, with 1.0 being normal speed.
+* **id**: `Number` `optional` The sound ID. If none is passed, playback rate of all sounds in group will change.
+
+#### seek([seek], [id])
+Get/set the position of playback for a sound. This method optionally takes 0, 1 or 2 arguments.
+* **seek**: `Number` `optional` The position to move current playback to (in seconds).
+* **id**: `Number` `optional` The sound ID. If none is passed, the first sound will seek.
+
+#### loop([loop], [id])
+Get/set whether to loop the sound or group. This method can optionally take 0, 1 or 2 arguments.
+* **loop**: `Boolean` `optional` To loop or not to loop, that is the question.
+* **id**: `Number` `optional` The sound ID. If none is passed, all sounds in group will have their `loop` property updated.
+
+#### state()
+Check the load status of the `Howl`, returns a `unloaded`, `loading` or `loaded`.
+
+#### playing([id])
+Check if a sound is currently playing or not, returns a `Boolean`. If no sound ID is passed, check if any sound in the `Howl` group is playing.
+* **id**: `Number` `optional` The sound ID to check.
+
+#### duration([id])
+Get the duration of the audio source (in seconds). Will return 0 until after the `load` event fires.
+* **id**: `Number` `optional` The sound ID to check. Passing an ID will return the duration of the sprite being played on this instance; otherwise, the full source duration is returned.
+
+#### on(event, function, [id])
+Listen for events. Multiple events can be added by calling this multiple times.
+* **event**: `String` Name of event to fire/set (`load`, `loaderror`, `playerror`, `play`, `end`, `pause`, `stop`, `mute`, `volume`, `rate`, `seek`, `fade`, `unlock`).
+* **function**: `Function` Define function to fire on event.
+* **id**: `Number` `optional` Only listen to events for this sound id.
+
+#### once(event, function, [id])
+Same as `on`, but it removes itself after the callback is fired.
+* **event**: `String` Name of event to fire/set (`load`, `loaderror`, `playerror`, `play`, `end`, `pause`, `stop`, `mute`, `volume`, `rate`, `seek`, `fade`, `unlock`).
+* **function**: `Function` Define function to fire on event.
+* **id**: `Number` `optional` Only listen to events for this sound id.
+
+#### off(event, [function], [id])
+Remove event listener that you've set. Call without parameters to remove all events.
+* **event**: `String` Name of event (`load`, `loaderror`, `playerror`, `play`, `end`, `pause`, `stop`, `mute`, `volume`, `rate`, `seek`, `fade`, `unlock`).
+* **function**: `Function` `optional` The listener to remove. Omit this to remove all events of type.
+* **id**: `Number` `optional` Only remove events for this sound id.
+
+#### load()
+This is called by default, but if you set `preload` to false, you must call `load` before you can play any sounds.
+
+#### unload()
+Unload and destroy a Howl object. This will immediately stop all sounds attached to this sound and remove it from the cache.
+
+
+### Global Options
+#### usingWebAudio `Boolean`
+`true` if the Web Audio API is available.
+#### noAudio `Boolean`
+`true` if no audio is available.
+#### autoUnlock `Boolean` `true`
+Automatically attempts to enable audio on mobile (iOS, Android, etc) devices and desktop Chrome/Safari.
+#### html5PoolSize `Number` `10`
+Each HTML5 Audio object must be unlocked individually, so we keep a global pool of unlocked nodes to share between all `Howl` instances. This pool gets created on the first user interaction and is set to the size of this property.
+#### autoSuspend `Boolean` `true`
+Automatically suspends the Web Audio AudioContext after 30 seconds of inactivity to decrease processing and energy usage. Automatically resumes upon new playback. Set this property to `false` to disable this behavior.
+#### ctx `Boolean` *`Web Audio Only`*
+Exposes the `AudioContext` with Web Audio API.
+#### masterGain `Boolean` *`Web Audio Only`*
+Exposes the master `GainNode` with Web Audio API. This can be useful for writing plugins or advanced usage.
+
+
+### Global Methods
+The following methods are used to modify all sounds globally, and are called from the `Howler` object.
+#### mute(muted)
+Mute or unmute all sounds.
+* **muted**: `Boolean` True to mute and false to unmute.
+
+#### volume([volume])
+Get/set the global volume for all sounds, relative to their own volume.
+* **volume**: `Number` `optional` Volume from `0.0` to `1.0`.
+
+#### stop()
+Stop all sounds and reset their seek position to the beginning.
+
+#### codecs(ext)
+Check supported audio codecs. Returns `true` if the codec is supported in the current browser.
+* **ext**: `String` File extension. One of: "mp3", "mpeg", "opus", "ogg", "oga", "wav", "aac", "caf", "m4a", "m4b", "mp4", "weba", "webm", "dolby", "flac".
+
+#### unload()
+Unload and destroy all currently loaded Howl objects. This will immediately stop all sounds and remove them from cache.
+
+
+## Plugin: Spatial
+
+### Options
+#### orientation `Array` `[1, 0, 0]`
+Sets the direction the audio source is pointing in the 3D cartesian coordinate space. Depending on how directional the sound is, based on the `cone` attributes, a sound pointing away from the listener can be quiet or silent.
+#### stereo `Number` `null`
+Sets the stereo panning value of the audio source for this sound or group. This makes it easy to setup left/right panning with a value of `-1.0` being far left and a value of `1.0` being far right.
+#### pos `Array` `null`
+Sets the 3D spatial position of the audio source for this sound or group relative to the global listener.
+#### pannerAttr `Object`
+Sets the panner node's attributes for a sound or group of sounds. See the `pannerAttr` method for all available options.
+#### onstereo `Function`
+Fires when the current sound has the stereo panning changed. The first parameter is the ID of the sound.
+#### onpos `Function`
+Fires when the current sound has the listener position changed. The first parameter is the ID of the sound.
+#### onorientation `Function`
+Fires when the current sound has the direction of the listener changed. The first parameter is the ID of the sound.
+
+
+### Methods
+#### stereo(pan, [id])
+Get/set the stereo panning of the audio source for this sound or all in the group.
+* **pan**: `Number` A value of `-1.0` is all the way left and `1.0` is all the way right.
+* **id**: `Number` `optional` The sound ID. If none is passed, all in group will be updated.
+
+#### pos(x, y, z, [id])
+Get/set the 3D spatial position of the audio source for this sound or group relative to the global listener.
+* **x**: `Number` The x-position of the audio source.
+* **y**: `Number` The y-position of the audio source.
+* **z**: `Number` The z-position of the audio source.
+* **id**: `Number` `optional` The sound ID. If none is passed, all in group will be updated.
+
+#### orientation(x, y, z, [id])
+Get/set the direction the audio source is pointing in the 3D cartesian coordinate space. Depending on how directional the sound is, based on the `cone` attributes, a sound pointing away from the listener can be quiet or silent.
+* **x**: `Number` The x-orientation of the source.
+* **y**: `Number` The y-orientation of the source.
+* **z**: `Number` The z-orientation of the source.
+* **id**: `Number` `optional` The sound ID. If none is passed, all in group will be updated.
+
+#### pannerAttr(o, [id])
+Get/set the panner node's attributes for a sound or group of sounds.
+* **o**: `Object` All values to update.
+  * **coneInnerAngle** `360` A parameter for directional audio sources, this is an angle, in degrees, inside of which there will be no volume reduction.
+  * **coneOuterAngle** `360` A parameter for directional audio sources, this is an angle, in degrees, outside of which the volume will be reduced to a constant value of `coneOuterGain`.
+  * **coneOuterGain** `0` A parameter for directional audio sources, this is the gain outside of the `coneOuterAngle`. It is a linear value in the range `[0, 1]`.
+  * **distanceModel** `inverse` Determines algorithm used to reduce volume as audio moves away from listener. Can be `linear`, `inverse` or `exponential`. You can find the implementations of each in the [spec](https://webaudio.github.io/web-audio-api/#idl-def-DistanceModelType).
+  * **maxDistance** `10000` The maximum distance between source and listener, after which the volume will not be reduced any further.
+  * **refDistance** `1` A reference distance for reducing volume as source moves further from the listener. This is simply a variable of the distance model and has a different effect depending on which model is used and the scale of your coordinates. Generally, volume will be equal to 1 at this distance.
+  * **rolloffFactor** `1` How quickly the volume reduces as source moves from listener. This is simply a variable of the distance model and can be in the range of `[0, 1]` with `linear` and `[0, ∞]` with `inverse` and `exponential`.
+  * **panningModel** `HRTF` Determines which spatialization algorithm is used to position audio. Can be `HRTF` or `equalpower`.
+* **id**: `Number` `optional` The sound ID. If none is passed, all in group will be updated.
+
+
+### Global Methods
+#### stereo(pan)
+Helper method to update the stereo panning position of all current `Howls`. Future `Howls` will not use this value unless explicitly set.
+* **pan**: `Number` A value of -1.0 is all the way left and 1.0 is all the way right.
+
+#### pos(x, y, z)
+Get/set the position of the listener in 3D cartesian space. Sounds using 3D position will be relative to the listener's position.
+* **x**: `Number` The x-position of the listener.
+* **y**: `Number` The y-position of the listener.
+* **z**: `Number` The z-position of the listener.
+
+#### orientation(x, y, z, xUp, yUp, zUp)
+Get/set the direction the listener is pointing in the 3D cartesian space. A front and up vector must be provided. The front is the direction the face of the listener is pointing, and up is the direction the top of the listener is pointing. Thus, these values are expected to be at right angles from each other.
+* **x**: `Number` The x-orientation of listener.
+* **y**: `Number` The y-orientation of listener.
+* **z**: `Number` The z-orientation of listener.
+* **xUp**: `Number` The x-orientation of the top of the listener.
+* **yUp**: `Number` The y-orientation of the top of the listener.
+* **zUp**: `Number` The z-orientation of the top of the listener.
+
+
+### Group Playback
+Each `new Howl()` instance is also a group. You can play multiple sound instances from the `Howl` and control them individually or as a group (note: each `Howl` can only contain a single audio file). For example, the following plays two sounds from a sprite, changes their volume together and then pauses both of them at the same time.
+
+```javascript
+var sound = new Howl({
+  src: ['sound.webm', 'sound.mp3'],
+  sprite: {
+    track01: [0, 20000],
+    track02: [21000, 41000]
+  }
+});
+
+// Play each of the track.s
+sound.play('track01');
+sound.play('track02');
+
+// Change the volume of both tracks.
+sound.volume(0.5);
+
+// After a second, pause both sounds in the group.
+setTimeout(function() {
+  sound.pause();
+}, 1000);
+```
+
+
+### Mobile/Chrome Playback
+By default, audio on mobile browsers and Chrome/Safari is locked until a sound is played within a user interaction, and then it plays normally the rest of the page session ([Apple documentation](https://developer.apple.com/library/safari/documentation/audiovideo/conceptual/using_html5_audio_video/PlayingandSynthesizingSounds/PlayingandSynthesizingSounds.html)). The default behavior of howler.js is to attempt to silently unlock audio playback by playing an empty buffer on the first `touchend` event. This behavior can be disabled by calling:
+
+```javascript
+Howler.autoUnlock = false;
+```
+
+If you try to play audio automatically on page load, you can listen to a `playerror` event and then wait for the `unlock` event to try and play the audio again:
+
+```javascript
+var sound = new Howl({
+  src: ['sound.webm', 'sound.mp3'],
+  onplayerror: function() {
+    sound.once('unlock', function() {
+      sound.play();
+    });
+  }
+});
+
+sound.play();
+```
+
+
+### Dolby Audio Playback
+Full support for playback of the Dolby Audio format (currently support in Edge and Safari) is included. However, you must specify that the file you are loading is `dolby` since it is in a `mp4` container.
+
+```javascript
+var dolbySound = new Howl({
+  src: ['sound.mp4', 'sound.webm', 'sound.mp3'],
+  format: ['dolby', 'webm', 'mp3']
+});
+```
+
+### Facebook Instant Games
+Howler.js provides audio support for the new [Facebook Instant Games](https://developers.facebook.com/docs/games/instant-games/engine-recommendations) platform. If you encounter any issues while developing for Instant Games, open an issue with the tag `[IG]`.
+
+### Format Recommendations
+Howler.js supports a wide array of audio codecs that have varying browser support ("mp3", "opus", "ogg", "wav", "aac", "m4a", "m4b", "mp4", "webm", ...), but if you want full browser coverage you still need to use at least two of them. If your goal is to have the best balance of small filesize and high quality, based on extensive production testing, your best bet is to default to `webm` and fallback to `mp3`. `webm` has nearly full browser coverage with a great combination of compression and quality. You'll need the `mp3` fallback for Internet Explorer.
+
+It is important to remember that howler.js selects the first compatible sound from your array of sources. So if you want `webm` to be used before `mp3`, you need to put the sources in that order.
+
+If you want your `webm` files to be seekable in Firefox, be sure to encode them with the cues element. One way to do this is by using the `dash` flag in [ffmpeg](https://www.ffmpeg.org/):
+
+```
+ffmpeg -i sound1.wav -dash 1 sound1.webm
+```
+
+### Sponsors
+Support the ongoing development of howler.js and get your logo on our README with a link to your site [[become a sponsor](https://github.com/sponsors/goldfire)]. You can also become a backer at a lower tier and get your name in the [BACKERS](https://github.com/goldfire/howler.js/blob/master/BACKERS.md) list. All support is greatly appreciated!
+
+[![GoldFire Studios](https://s3.amazonaws.com/howler.js/sponsors/goldfire_studios.png "GoldFire Studios")](https://goldfirestudios.com)
+
+### License
+
+Copyright (c) 2013-2021 [James Simpson](https://twitter.com/GoldFireStudios) and [GoldFire Studios, Inc.](http://goldfirestudios.com)
+
+Released under the [MIT License](https://github.com/goldfire/howler.js/blob/master/LICENSE.md).

File diff suppressed because it is too large
+ 1 - 0
node_modules/howler/dist/howler.core.min.js


+ 3248 - 0
node_modules/howler/dist/howler.js

@@ -0,0 +1,3248 @@
+/*!
+ *  howler.js v2.2.4
+ *  howlerjs.com
+ *
+ *  (c) 2013-2020, James Simpson of GoldFire Studios
+ *  goldfirestudios.com
+ *
+ *  MIT License
+ */
+
+(function() {
+
+  'use strict';
+
+  /** Global Methods **/
+  /***************************************************************************/
+
+  /**
+   * Create the global controller. All contained methods and properties apply
+   * to all sounds that are currently playing or will be in the future.
+   */
+  var HowlerGlobal = function() {
+    this.init();
+  };
+  HowlerGlobal.prototype = {
+    /**
+     * Initialize the global Howler object.
+     * @return {Howler}
+     */
+    init: function() {
+      var self = this || Howler;
+
+      // Create a global ID counter.
+      self._counter = 1000;
+
+      // Pool of unlocked HTML5 Audio objects.
+      self._html5AudioPool = [];
+      self.html5PoolSize = 10;
+
+      // Internal properties.
+      self._codecs = {};
+      self._howls = [];
+      self._muted = false;
+      self._volume = 1;
+      self._canPlayEvent = 'canplaythrough';
+      self._navigator = (typeof window !== 'undefined' && window.navigator) ? window.navigator : null;
+
+      // Public properties.
+      self.masterGain = null;
+      self.noAudio = false;
+      self.usingWebAudio = true;
+      self.autoSuspend = true;
+      self.ctx = null;
+
+      // Set to false to disable the auto audio unlocker.
+      self.autoUnlock = true;
+
+      // Setup the various state values for global tracking.
+      self._setup();
+
+      return self;
+    },
+
+    /**
+     * Get/set the global volume for all sounds.
+     * @param  {Float} vol Volume from 0.0 to 1.0.
+     * @return {Howler/Float}     Returns self or current volume.
+     */
+    volume: function(vol) {
+      var self = this || Howler;
+      vol = parseFloat(vol);
+
+      // If we don't have an AudioContext created yet, run the setup.
+      if (!self.ctx) {
+        setupAudioContext();
+      }
+
+      if (typeof vol !== 'undefined' && vol >= 0 && vol <= 1) {
+        self._volume = vol;
+
+        // Don't update any of the nodes if we are muted.
+        if (self._muted) {
+          return self;
+        }
+
+        // When using Web Audio, we just need to adjust the master gain.
+        if (self.usingWebAudio) {
+          self.masterGain.gain.setValueAtTime(vol, Howler.ctx.currentTime);
+        }
+
+        // Loop through and change volume for all HTML5 audio nodes.
+        for (var i=0; i<self._howls.length; i++) {
+          if (!self._howls[i]._webAudio) {
+            // Get all of the sounds in this Howl group.
+            var ids = self._howls[i]._getSoundIds();
+
+            // Loop through all sounds and change the volumes.
+            for (var j=0; j<ids.length; j++) {
+              var sound = self._howls[i]._soundById(ids[j]);
+
+              if (sound && sound._node) {
+                sound._node.volume = sound._volume * vol;
+              }
+            }
+          }
+        }
+
+        return self;
+      }
+
+      return self._volume;
+    },
+
+    /**
+     * Handle muting and unmuting globally.
+     * @param  {Boolean} muted Is muted or not.
+     */
+    mute: function(muted) {
+      var self = this || Howler;
+
+      // If we don't have an AudioContext created yet, run the setup.
+      if (!self.ctx) {
+        setupAudioContext();
+      }
+
+      self._muted = muted;
+
+      // With Web Audio, we just need to mute the master gain.
+      if (self.usingWebAudio) {
+        self.masterGain.gain.setValueAtTime(muted ? 0 : self._volume, Howler.ctx.currentTime);
+      }
+
+      // Loop through and mute all HTML5 Audio nodes.
+      for (var i=0; i<self._howls.length; i++) {
+        if (!self._howls[i]._webAudio) {
+          // Get all of the sounds in this Howl group.
+          var ids = self._howls[i]._getSoundIds();
+
+          // Loop through all sounds and mark the audio node as muted.
+          for (var j=0; j<ids.length; j++) {
+            var sound = self._howls[i]._soundById(ids[j]);
+
+            if (sound && sound._node) {
+              sound._node.muted = (muted) ? true : sound._muted;
+            }
+          }
+        }
+      }
+
+      return self;
+    },
+
+    /**
+     * Handle stopping all sounds globally.
+     */
+    stop: function() {
+      var self = this || Howler;
+
+      // Loop through all Howls and stop them.
+      for (var i=0; i<self._howls.length; i++) {
+        self._howls[i].stop();
+      }
+
+      return self;
+    },
+
+    /**
+     * Unload and destroy all currently loaded Howl objects.
+     * @return {Howler}
+     */
+    unload: function() {
+      var self = this || Howler;
+
+      for (var i=self._howls.length-1; i>=0; i--) {
+        self._howls[i].unload();
+      }
+
+      // Create a new AudioContext to make sure it is fully reset.
+      if (self.usingWebAudio && self.ctx && typeof self.ctx.close !== 'undefined') {
+        self.ctx.close();
+        self.ctx = null;
+        setupAudioContext();
+      }
+
+      return self;
+    },
+
+    /**
+     * Check for codec support of specific extension.
+     * @param  {String} ext Audio file extention.
+     * @return {Boolean}
+     */
+    codecs: function(ext) {
+      return (this || Howler)._codecs[ext.replace(/^x-/, '')];
+    },
+
+    /**
+     * Setup various state values for global tracking.
+     * @return {Howler}
+     */
+    _setup: function() {
+      var self = this || Howler;
+
+      // Keeps track of the suspend/resume state of the AudioContext.
+      self.state = self.ctx ? self.ctx.state || 'suspended' : 'suspended';
+
+      // Automatically begin the 30-second suspend process
+      self._autoSuspend();
+
+      // Check if audio is available.
+      if (!self.usingWebAudio) {
+        // No audio is available on this system if noAudio is set to true.
+        if (typeof Audio !== 'undefined') {
+          try {
+            var test = new Audio();
+
+            // Check if the canplaythrough event is available.
+            if (typeof test.oncanplaythrough === 'undefined') {
+              self._canPlayEvent = 'canplay';
+            }
+          } catch(e) {
+            self.noAudio = true;
+          }
+        } else {
+          self.noAudio = true;
+        }
+      }
+
+      // Test to make sure audio isn't disabled in Internet Explorer.
+      try {
+        var test = new Audio();
+        if (test.muted) {
+          self.noAudio = true;
+        }
+      } catch (e) {}
+
+      // Check for supported codecs.
+      if (!self.noAudio) {
+        self._setupCodecs();
+      }
+
+      return self;
+    },
+
+    /**
+     * Check for browser support for various codecs and cache the results.
+     * @return {Howler}
+     */
+    _setupCodecs: function() {
+      var self = this || Howler;
+      var audioTest = null;
+
+      // Must wrap in a try/catch because IE11 in server mode throws an error.
+      try {
+        audioTest = (typeof Audio !== 'undefined') ? new Audio() : null;
+      } catch (err) {
+        return self;
+      }
+
+      if (!audioTest || typeof audioTest.canPlayType !== 'function') {
+        return self;
+      }
+
+      var mpegTest = audioTest.canPlayType('audio/mpeg;').replace(/^no$/, '');
+
+      // Opera version <33 has mixed MP3 support, so we need to check for and block it.
+      var ua = self._navigator ? self._navigator.userAgent : '';
+      var checkOpera = ua.match(/OPR\/(\d+)/g);
+      var isOldOpera = (checkOpera && parseInt(checkOpera[0].split('/')[1], 10) < 33);
+      var checkSafari = ua.indexOf('Safari') !== -1 && ua.indexOf('Chrome') === -1;
+      var safariVersion = ua.match(/Version\/(.*?) /);
+      var isOldSafari = (checkSafari && safariVersion && parseInt(safariVersion[1], 10) < 15);
+
+      self._codecs = {
+        mp3: !!(!isOldOpera && (mpegTest || audioTest.canPlayType('audio/mp3;').replace(/^no$/, ''))),
+        mpeg: !!mpegTest,
+        opus: !!audioTest.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ''),
+        ogg: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ''),
+        oga: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ''),
+        wav: !!(audioTest.canPlayType('audio/wav; codecs="1"') || audioTest.canPlayType('audio/wav')).replace(/^no$/, ''),
+        aac: !!audioTest.canPlayType('audio/aac;').replace(/^no$/, ''),
+        caf: !!audioTest.canPlayType('audio/x-caf;').replace(/^no$/, ''),
+        m4a: !!(audioTest.canPlayType('audio/x-m4a;') || audioTest.canPlayType('audio/m4a;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''),
+        m4b: !!(audioTest.canPlayType('audio/x-m4b;') || audioTest.canPlayType('audio/m4b;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''),
+        mp4: !!(audioTest.canPlayType('audio/x-mp4;') || audioTest.canPlayType('audio/mp4;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''),
+        weba: !!(!isOldSafari && audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, '')),
+        webm: !!(!isOldSafari && audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, '')),
+        dolby: !!audioTest.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ''),
+        flac: !!(audioTest.canPlayType('audio/x-flac;') || audioTest.canPlayType('audio/flac;')).replace(/^no$/, '')
+      };
+
+      return self;
+    },
+
+    /**
+     * Some browsers/devices will only allow audio to be played after a user interaction.
+     * Attempt to automatically unlock audio on the first user interaction.
+     * Concept from: http://paulbakaus.com/tutorials/html5/web-audio-on-ios/
+     * @return {Howler}
+     */
+    _unlockAudio: function() {
+      var self = this || Howler;
+
+      // Only run this if Web Audio is supported and it hasn't already been unlocked.
+      if (self._audioUnlocked || !self.ctx) {
+        return;
+      }
+
+      self._audioUnlocked = false;
+      self.autoUnlock = false;
+
+      // Some mobile devices/platforms have distortion issues when opening/closing tabs and/or web views.
+      // Bugs in the browser (especially Mobile Safari) can cause the sampleRate to change from 44100 to 48000.
+      // By calling Howler.unload(), we create a new AudioContext with the correct sampleRate.
+      if (!self._mobileUnloaded && self.ctx.sampleRate !== 44100) {
+        self._mobileUnloaded = true;
+        self.unload();
+      }
+
+      // Scratch buffer for enabling iOS to dispose of web audio buffers correctly, as per:
+      // http://stackoverflow.com/questions/24119684
+      self._scratchBuffer = self.ctx.createBuffer(1, 1, 22050);
+
+      // Call this method on touch start to create and play a buffer,
+      // then check if the audio actually played to determine if
+      // audio has now been unlocked on iOS, Android, etc.
+      var unlock = function(e) {
+        // Create a pool of unlocked HTML5 Audio objects that can
+        // be used for playing sounds without user interaction. HTML5
+        // Audio objects must be individually unlocked, as opposed
+        // to the WebAudio API which only needs a single activation.
+        // This must occur before WebAudio setup or the source.onended
+        // event will not fire.
+        while (self._html5AudioPool.length < self.html5PoolSize) {
+          try {
+            var audioNode = new Audio();
+
+            // Mark this Audio object as unlocked to ensure it can get returned
+            // to the unlocked pool when released.
+            audioNode._unlocked = true;
+
+            // Add the audio node to the pool.
+            self._releaseHtml5Audio(audioNode);
+          } catch (e) {
+            self.noAudio = true;
+            break;
+          }
+        }
+
+        // Loop through any assigned audio nodes and unlock them.
+        for (var i=0; i<self._howls.length; i++) {
+          if (!self._howls[i]._webAudio) {
+            // Get all of the sounds in this Howl group.
+            var ids = self._howls[i]._getSoundIds();
+
+            // Loop through all sounds and unlock the audio nodes.
+            for (var j=0; j<ids.length; j++) {
+              var sound = self._howls[i]._soundById(ids[j]);
+
+              if (sound && sound._node && !sound._node._unlocked) {
+                sound._node._unlocked = true;
+                sound._node.load();
+              }
+            }
+          }
+        }
+
+        // Fix Android can not play in suspend state.
+        self._autoResume();
+
+        // Create an empty buffer.
+        var source = self.ctx.createBufferSource();
+        source.buffer = self._scratchBuffer;
+        source.connect(self.ctx.destination);
+
+        // Play the empty buffer.
+        if (typeof source.start === 'undefined') {
+          source.noteOn(0);
+        } else {
+          source.start(0);
+        }
+
+        // Calling resume() on a stack initiated by user gesture is what actually unlocks the audio on Android Chrome >= 55.
+        if (typeof self.ctx.resume === 'function') {
+          self.ctx.resume();
+        }
+
+        // Setup a timeout to check that we are unlocked on the next event loop.
+        source.onended = function() {
+          source.disconnect(0);
+
+          // Update the unlocked state and prevent this check from happening again.
+          self._audioUnlocked = true;
+
+          // Remove the touch start listener.
+          document.removeEventListener('touchstart', unlock, true);
+          document.removeEventListener('touchend', unlock, true);
+          document.removeEventListener('click', unlock, true);
+          document.removeEventListener('keydown', unlock, true);
+
+          // Let all sounds know that audio has been unlocked.
+          for (var i=0; i<self._howls.length; i++) {
+            self._howls[i]._emit('unlock');
+          }
+        };
+      };
+
+      // Setup a touch start listener to attempt an unlock in.
+      document.addEventListener('touchstart', unlock, true);
+      document.addEventListener('touchend', unlock, true);
+      document.addEventListener('click', unlock, true);
+      document.addEventListener('keydown', unlock, true);
+
+      return self;
+    },
+
+    /**
+     * Get an unlocked HTML5 Audio object from the pool. If none are left,
+     * return a new Audio object and throw a warning.
+     * @return {Audio} HTML5 Audio object.
+     */
+    _obtainHtml5Audio: function() {
+      var self = this || Howler;
+
+      // Return the next object from the pool if one exists.
+      if (self._html5AudioPool.length) {
+        return self._html5AudioPool.pop();
+      }
+
+      //.Check if the audio is locked and throw a warning.
+      var testPlay = new Audio().play();
+      if (testPlay && typeof Promise !== 'undefined' && (testPlay instanceof Promise || typeof testPlay.then === 'function')) {
+        testPlay.catch(function() {
+          console.warn('HTML5 Audio pool exhausted, returning potentially locked audio object.');
+        });
+      }
+
+      return new Audio();
+    },
+
+    /**
+     * Return an activated HTML5 Audio object to the pool.
+     * @return {Howler}
+     */
+    _releaseHtml5Audio: function(audio) {
+      var self = this || Howler;
+
+      // Don't add audio to the pool if we don't know if it has been unlocked.
+      if (audio._unlocked) {
+        self._html5AudioPool.push(audio);
+      }
+
+      return self;
+    },
+
+    /**
+     * Automatically suspend the Web Audio AudioContext after no sound has played for 30 seconds.
+     * This saves processing/energy and fixes various browser-specific bugs with audio getting stuck.
+     * @return {Howler}
+     */
+    _autoSuspend: function() {
+      var self = this;
+
+      if (!self.autoSuspend || !self.ctx || typeof self.ctx.suspend === 'undefined' || !Howler.usingWebAudio) {
+        return;
+      }
+
+      // Check if any sounds are playing.
+      for (var i=0; i<self._howls.length; i++) {
+        if (self._howls[i]._webAudio) {
+          for (var j=0; j<self._howls[i]._sounds.length; j++) {
+            if (!self._howls[i]._sounds[j]._paused) {
+              return self;
+            }
+          }
+        }
+      }
+
+      if (self._suspendTimer) {
+        clearTimeout(self._suspendTimer);
+      }
+
+      // If no sound has played after 30 seconds, suspend the context.
+      self._suspendTimer = setTimeout(function() {
+        if (!self.autoSuspend) {
+          return;
+        }
+
+        self._suspendTimer = null;
+        self.state = 'suspending';
+
+        // Handle updating the state of the audio context after suspending.
+        var handleSuspension = function() {
+          self.state = 'suspended';
+
+          if (self._resumeAfterSuspend) {
+            delete self._resumeAfterSuspend;
+            self._autoResume();
+          }
+        };
+
+        // Either the state gets suspended or it is interrupted.
+        // Either way, we need to update the state to suspended.
+        self.ctx.suspend().then(handleSuspension, handleSuspension);
+      }, 30000);
+
+      return self;
+    },
+
+    /**
+     * Automatically resume the Web Audio AudioContext when a new sound is played.
+     * @return {Howler}
+     */
+    _autoResume: function() {
+      var self = this;
+
+      if (!self.ctx || typeof self.ctx.resume === 'undefined' || !Howler.usingWebAudio) {
+        return;
+      }
+
+      if (self.state === 'running' && self.ctx.state !== 'interrupted' && self._suspendTimer) {
+        clearTimeout(self._suspendTimer);
+        self._suspendTimer = null;
+      } else if (self.state === 'suspended' || self.state === 'running' && self.ctx.state === 'interrupted') {
+        self.ctx.resume().then(function() {
+          self.state = 'running';
+
+          // Emit to all Howls that the audio has resumed.
+          for (var i=0; i<self._howls.length; i++) {
+            self._howls[i]._emit('resume');
+          }
+        });
+
+        if (self._suspendTimer) {
+          clearTimeout(self._suspendTimer);
+          self._suspendTimer = null;
+        }
+      } else if (self.state === 'suspending') {
+        self._resumeAfterSuspend = true;
+      }
+
+      return self;
+    }
+  };
+
+  // Setup the global audio controller.
+  var Howler = new HowlerGlobal();
+
+  /** Group Methods **/
+  /***************************************************************************/
+
+  /**
+   * Create an audio group controller.
+   * @param {Object} o Passed in properties for this group.
+   */
+  var Howl = function(o) {
+    var self = this;
+
+    // Throw an error if no source is provided.
+    if (!o.src || o.src.length === 0) {
+      console.error('An array of source files must be passed with any new Howl.');
+      return;
+    }
+
+    self.init(o);
+  };
+  Howl.prototype = {
+    /**
+     * Initialize a new Howl group object.
+     * @param  {Object} o Passed in properties for this group.
+     * @return {Howl}
+     */
+    init: function(o) {
+      var self = this;
+
+      // If we don't have an AudioContext created yet, run the setup.
+      if (!Howler.ctx) {
+        setupAudioContext();
+      }
+
+      // Setup user-defined default properties.
+      self._autoplay = o.autoplay || false;
+      self._format = (typeof o.format !== 'string') ? o.format : [o.format];
+      self._html5 = o.html5 || false;
+      self._muted = o.mute || false;
+      self._loop = o.loop || false;
+      self._pool = o.pool || 5;
+      self._preload = (typeof o.preload === 'boolean' || o.preload === 'metadata') ? o.preload : true;
+      self._rate = o.rate || 1;
+      self._sprite = o.sprite || {};
+      self._src = (typeof o.src !== 'string') ? o.src : [o.src];
+      self._volume = o.volume !== undefined ? o.volume : 1;
+      self._xhr = {
+        method: o.xhr && o.xhr.method ? o.xhr.method : 'GET',
+        headers: o.xhr && o.xhr.headers ? o.xhr.headers : null,
+        withCredentials: o.xhr && o.xhr.withCredentials ? o.xhr.withCredentials : false,
+      };
+
+      // Setup all other default properties.
+      self._duration = 0;
+      self._state = 'unloaded';
+      self._sounds = [];
+      self._endTimers = {};
+      self._queue = [];
+      self._playLock = false;
+
+      // Setup event listeners.
+      self._onend = o.onend ? [{fn: o.onend}] : [];
+      self._onfade = o.onfade ? [{fn: o.onfade}] : [];
+      self._onload = o.onload ? [{fn: o.onload}] : [];
+      self._onloaderror = o.onloaderror ? [{fn: o.onloaderror}] : [];
+      self._onplayerror = o.onplayerror ? [{fn: o.onplayerror}] : [];
+      self._onpause = o.onpause ? [{fn: o.onpause}] : [];
+      self._onplay = o.onplay ? [{fn: o.onplay}] : [];
+      self._onstop = o.onstop ? [{fn: o.onstop}] : [];
+      self._onmute = o.onmute ? [{fn: o.onmute}] : [];
+      self._onvolume = o.onvolume ? [{fn: o.onvolume}] : [];
+      self._onrate = o.onrate ? [{fn: o.onrate}] : [];
+      self._onseek = o.onseek ? [{fn: o.onseek}] : [];
+      self._onunlock = o.onunlock ? [{fn: o.onunlock}] : [];
+      self._onresume = [];
+
+      // Web Audio or HTML5 Audio?
+      self._webAudio = Howler.usingWebAudio && !self._html5;
+
+      // Automatically try to enable audio.
+      if (typeof Howler.ctx !== 'undefined' && Howler.ctx && Howler.autoUnlock) {
+        Howler._unlockAudio();
+      }
+
+      // Keep track of this Howl group in the global controller.
+      Howler._howls.push(self);
+
+      // If they selected autoplay, add a play event to the load queue.
+      if (self._autoplay) {
+        self._queue.push({
+          event: 'play',
+          action: function() {
+            self.play();
+          }
+        });
+      }
+
+      // Load the source file unless otherwise specified.
+      if (self._preload && self._preload !== 'none') {
+        self.load();
+      }
+
+      return self;
+    },
+
+    /**
+     * Load the audio file.
+     * @return {Howler}
+     */
+    load: function() {
+      var self = this;
+      var url = null;
+
+      // If no audio is available, quit immediately.
+      if (Howler.noAudio) {
+        self._emit('loaderror', null, 'No audio support.');
+        return;
+      }
+
+      // Make sure our source is in an array.
+      if (typeof self._src === 'string') {
+        self._src = [self._src];
+      }
+
+      // Loop through the sources and pick the first one that is compatible.
+      for (var i=0; i<self._src.length; i++) {
+        var ext, str;
+
+        if (self._format && self._format[i]) {
+          // If an extension was specified, use that instead.
+          ext = self._format[i];
+        } else {
+          // Make sure the source is a string.
+          str = self._src[i];
+          if (typeof str !== 'string') {
+            self._emit('loaderror', null, 'Non-string found in selected audio sources - ignoring.');
+            continue;
+          }
+
+          // Extract the file extension from the URL or base64 data URI.
+          ext = /^data:audio\/([^;,]+);/i.exec(str);
+          if (!ext) {
+            ext = /\.([^.]+)$/.exec(str.split('?', 1)[0]);
+          }
+
+          if (ext) {
+            ext = ext[1].toLowerCase();
+          }
+        }
+
+        // Log a warning if no extension was found.
+        if (!ext) {
+          console.warn('No file extension was found. Consider using the "format" property or specify an extension.');
+        }
+
+        // Check if this extension is available.
+        if (ext && Howler.codecs(ext)) {
+          url = self._src[i];
+          break;
+        }
+      }
+
+      if (!url) {
+        self._emit('loaderror', null, 'No codec support for selected audio sources.');
+        return;
+      }
+
+      self._src = url;
+      self._state = 'loading';
+
+      // If the hosting page is HTTPS and the source isn't,
+      // drop down to HTML5 Audio to avoid Mixed Content errors.
+      if (window.location.protocol === 'https:' && url.slice(0, 5) === 'http:') {
+        self._html5 = true;
+        self._webAudio = false;
+      }
+
+      // Create a new sound object and add it to the pool.
+      new Sound(self);
+
+      // Load and decode the audio data for playback.
+      if (self._webAudio) {
+        loadBuffer(self);
+      }
+
+      return self;
+    },
+
+    /**
+     * Play a sound or resume previous playback.
+     * @param  {String/Number} sprite   Sprite name for sprite playback or sound id to continue previous.
+     * @param  {Boolean} internal Internal Use: true prevents event firing.
+     * @return {Number}          Sound ID.
+     */
+    play: function(sprite, internal) {
+      var self = this;
+      var id = null;
+
+      // Determine if a sprite, sound id or nothing was passed
+      if (typeof sprite === 'number') {
+        id = sprite;
+        sprite = null;
+      } else if (typeof sprite === 'string' && self._state === 'loaded' && !self._sprite[sprite]) {
+        // If the passed sprite doesn't exist, do nothing.
+        return null;
+      } else if (typeof sprite === 'undefined') {
+        // Use the default sound sprite (plays the full audio length).
+        sprite = '__default';
+
+        // Check if there is a single paused sound that isn't ended.
+        // If there is, play that sound. If not, continue as usual.
+        if (!self._playLock) {
+          var num = 0;
+          for (var i=0; i<self._sounds.length; i++) {
+            if (self._sounds[i]._paused && !self._sounds[i]._ended) {
+              num++;
+              id = self._sounds[i]._id;
+            }
+          }
+
+          if (num === 1) {
+            sprite = null;
+          } else {
+            id = null;
+          }
+        }
+      }
+
+      // Get the selected node, or get one from the pool.
+      var sound = id ? self._soundById(id) : self._inactiveSound();
+
+      // If the sound doesn't exist, do nothing.
+      if (!sound) {
+        return null;
+      }
+
+      // Select the sprite definition.
+      if (id && !sprite) {
+        sprite = sound._sprite || '__default';
+      }
+
+      // If the sound hasn't loaded, we must wait to get the audio's duration.
+      // We also need to wait to make sure we don't run into race conditions with
+      // the order of function calls.
+      if (self._state !== 'loaded') {
+        // Set the sprite value on this sound.
+        sound._sprite = sprite;
+
+        // Mark this sound as not ended in case another sound is played before this one loads.
+        sound._ended = false;
+
+        // Add the sound to the queue to be played on load.
+        var soundId = sound._id;
+        self._queue.push({
+          event: 'play',
+          action: function() {
+            self.play(soundId);
+          }
+        });
+
+        return soundId;
+      }
+
+      // Don't play the sound if an id was passed and it is already playing.
+      if (id && !sound._paused) {
+        // Trigger the play event, in order to keep iterating through queue.
+        if (!internal) {
+          self._loadQueue('play');
+        }
+
+        return sound._id;
+      }
+
+      // Make sure the AudioContext isn't suspended, and resume it if it is.
+      if (self._webAudio) {
+        Howler._autoResume();
+      }
+
+      // Determine how long to play for and where to start playing.
+      var seek = Math.max(0, sound._seek > 0 ? sound._seek : self._sprite[sprite][0] / 1000);
+      var duration = Math.max(0, ((self._sprite[sprite][0] + self._sprite[sprite][1]) / 1000) - seek);
+      var timeout = (duration * 1000) / Math.abs(sound._rate);
+      var start = self._sprite[sprite][0] / 1000;
+      var stop = (self._sprite[sprite][0] + self._sprite[sprite][1]) / 1000;
+      sound._sprite = sprite;
+
+      // Mark the sound as ended instantly so that this async playback
+      // doesn't get grabbed by another call to play while this one waits to start.
+      sound._ended = false;
+
+      // Update the parameters of the sound.
+      var setParams = function() {
+        sound._paused = false;
+        sound._seek = seek;
+        sound._start = start;
+        sound._stop = stop;
+        sound._loop = !!(sound._loop || self._sprite[sprite][2]);
+      };
+
+      // End the sound instantly if seek is at the end.
+      if (seek >= stop) {
+        self._ended(sound);
+        return;
+      }
+
+      // Begin the actual playback.
+      var node = sound._node;
+      if (self._webAudio) {
+        // Fire this when the sound is ready to play to begin Web Audio playback.
+        var playWebAudio = function() {
+          self._playLock = false;
+          setParams();
+          self._refreshBuffer(sound);
+
+          // Setup the playback params.
+          var vol = (sound._muted || self._muted) ? 0 : sound._volume;
+          node.gain.setValueAtTime(vol, Howler.ctx.currentTime);
+          sound._playStart = Howler.ctx.currentTime;
+
+          // Play the sound using the supported method.
+          if (typeof node.bufferSource.start === 'undefined') {
+            sound._loop ? node.bufferSource.noteGrainOn(0, seek, 86400) : node.bufferSource.noteGrainOn(0, seek, duration);
+          } else {
+            sound._loop ? node.bufferSource.start(0, seek, 86400) : node.bufferSource.start(0, seek, duration);
+          }
+
+          // Start a new timer if none is present.
+          if (timeout !== Infinity) {
+            self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
+          }
+
+          if (!internal) {
+            setTimeout(function() {
+              self._emit('play', sound._id);
+              self._loadQueue();
+            }, 0);
+          }
+        };
+
+        if (Howler.state === 'running' && Howler.ctx.state !== 'interrupted') {
+          playWebAudio();
+        } else {
+          self._playLock = true;
+
+          // Wait for the audio context to resume before playing.
+          self.once('resume', playWebAudio);
+
+          // Cancel the end timer.
+          self._clearTimer(sound._id);
+        }
+      } else {
+        // Fire this when the sound is ready to play to begin HTML5 Audio playback.
+        var playHtml5 = function() {
+          node.currentTime = seek;
+          node.muted = sound._muted || self._muted || Howler._muted || node.muted;
+          node.volume = sound._volume * Howler.volume();
+          node.playbackRate = sound._rate;
+
+          // Some browsers will throw an error if this is called without user interaction.
+          try {
+            var play = node.play();
+
+            // Support older browsers that don't support promises, and thus don't have this issue.
+            if (play && typeof Promise !== 'undefined' && (play instanceof Promise || typeof play.then === 'function')) {
+              // Implements a lock to prevent DOMException: The play() request was interrupted by a call to pause().
+              self._playLock = true;
+
+              // Set param values immediately.
+              setParams();
+
+              // Releases the lock and executes queued actions.
+              play
+                .then(function() {
+                  self._playLock = false;
+                  node._unlocked = true;
+                  if (!internal) {
+                    self._emit('play', sound._id);
+                  } else {
+                    self._loadQueue();
+                  }
+                })
+                .catch(function() {
+                  self._playLock = false;
+                  self._emit('playerror', sound._id, 'Playback was unable to start. This is most commonly an issue ' +
+                    'on mobile devices and Chrome where playback was not within a user interaction.');
+
+                  // Reset the ended and paused values.
+                  sound._ended = true;
+                  sound._paused = true;
+                });
+            } else if (!internal) {
+              self._playLock = false;
+              setParams();
+              self._emit('play', sound._id);
+            }
+
+            // Setting rate before playing won't work in IE, so we set it again here.
+            node.playbackRate = sound._rate;
+
+            // If the node is still paused, then we can assume there was a playback issue.
+            if (node.paused) {
+              self._emit('playerror', sound._id, 'Playback was unable to start. This is most commonly an issue ' +
+                'on mobile devices and Chrome where playback was not within a user interaction.');
+              return;
+            }
+
+            // Setup the end timer on sprites or listen for the ended event.
+            if (sprite !== '__default' || sound._loop) {
+              self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
+            } else {
+              self._endTimers[sound._id] = function() {
+                // Fire ended on this audio node.
+                self._ended(sound);
+
+                // Clear this listener.
+                node.removeEventListener('ended', self._endTimers[sound._id], false);
+              };
+              node.addEventListener('ended', self._endTimers[sound._id], false);
+            }
+          } catch (err) {
+            self._emit('playerror', sound._id, err);
+          }
+        };
+
+        // If this is streaming audio, make sure the src is set and load again.
+        if (node.src === 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA') {
+          node.src = self._src;
+          node.load();
+        }
+
+        // Play immediately if ready, or wait for the 'canplaythrough'e vent.
+        var loadedNoReadyState = (window && window.ejecta) || (!node.readyState && Howler._navigator.isCocoonJS);
+        if (node.readyState >= 3 || loadedNoReadyState) {
+          playHtml5();
+        } else {
+          self._playLock = true;
+          self._state = 'loading';
+
+          var listener = function() {
+            self._state = 'loaded';
+            
+            // Begin playback.
+            playHtml5();
+
+            // Clear this listener.
+            node.removeEventListener(Howler._canPlayEvent, listener, false);
+          };
+          node.addEventListener(Howler._canPlayEvent, listener, false);
+
+          // Cancel the end timer.
+          self._clearTimer(sound._id);
+        }
+      }
+
+      return sound._id;
+    },
+
+    /**
+     * Pause playback and save current position.
+     * @param  {Number} id The sound ID (empty to pause all in group).
+     * @return {Howl}
+     */
+    pause: function(id) {
+      var self = this;
+
+      // If the sound hasn't loaded or a play() promise is pending, add it to the load queue to pause when capable.
+      if (self._state !== 'loaded' || self._playLock) {
+        self._queue.push({
+          event: 'pause',
+          action: function() {
+            self.pause(id);
+          }
+        });
+
+        return self;
+      }
+
+      // If no id is passed, get all ID's to be paused.
+      var ids = self._getSoundIds(id);
+
+      for (var i=0; i<ids.length; i++) {
+        // Clear the end timer.
+        self._clearTimer(ids[i]);
+
+        // Get the sound.
+        var sound = self._soundById(ids[i]);
+
+        if (sound && !sound._paused) {
+          // Reset the seek position.
+          sound._seek = self.seek(ids[i]);
+          sound._rateSeek = 0;
+          sound._paused = true;
+
+          // Stop currently running fades.
+          self._stopFade(ids[i]);
+
+          if (sound._node) {
+            if (self._webAudio) {
+              // Make sure the sound has been created.
+              if (!sound._node.bufferSource) {
+                continue;
+              }
+
+              if (typeof sound._node.bufferSource.stop === 'undefined') {
+                sound._node.bufferSource.noteOff(0);
+              } else {
+                sound._node.bufferSource.stop(0);
+              }
+
+              // Clean up the buffer source.
+              self._cleanBuffer(sound._node);
+            } else if (!isNaN(sound._node.duration) || sound._node.duration === Infinity) {
+              sound._node.pause();
+            }
+          }
+        }
+
+        // Fire the pause event, unless `true` is passed as the 2nd argument.
+        if (!arguments[1]) {
+          self._emit('pause', sound ? sound._id : null);
+        }
+      }
+
+      return self;
+    },
+
+    /**
+     * Stop playback and reset to start.
+     * @param  {Number} id The sound ID (empty to stop all in group).
+     * @param  {Boolean} internal Internal Use: true prevents event firing.
+     * @return {Howl}
+     */
+    stop: function(id, internal) {
+      var self = this;
+
+      // If the sound hasn't loaded, add it to the load queue to stop when capable.
+      if (self._state !== 'loaded' || self._playLock) {
+        self._queue.push({
+          event: 'stop',
+          action: function() {
+            self.stop(id);
+          }
+        });
+
+        return self;
+      }
+
+      // If no id is passed, get all ID's to be stopped.
+      var ids = self._getSoundIds(id);
+
+      for (var i=0; i<ids.length; i++) {
+        // Clear the end timer.
+        self._clearTimer(ids[i]);
+
+        // Get the sound.
+        var sound = self._soundById(ids[i]);
+
+        if (sound) {
+          // Reset the seek position.
+          sound._seek = sound._start || 0;
+          sound._rateSeek = 0;
+          sound._paused = true;
+          sound._ended = true;
+
+          // Stop currently running fades.
+          self._stopFade(ids[i]);
+
+          if (sound._node) {
+            if (self._webAudio) {
+              // Make sure the sound's AudioBufferSourceNode has been created.
+              if (sound._node.bufferSource) {
+                if (typeof sound._node.bufferSource.stop === 'undefined') {
+                  sound._node.bufferSource.noteOff(0);
+                } else {
+                  sound._node.bufferSource.stop(0);
+                }
+
+                // Clean up the buffer source.
+                self._cleanBuffer(sound._node);
+              }
+            } else if (!isNaN(sound._node.duration) || sound._node.duration === Infinity) {
+              sound._node.currentTime = sound._start || 0;
+              sound._node.pause();
+
+              // If this is a live stream, stop download once the audio is stopped.
+              if (sound._node.duration === Infinity) {
+                self._clearSound(sound._node);
+              }
+            }
+          }
+
+          if (!internal) {
+            self._emit('stop', sound._id);
+          }
+        }
+      }
+
+      return self;
+    },
+
+    /**
+     * Mute/unmute a single sound or all sounds in this Howl group.
+     * @param  {Boolean} muted Set to true to mute and false to unmute.
+     * @param  {Number} id    The sound ID to update (omit to mute/unmute all).
+     * @return {Howl}
+     */
+    mute: function(muted, id) {
+      var self = this;
+
+      // If the sound hasn't loaded, add it to the load queue to mute when capable.
+      if (self._state !== 'loaded'|| self._playLock) {
+        self._queue.push({
+          event: 'mute',
+          action: function() {
+            self.mute(muted, id);
+          }
+        });
+
+        return self;
+      }
+
+      // If applying mute/unmute to all sounds, update the group's value.
+      if (typeof id === 'undefined') {
+        if (typeof muted === 'boolean') {
+          self._muted = muted;
+        } else {
+          return self._muted;
+        }
+      }
+
+      // If no id is passed, get all ID's to be muted.
+      var ids = self._getSoundIds(id);
+
+      for (var i=0; i<ids.length; i++) {
+        // Get the sound.
+        var sound = self._soundById(ids[i]);
+
+        if (sound) {
+          sound._muted = muted;
+
+          // Cancel active fade and set the volume to the end value.
+          if (sound._interval) {
+            self._stopFade(sound._id);
+          }
+
+          if (self._webAudio && sound._node) {
+            sound._node.gain.setValueAtTime(muted ? 0 : sound._volume, Howler.ctx.currentTime);
+          } else if (sound._node) {
+            sound._node.muted = Howler._muted ? true : muted;
+          }
+
+          self._emit('mute', sound._id);
+        }
+      }
+
+      return self;
+    },
+
+    /**
+     * Get/set the volume of this sound or of the Howl group. This method can optionally take 0, 1 or 2 arguments.
+     *   volume() -> Returns the group's volume value.
+     *   volume(id) -> Returns the sound id's current volume.
+     *   volume(vol) -> Sets the volume of all sounds in this Howl group.
+     *   volume(vol, id) -> Sets the volume of passed sound id.
+     * @return {Howl/Number} Returns self or current volume.
+     */
+    volume: function() {
+      var self = this;
+      var args = arguments;
+      var vol, id;
+
+      // Determine the values based on arguments.
+      if (args.length === 0) {
+        // Return the value of the groups' volume.
+        return self._volume;
+      } else if (args.length === 1 || args.length === 2 && typeof args[1] === 'undefined') {
+        // First check if this is an ID, and if not, assume it is a new volume.
+        var ids = self._getSoundIds();
+        var index = ids.indexOf(args[0]);
+        if (index >= 0) {
+          id = parseInt(args[0], 10);
+        } else {
+          vol = parseFloat(args[0]);
+        }
+      } else if (args.length >= 2) {
+        vol = parseFloat(args[0]);
+        id = parseInt(args[1], 10);
+      }
+
+      // Update the volume or return the current volume.
+      var sound;
+      if (typeof vol !== 'undefined' && vol >= 0 && vol <= 1) {
+        // If the sound hasn't loaded, add it to the load queue to change volume when capable.
+        if (self._state !== 'loaded'|| self._playLock) {
+          self._queue.push({
+            event: 'volume',
+            action: function() {
+              self.volume.apply(self, args);
+            }
+          });
+
+          return self;
+        }
+
+        // Set the group volume.
+        if (typeof id === 'undefined') {
+          self._volume = vol;
+        }
+
+        // Update one or all volumes.
+        id = self._getSoundIds(id);
+        for (var i=0; i<id.length; i++) {
+          // Get the sound.
+          sound = self._soundById(id[i]);
+
+          if (sound) {
+            sound._volume = vol;
+
+            // Stop currently running fades.
+            if (!args[2]) {
+              self._stopFade(id[i]);
+            }
+
+            if (self._webAudio && sound._node && !sound._muted) {
+              sound._node.gain.setValueAtTime(vol, Howler.ctx.currentTime);
+            } else if (sound._node && !sound._muted) {
+              sound._node.volume = vol * Howler.volume();
+            }
+
+            self._emit('volume', sound._id);
+          }
+        }
+      } else {
+        sound = id ? self._soundById(id) : self._sounds[0];
+        return sound ? sound._volume : 0;
+      }
+
+      return self;
+    },
+
+    /**
+     * Fade a currently playing sound between two volumes (if no id is passed, all sounds will fade).
+     * @param  {Number} from The value to fade from (0.0 to 1.0).
+     * @param  {Number} to   The volume to fade to (0.0 to 1.0).
+     * @param  {Number} len  Time in milliseconds to fade.
+     * @param  {Number} id   The sound id (omit to fade all sounds).
+     * @return {Howl}
+     */
+    fade: function(from, to, len, id) {
+      var self = this;
+
+      // If the sound hasn't loaded, add it to the load queue to fade when capable.
+      if (self._state !== 'loaded' || self._playLock) {
+        self._queue.push({
+          event: 'fade',
+          action: function() {
+            self.fade(from, to, len, id);
+          }
+        });
+
+        return self;
+      }
+
+      // Make sure the to/from/len values are numbers.
+      from = Math.min(Math.max(0, parseFloat(from)), 1);
+      to = Math.min(Math.max(0, parseFloat(to)), 1);
+      len = parseFloat(len);
+
+      // Set the volume to the start position.
+      self.volume(from, id);
+
+      // Fade the volume of one or all sounds.
+      var ids = self._getSoundIds(id);
+      for (var i=0; i<ids.length; i++) {
+        // Get the sound.
+        var sound = self._soundById(ids[i]);
+
+        // Create a linear fade or fall back to timeouts with HTML5 Audio.
+        if (sound) {
+          // Stop the previous fade if no sprite is being used (otherwise, volume handles this).
+          if (!id) {
+            self._stopFade(ids[i]);
+          }
+
+          // If we are using Web Audio, let the native methods do the actual fade.
+          if (self._webAudio && !sound._muted) {
+            var currentTime = Howler.ctx.currentTime;
+            var end = currentTime + (len / 1000);
+            sound._volume = from;
+            sound._node.gain.setValueAtTime(from, currentTime);
+            sound._node.gain.linearRampToValueAtTime(to, end);
+          }
+
+          self._startFadeInterval(sound, from, to, len, ids[i], typeof id === 'undefined');
+        }
+      }
+
+      return self;
+    },
+
+    /**
+     * Starts the internal interval to fade a sound.
+     * @param  {Object} sound Reference to sound to fade.
+     * @param  {Number} from The value to fade from (0.0 to 1.0).
+     * @param  {Number} to   The volume to fade to (0.0 to 1.0).
+     * @param  {Number} len  Time in milliseconds to fade.
+     * @param  {Number} id   The sound id to fade.
+     * @param  {Boolean} isGroup   If true, set the volume on the group.
+     */
+    _startFadeInterval: function(sound, from, to, len, id, isGroup) {
+      var self = this;
+      var vol = from;
+      var diff = to - from;
+      var steps = Math.abs(diff / 0.01);
+      var stepLen = Math.max(4, (steps > 0) ? len / steps : len);
+      var lastTick = Date.now();
+
+      // Store the value being faded to.
+      sound._fadeTo = to;
+
+      // Update the volume value on each interval tick.
+      sound._interval = setInterval(function() {
+        // Update the volume based on the time since the last tick.
+        var tick = (Date.now() - lastTick) / len;
+        lastTick = Date.now();
+        vol += diff * tick;
+
+        // Round to within 2 decimal points.
+        vol = Math.round(vol * 100) / 100;
+
+        // Make sure the volume is in the right bounds.
+        if (diff < 0) {
+          vol = Math.max(to, vol);
+        } else {
+          vol = Math.min(to, vol);
+        }
+
+        // Change the volume.
+        if (self._webAudio) {
+          sound._volume = vol;
+        } else {
+          self.volume(vol, sound._id, true);
+        }
+
+        // Set the group's volume.
+        if (isGroup) {
+          self._volume = vol;
+        }
+
+        // When the fade is complete, stop it and fire event.
+        if ((to < from && vol <= to) || (to > from && vol >= to)) {
+          clearInterval(sound._interval);
+          sound._interval = null;
+          sound._fadeTo = null;
+          self.volume(to, sound._id);
+          self._emit('fade', sound._id);
+        }
+      }, stepLen);
+    },
+
+    /**
+     * Internal method that stops the currently playing fade when
+     * a new fade starts, volume is changed or the sound is stopped.
+     * @param  {Number} id The sound id.
+     * @return {Howl}
+     */
+    _stopFade: function(id) {
+      var self = this;
+      var sound = self._soundById(id);
+
+      if (sound && sound._interval) {
+        if (self._webAudio) {
+          sound._node.gain.cancelScheduledValues(Howler.ctx.currentTime);
+        }
+
+        clearInterval(sound._interval);
+        sound._interval = null;
+        self.volume(sound._fadeTo, id);
+        sound._fadeTo = null;
+        self._emit('fade', id);
+      }
+
+      return self;
+    },
+
+    /**
+     * Get/set the loop parameter on a sound. This method can optionally take 0, 1 or 2 arguments.
+     *   loop() -> Returns the group's loop value.
+     *   loop(id) -> Returns the sound id's loop value.
+     *   loop(loop) -> Sets the loop value for all sounds in this Howl group.
+     *   loop(loop, id) -> Sets the loop value of passed sound id.
+     * @return {Howl/Boolean} Returns self or current loop value.
+     */
+    loop: function() {
+      var self = this;
+      var args = arguments;
+      var loop, id, sound;
+
+      // Determine the values for loop and id.
+      if (args.length === 0) {
+        // Return the grou's loop value.
+        return self._loop;
+      } else if (args.length === 1) {
+        if (typeof args[0] === 'boolean') {
+          loop = args[0];
+          self._loop = loop;
+        } else {
+          // Return this sound's loop value.
+          sound = self._soundById(parseInt(args[0], 10));
+          return sound ? sound._loop : false;
+        }
+      } else if (args.length === 2) {
+        loop = args[0];
+        id = parseInt(args[1], 10);
+      }
+
+      // If no id is passed, get all ID's to be looped.
+      var ids = self._getSoundIds(id);
+      for (var i=0; i<ids.length; i++) {
+        sound = self._soundById(ids[i]);
+
+        if (sound) {
+          sound._loop = loop;
+          if (self._webAudio && sound._node && sound._node.bufferSource) {
+            sound._node.bufferSource.loop = loop;
+            if (loop) {
+              sound._node.bufferSource.loopStart = sound._start || 0;
+              sound._node.bufferSource.loopEnd = sound._stop;
+
+              // If playing, restart playback to ensure looping updates.
+              if (self.playing(ids[i])) {
+                self.pause(ids[i], true);
+                self.play(ids[i], true);
+              }
+            }
+          }
+        }
+      }
+
+      return self;
+    },
+
+    /**
+     * Get/set the playback rate of a sound. This method can optionally take 0, 1 or 2 arguments.
+     *   rate() -> Returns the first sound node's current playback rate.
+     *   rate(id) -> Returns the sound id's current playback rate.
+     *   rate(rate) -> Sets the playback rate of all sounds in this Howl group.
+     *   rate(rate, id) -> Sets the playback rate of passed sound id.
+     * @return {Howl/Number} Returns self or the current playback rate.
+     */
+    rate: function() {
+      var self = this;
+      var args = arguments;
+      var rate, id;
+
+      // Determine the values based on arguments.
+      if (args.length === 0) {
+        // We will simply return the current rate of the first node.
+        id = self._sounds[0]._id;
+      } else if (args.length === 1) {
+        // First check if this is an ID, and if not, assume it is a new rate value.
+        var ids = self._getSoundIds();
+        var index = ids.indexOf(args[0]);
+        if (index >= 0) {
+          id = parseInt(args[0], 10);
+        } else {
+          rate = parseFloat(args[0]);
+        }
+      } else if (args.length === 2) {
+        rate = parseFloat(args[0]);
+        id = parseInt(args[1], 10);
+      }
+
+      // Update the playback rate or return the current value.
+      var sound;
+      if (typeof rate === 'number') {
+        // If the sound hasn't loaded, add it to the load queue to change playback rate when capable.
+        if (self._state !== 'loaded' || self._playLock) {
+          self._queue.push({
+            event: 'rate',
+            action: function() {
+              self.rate.apply(self, args);
+            }
+          });
+
+          return self;
+        }
+
+        // Set the group rate.
+        if (typeof id === 'undefined') {
+          self._rate = rate;
+        }
+
+        // Update one or all volumes.
+        id = self._getSoundIds(id);
+        for (var i=0; i<id.length; i++) {
+          // Get the sound.
+          sound = self._soundById(id[i]);
+
+          if (sound) {
+            // Keep track of our position when the rate changed and update the playback
+            // start position so we can properly adjust the seek position for time elapsed.
+            if (self.playing(id[i])) {
+              sound._rateSeek = self.seek(id[i]);
+              sound._playStart = self._webAudio ? Howler.ctx.currentTime : sound._playStart;
+            }
+            sound._rate = rate;
+
+            // Change the playback rate.
+            if (self._webAudio && sound._node && sound._node.bufferSource) {
+              sound._node.bufferSource.playbackRate.setValueAtTime(rate, Howler.ctx.currentTime);
+            } else if (sound._node) {
+              sound._node.playbackRate = rate;
+            }
+
+            // Reset the timers.
+            var seek = self.seek(id[i]);
+            var duration = ((self._sprite[sound._sprite][0] + self._sprite[sound._sprite][1]) / 1000) - seek;
+            var timeout = (duration * 1000) / Math.abs(sound._rate);
+
+            // Start a new end timer if sound is already playing.
+            if (self._endTimers[id[i]] || !sound._paused) {
+              self._clearTimer(id[i]);
+              self._endTimers[id[i]] = setTimeout(self._ended.bind(self, sound), timeout);
+            }
+
+            self._emit('rate', sound._id);
+          }
+        }
+      } else {
+        sound = self._soundById(id);
+        return sound ? sound._rate : self._rate;
+      }
+
+      return self;
+    },
+
+    /**
+     * Get/set the seek position of a sound. This method can optionally take 0, 1 or 2 arguments.
+     *   seek() -> Returns the first sound node's current seek position.
+     *   seek(id) -> Returns the sound id's current seek position.
+     *   seek(seek) -> Sets the seek position of the first sound node.
+     *   seek(seek, id) -> Sets the seek position of passed sound id.
+     * @return {Howl/Number} Returns self or the current seek position.
+     */
+    seek: function() {
+      var self = this;
+      var args = arguments;
+      var seek, id;
+
+      // Determine the values based on arguments.
+      if (args.length === 0) {
+        // We will simply return the current position of the first node.
+        if (self._sounds.length) {
+          id = self._sounds[0]._id;
+        }
+      } else if (args.length === 1) {
+        // First check if this is an ID, and if not, assume it is a new seek position.
+        var ids = self._getSoundIds();
+        var index = ids.indexOf(args[0]);
+        if (index >= 0) {
+          id = parseInt(args[0], 10);
+        } else if (self._sounds.length) {
+          id = self._sounds[0]._id;
+          seek = parseFloat(args[0]);
+        }
+      } else if (args.length === 2) {
+        seek = parseFloat(args[0]);
+        id = parseInt(args[1], 10);
+      }
+
+      // If there is no ID, bail out.
+      if (typeof id === 'undefined') {
+        return 0;
+      }
+
+      // If the sound hasn't loaded, add it to the load queue to seek when capable.
+      if (typeof seek === 'number' && (self._state !== 'loaded' || self._playLock)) {
+        self._queue.push({
+          event: 'seek',
+          action: function() {
+            self.seek.apply(self, args);
+          }
+        });
+
+        return self;
+      }
+
+      // Get the sound.
+      var sound = self._soundById(id);
+
+      if (sound) {
+        if (typeof seek === 'number' && seek >= 0) {
+          // Pause the sound and update position for restarting playback.
+          var playing = self.playing(id);
+          if (playing) {
+            self.pause(id, true);
+          }
+
+          // Move the position of the track and cancel timer.
+          sound._seek = seek;
+          sound._ended = false;
+          self._clearTimer(id);
+
+          // Update the seek position for HTML5 Audio.
+          if (!self._webAudio && sound._node && !isNaN(sound._node.duration)) {
+            sound._node.currentTime = seek;
+          }
+
+          // Seek and emit when ready.
+          var seekAndEmit = function() {
+            // Restart the playback if the sound was playing.
+            if (playing) {
+              self.play(id, true);
+            }
+
+            self._emit('seek', id);
+          };
+
+          // Wait for the play lock to be unset before emitting (HTML5 Audio).
+          if (playing && !self._webAudio) {
+            var emitSeek = function() {
+              if (!self._playLock) {
+                seekAndEmit();
+              } else {
+                setTimeout(emitSeek, 0);
+              }
+            };
+            setTimeout(emitSeek, 0);
+          } else {
+            seekAndEmit();
+          }
+        } else {
+          if (self._webAudio) {
+            var realTime = self.playing(id) ? Howler.ctx.currentTime - sound._playStart : 0;
+            var rateSeek = sound._rateSeek ? sound._rateSeek - sound._seek : 0;
+            return sound._seek + (rateSeek + realTime * Math.abs(sound._rate));
+          } else {
+            return sound._node.currentTime;
+          }
+        }
+      }
+
+      return self;
+    },
+
+    /**
+     * Check if a specific sound is currently playing or not (if id is provided), or check if at least one of the sounds in the group is playing or not.
+     * @param  {Number}  id The sound id to check. If none is passed, the whole sound group is checked.
+     * @return {Boolean} True if playing and false if not.
+     */
+    playing: function(id) {
+      var self = this;
+
+      // Check the passed sound ID (if any).
+      if (typeof id === 'number') {
+        var sound = self._soundById(id);
+        return sound ? !sound._paused : false;
+      }
+
+      // Otherwise, loop through all sounds and check if any are playing.
+      for (var i=0; i<self._sounds.length; i++) {
+        if (!self._sounds[i]._paused) {
+          return true;
+        }
+      }
+
+      return false;
+    },
+
+    /**
+     * Get the duration of this sound. Passing a sound id will return the sprite duration.
+     * @param  {Number} id The sound id to check. If none is passed, return full source duration.
+     * @return {Number} Audio duration in seconds.
+     */
+    duration: function(id) {
+      var self = this;
+      var duration = self._duration;
+
+      // If we pass an ID, get the sound and return the sprite length.
+      var sound = self._soundById(id);
+      if (sound) {
+        duration = self._sprite[sound._sprite][1] / 1000;
+      }
+
+      return duration;
+    },
+
+    /**
+     * Returns the current loaded state of this Howl.
+     * @return {String} 'unloaded', 'loading', 'loaded'
+     */
+    state: function() {
+      return this._state;
+    },
+
+    /**
+     * Unload and destroy the current Howl object.
+     * This will immediately stop all sound instances attached to this group.
+     */
+    unload: function() {
+      var self = this;
+
+      // Stop playing any active sounds.
+      var sounds = self._sounds;
+      for (var i=0; i<sounds.length; i++) {
+        // Stop the sound if it is currently playing.
+        if (!sounds[i]._paused) {
+          self.stop(sounds[i]._id);
+        }
+
+        // Remove the source or disconnect.
+        if (!self._webAudio) {
+          // Set the source to 0-second silence to stop any downloading (except in IE).
+          self._clearSound(sounds[i]._node);
+
+          // Remove any event listeners.
+          sounds[i]._node.removeEventListener('error', sounds[i]._errorFn, false);
+          sounds[i]._node.removeEventListener(Howler._canPlayEvent, sounds[i]._loadFn, false);
+          sounds[i]._node.removeEventListener('ended', sounds[i]._endFn, false);
+
+          // Release the Audio object back to the pool.
+          Howler._releaseHtml5Audio(sounds[i]._node);
+        }
+
+        // Empty out all of the nodes.
+        delete sounds[i]._node;
+
+        // Make sure all timers are cleared out.
+        self._clearTimer(sounds[i]._id);
+      }
+
+      // Remove the references in the global Howler object.
+      var index = Howler._howls.indexOf(self);
+      if (index >= 0) {
+        Howler._howls.splice(index, 1);
+      }
+
+      // Delete this sound from the cache (if no other Howl is using it).
+      var remCache = true;
+      for (i=0; i<Howler._howls.length; i++) {
+        if (Howler._howls[i]._src === self._src || self._src.indexOf(Howler._howls[i]._src) >= 0) {
+          remCache = false;
+          break;
+        }
+      }
+
+      if (cache && remCache) {
+        delete cache[self._src];
+      }
+
+      // Clear global errors.
+      Howler.noAudio = false;
+
+      // Clear out `self`.
+      self._state = 'unloaded';
+      self._sounds = [];
+      self = null;
+
+      return null;
+    },
+
+    /**
+     * Listen to a custom event.
+     * @param  {String}   event Event name.
+     * @param  {Function} fn    Listener to call.
+     * @param  {Number}   id    (optional) Only listen to events for this sound.
+     * @param  {Number}   once  (INTERNAL) Marks event to fire only once.
+     * @return {Howl}
+     */
+    on: function(event, fn, id, once) {
+      var self = this;
+      var events = self['_on' + event];
+
+      if (typeof fn === 'function') {
+        events.push(once ? {id: id, fn: fn, once: once} : {id: id, fn: fn});
+      }
+
+      return self;
+    },
+
+    /**
+     * Remove a custom event. Call without parameters to remove all events.
+     * @param  {String}   event Event name.
+     * @param  {Function} fn    Listener to remove. Leave empty to remove all.
+     * @param  {Number}   id    (optional) Only remove events for this sound.
+     * @return {Howl}
+     */
+    off: function(event, fn, id) {
+      var self = this;
+      var events = self['_on' + event];
+      var i = 0;
+
+      // Allow passing just an event and ID.
+      if (typeof fn === 'number') {
+        id = fn;
+        fn = null;
+      }
+
+      if (fn || id) {
+        // Loop through event store and remove the passed function.
+        for (i=0; i<events.length; i++) {
+          var isId = (id === events[i].id);
+          if (fn === events[i].fn && isId || !fn && isId) {
+            events.splice(i, 1);
+            break;
+          }
+        }
+      } else if (event) {
+        // Clear out all events of this type.
+        self['_on' + event] = [];
+      } else {
+        // Clear out all events of every type.
+        var keys = Object.keys(self);
+        for (i=0; i<keys.length; i++) {
+          if ((keys[i].indexOf('_on') === 0) && Array.isArray(self[keys[i]])) {
+            self[keys[i]] = [];
+          }
+        }
+      }
+
+      return self;
+    },
+
+    /**
+     * Listen to a custom event and remove it once fired.
+     * @param  {String}   event Event name.
+     * @param  {Function} fn    Listener to call.
+     * @param  {Number}   id    (optional) Only listen to events for this sound.
+     * @return {Howl}
+     */
+    once: function(event, fn, id) {
+      var self = this;
+
+      // Setup the event listener.
+      self.on(event, fn, id, 1);
+
+      return self;
+    },
+
+    /**
+     * Emit all events of a specific type and pass the sound id.
+     * @param  {String} event Event name.
+     * @param  {Number} id    Sound ID.
+     * @param  {Number} msg   Message to go with event.
+     * @return {Howl}
+     */
+    _emit: function(event, id, msg) {
+      var self = this;
+      var events = self['_on' + event];
+
+      // Loop through event store and fire all functions.
+      for (var i=events.length-1; i>=0; i--) {
+        // Only fire the listener if the correct ID is used.
+        if (!events[i].id || events[i].id === id || event === 'load') {
+          setTimeout(function(fn) {
+            fn.call(this, id, msg);
+          }.bind(self, events[i].fn), 0);
+
+          // If this event was setup with `once`, remove it.
+          if (events[i].once) {
+            self.off(event, events[i].fn, events[i].id);
+          }
+        }
+      }
+
+      // Pass the event type into load queue so that it can continue stepping.
+      self._loadQueue(event);
+
+      return self;
+    },
+
+    /**
+     * Queue of actions initiated before the sound has loaded.
+     * These will be called in sequence, with the next only firing
+     * after the previous has finished executing (even if async like play).
+     * @return {Howl}
+     */
+    _loadQueue: function(event) {
+      var self = this;
+
+      if (self._queue.length > 0) {
+        var task = self._queue[0];
+
+        // Remove this task if a matching event was passed.
+        if (task.event === event) {
+          self._queue.shift();
+          self._loadQueue();
+        }
+
+        // Run the task if no event type is passed.
+        if (!event) {
+          task.action();
+        }
+      }
+
+      return self;
+    },
+
+    /**
+     * Fired when playback ends at the end of the duration.
+     * @param  {Sound} sound The sound object to work with.
+     * @return {Howl}
+     */
+    _ended: function(sound) {
+      var self = this;
+      var sprite = sound._sprite;
+
+      // If we are using IE and there was network latency we may be clipping
+      // audio before it completes playing. Lets check the node to make sure it
+      // believes it has completed, before ending the playback.
+      if (!self._webAudio && sound._node && !sound._node.paused && !sound._node.ended && sound._node.currentTime < sound._stop) {
+        setTimeout(self._ended.bind(self, sound), 100);
+        return self;
+      }
+
+      // Should this sound loop?
+      var loop = !!(sound._loop || self._sprite[sprite][2]);
+
+      // Fire the ended event.
+      self._emit('end', sound._id);
+
+      // Restart the playback for HTML5 Audio loop.
+      if (!self._webAudio && loop) {
+        self.stop(sound._id, true).play(sound._id);
+      }
+
+      // Restart this timer if on a Web Audio loop.
+      if (self._webAudio && loop) {
+        self._emit('play', sound._id);
+        sound._seek = sound._start || 0;
+        sound._rateSeek = 0;
+        sound._playStart = Howler.ctx.currentTime;
+
+        var timeout = ((sound._stop - sound._start) * 1000) / Math.abs(sound._rate);
+        self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
+      }
+
+      // Mark the node as paused.
+      if (self._webAudio && !loop) {
+        sound._paused = true;
+        sound._ended = true;
+        sound._seek = sound._start || 0;
+        sound._rateSeek = 0;
+        self._clearTimer(sound._id);
+
+        // Clean up the buffer source.
+        self._cleanBuffer(sound._node);
+
+        // Attempt to auto-suspend AudioContext if no sounds are still playing.
+        Howler._autoSuspend();
+      }
+
+      // When using a sprite, end the track.
+      if (!self._webAudio && !loop) {
+        self.stop(sound._id, true);
+      }
+
+      return self;
+    },
+
+    /**
+     * Clear the end timer for a sound playback.
+     * @param  {Number} id The sound ID.
+     * @return {Howl}
+     */
+    _clearTimer: function(id) {
+      var self = this;
+
+      if (self._endTimers[id]) {
+        // Clear the timeout or remove the ended listener.
+        if (typeof self._endTimers[id] !== 'function') {
+          clearTimeout(self._endTimers[id]);
+        } else {
+          var sound = self._soundById(id);
+          if (sound && sound._node) {
+            sound._node.removeEventListener('ended', self._endTimers[id], false);
+          }
+        }
+
+        delete self._endTimers[id];
+      }
+
+      return self;
+    },
+
+    /**
+     * Return the sound identified by this ID, or return null.
+     * @param  {Number} id Sound ID
+     * @return {Object}    Sound object or null.
+     */
+    _soundById: function(id) {
+      var self = this;
+
+      // Loop through all sounds and find the one with this ID.
+      for (var i=0; i<self._sounds.length; i++) {
+        if (id === self._sounds[i]._id) {
+          return self._sounds[i];
+        }
+      }
+
+      return null;
+    },
+
+    /**
+     * Return an inactive sound from the pool or create a new one.
+     * @return {Sound} Sound playback object.
+     */
+    _inactiveSound: function() {
+      var self = this;
+
+      self._drain();
+
+      // Find the first inactive node to recycle.
+      for (var i=0; i<self._sounds.length; i++) {
+        if (self._sounds[i]._ended) {
+          return self._sounds[i].reset();
+        }
+      }
+
+      // If no inactive node was found, create a new one.
+      return new Sound(self);
+    },
+
+    /**
+     * Drain excess inactive sounds from the pool.
+     */
+    _drain: function() {
+      var self = this;
+      var limit = self._pool;
+      var cnt = 0;
+      var i = 0;
+
+      // If there are less sounds than the max pool size, we are done.
+      if (self._sounds.length < limit) {
+        return;
+      }
+
+      // Count the number of inactive sounds.
+      for (i=0; i<self._sounds.length; i++) {
+        if (self._sounds[i]._ended) {
+          cnt++;
+        }
+      }
+
+      // Remove excess inactive sounds, going in reverse order.
+      for (i=self._sounds.length - 1; i>=0; i--) {
+        if (cnt <= limit) {
+          return;
+        }
+
+        if (self._sounds[i]._ended) {
+          // Disconnect the audio source when using Web Audio.
+          if (self._webAudio && self._sounds[i]._node) {
+            self._sounds[i]._node.disconnect(0);
+          }
+
+          // Remove sounds until we have the pool size.
+          self._sounds.splice(i, 1);
+          cnt--;
+        }
+      }
+    },
+
+    /**
+     * Get all ID's from the sounds pool.
+     * @param  {Number} id Only return one ID if one is passed.
+     * @return {Array}    Array of IDs.
+     */
+    _getSoundIds: function(id) {
+      var self = this;
+
+      if (typeof id === 'undefined') {
+        var ids = [];
+        for (var i=0; i<self._sounds.length; i++) {
+          ids.push(self._sounds[i]._id);
+        }
+
+        return ids;
+      } else {
+        return [id];
+      }
+    },
+
+    /**
+     * Load the sound back into the buffer source.
+     * @param  {Sound} sound The sound object to work with.
+     * @return {Howl}
+     */
+    _refreshBuffer: function(sound) {
+      var self = this;
+
+      // Setup the buffer source for playback.
+      sound._node.bufferSource = Howler.ctx.createBufferSource();
+      sound._node.bufferSource.buffer = cache[self._src];
+
+      // Connect to the correct node.
+      if (sound._panner) {
+        sound._node.bufferSource.connect(sound._panner);
+      } else {
+        sound._node.bufferSource.connect(sound._node);
+      }
+
+      // Setup looping and playback rate.
+      sound._node.bufferSource.loop = sound._loop;
+      if (sound._loop) {
+        sound._node.bufferSource.loopStart = sound._start || 0;
+        sound._node.bufferSource.loopEnd = sound._stop || 0;
+      }
+      sound._node.bufferSource.playbackRate.setValueAtTime(sound._rate, Howler.ctx.currentTime);
+
+      return self;
+    },
+
+    /**
+     * Prevent memory leaks by cleaning up the buffer source after playback.
+     * @param  {Object} node Sound's audio node containing the buffer source.
+     * @return {Howl}
+     */
+    _cleanBuffer: function(node) {
+      var self = this;
+      var isIOS = Howler._navigator && Howler._navigator.vendor.indexOf('Apple') >= 0;
+
+      if (!node.bufferSource) {
+        return self;
+      }
+
+      if (Howler._scratchBuffer && node.bufferSource) {
+        node.bufferSource.onended = null;
+        node.bufferSource.disconnect(0);
+        if (isIOS) {
+          try { node.bufferSource.buffer = Howler._scratchBuffer; } catch(e) {}
+        }
+      }
+      node.bufferSource = null;
+
+      return self;
+    },
+
+    /**
+     * Set the source to a 0-second silence to stop any downloading (except in IE).
+     * @param  {Object} node Audio node to clear.
+     */
+    _clearSound: function(node) {
+      var checkIE = /MSIE |Trident\//.test(Howler._navigator && Howler._navigator.userAgent);
+      if (!checkIE) {
+        node.src = 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA';
+      }
+    }
+  };
+
+  /** Single Sound Methods **/
+  /***************************************************************************/
+
+  /**
+   * Setup the sound object, which each node attached to a Howl group is contained in.
+   * @param {Object} howl The Howl parent group.
+   */
+  var Sound = function(howl) {
+    this._parent = howl;
+    this.init();
+  };
+  Sound.prototype = {
+    /**
+     * Initialize a new Sound object.
+     * @return {Sound}
+     */
+    init: function() {
+      var self = this;
+      var parent = self._parent;
+
+      // Setup the default parameters.
+      self._muted = parent._muted;
+      self._loop = parent._loop;
+      self._volume = parent._volume;
+      self._rate = parent._rate;
+      self._seek = 0;
+      self._paused = true;
+      self._ended = true;
+      self._sprite = '__default';
+
+      // Generate a unique ID for this sound.
+      self._id = ++Howler._counter;
+
+      // Add itself to the parent's pool.
+      parent._sounds.push(self);
+
+      // Create the new node.
+      self.create();
+
+      return self;
+    },
+
+    /**
+     * Create and setup a new sound object, whether HTML5 Audio or Web Audio.
+     * @return {Sound}
+     */
+    create: function() {
+      var self = this;
+      var parent = self._parent;
+      var volume = (Howler._muted || self._muted || self._parent._muted) ? 0 : self._volume;
+
+      if (parent._webAudio) {
+        // Create the gain node for controlling volume (the source will connect to this).
+        self._node = (typeof Howler.ctx.createGain === 'undefined') ? Howler.ctx.createGainNode() : Howler.ctx.createGain();
+        self._node.gain.setValueAtTime(volume, Howler.ctx.currentTime);
+        self._node.paused = true;
+        self._node.connect(Howler.masterGain);
+      } else if (!Howler.noAudio) {
+        // Get an unlocked Audio object from the pool.
+        self._node = Howler._obtainHtml5Audio();
+
+        // Listen for errors (http://dev.w3.org/html5/spec-author-view/spec.html#mediaerror).
+        self._errorFn = self._errorListener.bind(self);
+        self._node.addEventListener('error', self._errorFn, false);
+
+        // Listen for 'canplaythrough' event to let us know the sound is ready.
+        self._loadFn = self._loadListener.bind(self);
+        self._node.addEventListener(Howler._canPlayEvent, self._loadFn, false);
+
+        // Listen for the 'ended' event on the sound to account for edge-case where
+        // a finite sound has a duration of Infinity.
+        self._endFn = self._endListener.bind(self);
+        self._node.addEventListener('ended', self._endFn, false);
+
+        // Setup the new audio node.
+        self._node.src = parent._src;
+        self._node.preload = parent._preload === true ? 'auto' : parent._preload;
+        self._node.volume = volume * Howler.volume();
+
+        // Begin loading the source.
+        self._node.load();
+      }
+
+      return self;
+    },
+
+    /**
+     * Reset the parameters of this sound to the original state (for recycle).
+     * @return {Sound}
+     */
+    reset: function() {
+      var self = this;
+      var parent = self._parent;
+
+      // Reset all of the parameters of this sound.
+      self._muted = parent._muted;
+      self._loop = parent._loop;
+      self._volume = parent._volume;
+      self._rate = parent._rate;
+      self._seek = 0;
+      self._rateSeek = 0;
+      self._paused = true;
+      self._ended = true;
+      self._sprite = '__default';
+
+      // Generate a new ID so that it isn't confused with the previous sound.
+      self._id = ++Howler._counter;
+
+      return self;
+    },
+
+    /**
+     * HTML5 Audio error listener callback.
+     */
+    _errorListener: function() {
+      var self = this;
+
+      // Fire an error event and pass back the code.
+      self._parent._emit('loaderror', self._id, self._node.error ? self._node.error.code : 0);
+
+      // Clear the event listener.
+      self._node.removeEventListener('error', self._errorFn, false);
+    },
+
+    /**
+     * HTML5 Audio canplaythrough listener callback.
+     */
+    _loadListener: function() {
+      var self = this;
+      var parent = self._parent;
+
+      // Round up the duration to account for the lower precision in HTML5 Audio.
+      parent._duration = Math.ceil(self._node.duration * 10) / 10;
+
+      // Setup a sprite if none is defined.
+      if (Object.keys(parent._sprite).length === 0) {
+        parent._sprite = {__default: [0, parent._duration * 1000]};
+      }
+
+      if (parent._state !== 'loaded') {
+        parent._state = 'loaded';
+        parent._emit('load');
+        parent._loadQueue();
+      }
+
+      // Clear the event listener.
+      self._node.removeEventListener(Howler._canPlayEvent, self._loadFn, false);
+    },
+
+    /**
+     * HTML5 Audio ended listener callback.
+     */
+    _endListener: function() {
+      var self = this;
+      var parent = self._parent;
+
+      // Only handle the `ended`` event if the duration is Infinity.
+      if (parent._duration === Infinity) {
+        // Update the parent duration to match the real audio duration.
+        // Round up the duration to account for the lower precision in HTML5 Audio.
+        parent._duration = Math.ceil(self._node.duration * 10) / 10;
+
+        // Update the sprite that corresponds to the real duration.
+        if (parent._sprite.__default[1] === Infinity) {
+          parent._sprite.__default[1] = parent._duration * 1000;
+        }
+
+        // Run the regular ended method.
+        parent._ended(self);
+      }
+
+      // Clear the event listener since the duration is now correct.
+      self._node.removeEventListener('ended', self._endFn, false);
+    }
+  };
+
+  /** Helper Methods **/
+  /***************************************************************************/
+
+  var cache = {};
+
+  /**
+   * Buffer a sound from URL, Data URI or cache and decode to audio source (Web Audio API).
+   * @param  {Howl} self
+   */
+  var loadBuffer = function(self) {
+    var url = self._src;
+
+    // Check if the buffer has already been cached and use it instead.
+    if (cache[url]) {
+      // Set the duration from the cache.
+      self._duration = cache[url].duration;
+
+      // Load the sound into this Howl.
+      loadSound(self);
+
+      return;
+    }
+
+    if (/^data:[^;]+;base64,/.test(url)) {
+      // Decode the base64 data URI without XHR, since some browsers don't support it.
+      var data = atob(url.split(',')[1]);
+      var dataView = new Uint8Array(data.length);
+      for (var i=0; i<data.length; ++i) {
+        dataView[i] = data.charCodeAt(i);
+      }
+
+      decodeAudioData(dataView.buffer, self);
+    } else {
+      // Load the buffer from the URL.
+      var xhr = new XMLHttpRequest();
+      xhr.open(self._xhr.method, url, true);
+      xhr.withCredentials = self._xhr.withCredentials;
+      xhr.responseType = 'arraybuffer';
+
+      // Apply any custom headers to the request.
+      if (self._xhr.headers) {
+        Object.keys(self._xhr.headers).forEach(function(key) {
+          xhr.setRequestHeader(key, self._xhr.headers[key]);
+        });
+      }
+
+      xhr.onload = function() {
+        // Make sure we get a successful response back.
+        var code = (xhr.status + '')[0];
+        if (code !== '0' && code !== '2' && code !== '3') {
+          self._emit('loaderror', null, 'Failed loading audio file with status: ' + xhr.status + '.');
+          return;
+        }
+
+        decodeAudioData(xhr.response, self);
+      };
+      xhr.onerror = function() {
+        // If there is an error, switch to HTML5 Audio.
+        if (self._webAudio) {
+          self._html5 = true;
+          self._webAudio = false;
+          self._sounds = [];
+          delete cache[url];
+          self.load();
+        }
+      };
+      safeXhrSend(xhr);
+    }
+  };
+
+  /**
+   * Send the XHR request wrapped in a try/catch.
+   * @param  {Object} xhr XHR to send.
+   */
+  var safeXhrSend = function(xhr) {
+    try {
+      xhr.send();
+    } catch (e) {
+      xhr.onerror();
+    }
+  };
+
+  /**
+   * Decode audio data from an array buffer.
+   * @param  {ArrayBuffer} arraybuffer The audio data.
+   * @param  {Howl}        self
+   */
+  var decodeAudioData = function(arraybuffer, self) {
+    // Fire a load error if something broke.
+    var error = function() {
+      self._emit('loaderror', null, 'Decoding audio data failed.');
+    };
+
+    // Load the sound on success.
+    var success = function(buffer) {
+      if (buffer && self._sounds.length > 0) {
+        cache[self._src] = buffer;
+        loadSound(self, buffer);
+      } else {
+        error();
+      }
+    };
+
+    // Decode the buffer into an audio source.
+    if (typeof Promise !== 'undefined' && Howler.ctx.decodeAudioData.length === 1) {
+      Howler.ctx.decodeAudioData(arraybuffer).then(success).catch(error);
+    } else {
+      Howler.ctx.decodeAudioData(arraybuffer, success, error);
+    }
+  }
+
+  /**
+   * Sound is now loaded, so finish setting everything up and fire the loaded event.
+   * @param  {Howl} self
+   * @param  {Object} buffer The decoded buffer sound source.
+   */
+  var loadSound = function(self, buffer) {
+    // Set the duration.
+    if (buffer && !self._duration) {
+      self._duration = buffer.duration;
+    }
+
+    // Setup a sprite if none is defined.
+    if (Object.keys(self._sprite).length === 0) {
+      self._sprite = {__default: [0, self._duration * 1000]};
+    }
+
+    // Fire the loaded event.
+    if (self._state !== 'loaded') {
+      self._state = 'loaded';
+      self._emit('load');
+      self._loadQueue();
+    }
+  };
+
+  /**
+   * Setup the audio context when available, or switch to HTML5 Audio mode.
+   */
+  var setupAudioContext = function() {
+    // If we have already detected that Web Audio isn't supported, don't run this step again.
+    if (!Howler.usingWebAudio) {
+      return;
+    }
+
+    // Check if we are using Web Audio and setup the AudioContext if we are.
+    try {
+      if (typeof AudioContext !== 'undefined') {
+        Howler.ctx = new AudioContext();
+      } else if (typeof webkitAudioContext !== 'undefined') {
+        Howler.ctx = new webkitAudioContext();
+      } else {
+        Howler.usingWebAudio = false;
+      }
+    } catch(e) {
+      Howler.usingWebAudio = false;
+    }
+
+    // If the audio context creation still failed, set using web audio to false.
+    if (!Howler.ctx) {
+      Howler.usingWebAudio = false;
+    }
+
+    // Check if a webview is being used on iOS8 or earlier (rather than the browser).
+    // If it is, disable Web Audio as it causes crashing.
+    var iOS = (/iP(hone|od|ad)/.test(Howler._navigator && Howler._navigator.platform));
+    var appVersion = Howler._navigator && Howler._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);
+    var version = appVersion ? parseInt(appVersion[1], 10) : null;
+    if (iOS && version && version < 9) {
+      var safari = /safari/.test(Howler._navigator && Howler._navigator.userAgent.toLowerCase());
+      if (Howler._navigator && !safari) {
+        Howler.usingWebAudio = false;
+      }
+    }
+
+    // Create and expose the master GainNode when using Web Audio (useful for plugins or advanced usage).
+    if (Howler.usingWebAudio) {
+      Howler.masterGain = (typeof Howler.ctx.createGain === 'undefined') ? Howler.ctx.createGainNode() : Howler.ctx.createGain();
+      Howler.masterGain.gain.setValueAtTime(Howler._muted ? 0 : Howler._volume, Howler.ctx.currentTime);
+      Howler.masterGain.connect(Howler.ctx.destination);
+    }
+
+    // Re-run the setup on Howler.
+    Howler._setup();
+  };
+
+  // Add support for AMD (Asynchronous Module Definition) libraries such as require.js.
+  if (typeof define === 'function' && define.amd) {
+    define([], function() {
+      return {
+        Howler: Howler,
+        Howl: Howl
+      };
+    });
+  }
+
+  // Add support for CommonJS libraries such as browserify.
+  if (typeof exports !== 'undefined') {
+    exports.Howler = Howler;
+    exports.Howl = Howl;
+  }
+
+  // Add to global in Node.js (for testing, etc).
+  if (typeof global !== 'undefined') {
+    global.HowlerGlobal = HowlerGlobal;
+    global.Howler = Howler;
+    global.Howl = Howl;
+    global.Sound = Sound;
+  } else if (typeof window !== 'undefined') {  // Define globally in case AMD is not available or unused.
+    window.HowlerGlobal = HowlerGlobal;
+    window.Howler = Howler;
+    window.Howl = Howl;
+    window.Sound = Sound;
+  }
+})();
+
+
+/*!
+ *  Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
+ *  
+ *  howler.js v2.2.4
+ *  howlerjs.com
+ *
+ *  (c) 2013-2020, James Simpson of GoldFire Studios
+ *  goldfirestudios.com
+ *
+ *  MIT License
+ */
+
+(function() {
+
+  'use strict';
+
+  // Setup default properties.
+  HowlerGlobal.prototype._pos = [0, 0, 0];
+  HowlerGlobal.prototype._orientation = [0, 0, -1, 0, 1, 0];
+
+  /** Global Methods **/
+  /***************************************************************************/
+
+  /**
+   * Helper method to update the stereo panning position of all current Howls.
+   * Future Howls will not use this value unless explicitly set.
+   * @param  {Number} pan A value of -1.0 is all the way left and 1.0 is all the way right.
+   * @return {Howler/Number}     Self or current stereo panning value.
+   */
+  HowlerGlobal.prototype.stereo = function(pan) {
+    var self = this;
+
+    // Stop right here if not using Web Audio.
+    if (!self.ctx || !self.ctx.listener) {
+      return self;
+    }
+
+    // Loop through all Howls and update their stereo panning.
+    for (var i=self._howls.length-1; i>=0; i--) {
+      self._howls[i].stereo(pan);
+    }
+
+    return self;
+  };
+
+  /**
+   * Get/set the position of the listener in 3D cartesian space. Sounds using
+   * 3D position will be relative to the listener's position.
+   * @param  {Number} x The x-position of the listener.
+   * @param  {Number} y The y-position of the listener.
+   * @param  {Number} z The z-position of the listener.
+   * @return {Howler/Array}   Self or current listener position.
+   */
+  HowlerGlobal.prototype.pos = function(x, y, z) {
+    var self = this;
+
+    // Stop right here if not using Web Audio.
+    if (!self.ctx || !self.ctx.listener) {
+      return self;
+    }
+
+    // Set the defaults for optional 'y' & 'z'.
+    y = (typeof y !== 'number') ? self._pos[1] : y;
+    z = (typeof z !== 'number') ? self._pos[2] : z;
+
+    if (typeof x === 'number') {
+      self._pos = [x, y, z];
+
+      if (typeof self.ctx.listener.positionX !== 'undefined') {
+        self.ctx.listener.positionX.setTargetAtTime(self._pos[0], Howler.ctx.currentTime, 0.1);
+        self.ctx.listener.positionY.setTargetAtTime(self._pos[1], Howler.ctx.currentTime, 0.1);
+        self.ctx.listener.positionZ.setTargetAtTime(self._pos[2], Howler.ctx.currentTime, 0.1);
+      } else {
+        self.ctx.listener.setPosition(self._pos[0], self._pos[1], self._pos[2]);
+      }
+    } else {
+      return self._pos;
+    }
+
+    return self;
+  };
+
+  /**
+   * Get/set the direction the listener is pointing in the 3D cartesian space.
+   * A front and up vector must be provided. The front is the direction the
+   * face of the listener is pointing, and up is the direction the top of the
+   * listener is pointing. Thus, these values are expected to be at right angles
+   * from each other.
+   * @param  {Number} x   The x-orientation of the listener.
+   * @param  {Number} y   The y-orientation of the listener.
+   * @param  {Number} z   The z-orientation of the listener.
+   * @param  {Number} xUp The x-orientation of the top of the listener.
+   * @param  {Number} yUp The y-orientation of the top of the listener.
+   * @param  {Number} zUp The z-orientation of the top of the listener.
+   * @return {Howler/Array}     Returns self or the current orientation vectors.
+   */
+  HowlerGlobal.prototype.orientation = function(x, y, z, xUp, yUp, zUp) {
+    var self = this;
+
+    // Stop right here if not using Web Audio.
+    if (!self.ctx || !self.ctx.listener) {
+      return self;
+    }
+
+    // Set the defaults for optional 'y' & 'z'.
+    var or = self._orientation;
+    y = (typeof y !== 'number') ? or[1] : y;
+    z = (typeof z !== 'number') ? or[2] : z;
+    xUp = (typeof xUp !== 'number') ? or[3] : xUp;
+    yUp = (typeof yUp !== 'number') ? or[4] : yUp;
+    zUp = (typeof zUp !== 'number') ? or[5] : zUp;
+
+    if (typeof x === 'number') {
+      self._orientation = [x, y, z, xUp, yUp, zUp];
+
+      if (typeof self.ctx.listener.forwardX !== 'undefined') {
+        self.ctx.listener.forwardX.setTargetAtTime(x, Howler.ctx.currentTime, 0.1);
+        self.ctx.listener.forwardY.setTargetAtTime(y, Howler.ctx.currentTime, 0.1);
+        self.ctx.listener.forwardZ.setTargetAtTime(z, Howler.ctx.currentTime, 0.1);
+        self.ctx.listener.upX.setTargetAtTime(xUp, Howler.ctx.currentTime, 0.1);
+        self.ctx.listener.upY.setTargetAtTime(yUp, Howler.ctx.currentTime, 0.1);
+        self.ctx.listener.upZ.setTargetAtTime(zUp, Howler.ctx.currentTime, 0.1);
+      } else {
+        self.ctx.listener.setOrientation(x, y, z, xUp, yUp, zUp);
+      }
+    } else {
+      return or;
+    }
+
+    return self;
+  };
+
+  /** Group Methods **/
+  /***************************************************************************/
+
+  /**
+   * Add new properties to the core init.
+   * @param  {Function} _super Core init method.
+   * @return {Howl}
+   */
+  Howl.prototype.init = (function(_super) {
+    return function(o) {
+      var self = this;
+
+      // Setup user-defined default properties.
+      self._orientation = o.orientation || [1, 0, 0];
+      self._stereo = o.stereo || null;
+      self._pos = o.pos || null;
+      self._pannerAttr = {
+        coneInnerAngle: typeof o.coneInnerAngle !== 'undefined' ? o.coneInnerAngle : 360,
+        coneOuterAngle: typeof o.coneOuterAngle !== 'undefined' ? o.coneOuterAngle : 360,
+        coneOuterGain: typeof o.coneOuterGain !== 'undefined' ? o.coneOuterGain : 0,
+        distanceModel: typeof o.distanceModel !== 'undefined' ? o.distanceModel : 'inverse',
+        maxDistance: typeof o.maxDistance !== 'undefined' ? o.maxDistance : 10000,
+        panningModel: typeof o.panningModel !== 'undefined' ? o.panningModel : 'HRTF',
+        refDistance: typeof o.refDistance !== 'undefined' ? o.refDistance : 1,
+        rolloffFactor: typeof o.rolloffFactor !== 'undefined' ? o.rolloffFactor : 1
+      };
+
+      // Setup event listeners.
+      self._onstereo = o.onstereo ? [{fn: o.onstereo}] : [];
+      self._onpos = o.onpos ? [{fn: o.onpos}] : [];
+      self._onorientation = o.onorientation ? [{fn: o.onorientation}] : [];
+
+      // Complete initilization with howler.js core's init function.
+      return _super.call(this, o);
+    };
+  })(Howl.prototype.init);
+
+  /**
+   * Get/set the stereo panning of the audio source for this sound or all in the group.
+   * @param  {Number} pan  A value of -1.0 is all the way left and 1.0 is all the way right.
+   * @param  {Number} id (optional) The sound ID. If none is passed, all in group will be updated.
+   * @return {Howl/Number}    Returns self or the current stereo panning value.
+   */
+  Howl.prototype.stereo = function(pan, id) {
+    var self = this;
+
+    // Stop right here if not using Web Audio.
+    if (!self._webAudio) {
+      return self;
+    }
+
+    // If the sound hasn't loaded, add it to the load queue to change stereo pan when capable.
+    if (self._state !== 'loaded') {
+      self._queue.push({
+        event: 'stereo',
+        action: function() {
+          self.stereo(pan, id);
+        }
+      });
+
+      return self;
+    }
+
+    // Check for PannerStereoNode support and fallback to PannerNode if it doesn't exist.
+    var pannerType = (typeof Howler.ctx.createStereoPanner === 'undefined') ? 'spatial' : 'stereo';
+
+    // Setup the group's stereo panning if no ID is passed.
+    if (typeof id === 'undefined') {
+      // Return the group's stereo panning if no parameters are passed.
+      if (typeof pan === 'number') {
+        self._stereo = pan;
+        self._pos = [pan, 0, 0];
+      } else {
+        return self._stereo;
+      }
+    }
+
+    // Change the streo panning of one or all sounds in group.
+    var ids = self._getSoundIds(id);
+    for (var i=0; i<ids.length; i++) {
+      // Get the sound.
+      var sound = self._soundById(ids[i]);
+
+      if (sound) {
+        if (typeof pan === 'number') {
+          sound._stereo = pan;
+          sound._pos = [pan, 0, 0];
+
+          if (sound._node) {
+            // If we are falling back, make sure the panningModel is equalpower.
+            sound._pannerAttr.panningModel = 'equalpower';
+
+            // Check if there is a panner setup and create a new one if not.
+            if (!sound._panner || !sound._panner.pan) {
+              setupPanner(sound, pannerType);
+            }
+
+            if (pannerType === 'spatial') {
+              if (typeof sound._panner.positionX !== 'undefined') {
+                sound._panner.positionX.setValueAtTime(pan, Howler.ctx.currentTime);
+                sound._panner.positionY.setValueAtTime(0, Howler.ctx.currentTime);
+                sound._panner.positionZ.setValueAtTime(0, Howler.ctx.currentTime);
+              } else {
+                sound._panner.setPosition(pan, 0, 0);
+              }
+            } else {
+              sound._panner.pan.setValueAtTime(pan, Howler.ctx.currentTime);
+            }
+          }
+
+          self._emit('stereo', sound._id);
+        } else {
+          return sound._stereo;
+        }
+      }
+    }
+
+    return self;
+  };
+
+  /**
+   * Get/set the 3D spatial position of the audio source for this sound or group relative to the global listener.
+   * @param  {Number} x  The x-position of the audio source.
+   * @param  {Number} y  The y-position of the audio source.
+   * @param  {Number} z  The z-position of the audio source.
+   * @param  {Number} id (optional) The sound ID. If none is passed, all in group will be updated.
+   * @return {Howl/Array}    Returns self or the current 3D spatial position: [x, y, z].
+   */
+  Howl.prototype.pos = function(x, y, z, id) {
+    var self = this;
+
+    // Stop right here if not using Web Audio.
+    if (!self._webAudio) {
+      return self;
+    }
+
+    // If the sound hasn't loaded, add it to the load queue to change position when capable.
+    if (self._state !== 'loaded') {
+      self._queue.push({
+        event: 'pos',
+        action: function() {
+          self.pos(x, y, z, id);
+        }
+      });
+
+      return self;
+    }
+
+    // Set the defaults for optional 'y' & 'z'.
+    y = (typeof y !== 'number') ? 0 : y;
+    z = (typeof z !== 'number') ? -0.5 : z;
+
+    // Setup the group's spatial position if no ID is passed.
+    if (typeof id === 'undefined') {
+      // Return the group's spatial position if no parameters are passed.
+      if (typeof x === 'number') {
+        self._pos = [x, y, z];
+      } else {
+        return self._pos;
+      }
+    }
+
+    // Change the spatial position of one or all sounds in group.
+    var ids = self._getSoundIds(id);
+    for (var i=0; i<ids.length; i++) {
+      // Get the sound.
+      var sound = self._soundById(ids[i]);
+
+      if (sound) {
+        if (typeof x === 'number') {
+          sound._pos = [x, y, z];
+
+          if (sound._node) {
+            // Check if there is a panner setup and create a new one if not.
+            if (!sound._panner || sound._panner.pan) {
+              setupPanner(sound, 'spatial');
+            }
+
+            if (typeof sound._panner.positionX !== 'undefined') {
+              sound._panner.positionX.setValueAtTime(x, Howler.ctx.currentTime);
+              sound._panner.positionY.setValueAtTime(y, Howler.ctx.currentTime);
+              sound._panner.positionZ.setValueAtTime(z, Howler.ctx.currentTime);
+            } else {
+              sound._panner.setPosition(x, y, z);
+            }
+          }
+
+          self._emit('pos', sound._id);
+        } else {
+          return sound._pos;
+        }
+      }
+    }
+
+    return self;
+  };
+
+  /**
+   * Get/set the direction the audio source is pointing in the 3D cartesian coordinate
+   * space. Depending on how direction the sound is, based on the `cone` attributes,
+   * a sound pointing away from the listener can be quiet or silent.
+   * @param  {Number} x  The x-orientation of the source.
+   * @param  {Number} y  The y-orientation of the source.
+   * @param  {Number} z  The z-orientation of the source.
+   * @param  {Number} id (optional) The sound ID. If none is passed, all in group will be updated.
+   * @return {Howl/Array}    Returns self or the current 3D spatial orientation: [x, y, z].
+   */
+  Howl.prototype.orientation = function(x, y, z, id) {
+    var self = this;
+
+    // Stop right here if not using Web Audio.
+    if (!self._webAudio) {
+      return self;
+    }
+
+    // If the sound hasn't loaded, add it to the load queue to change orientation when capable.
+    if (self._state !== 'loaded') {
+      self._queue.push({
+        event: 'orientation',
+        action: function() {
+          self.orientation(x, y, z, id);
+        }
+      });
+
+      return self;
+    }
+
+    // Set the defaults for optional 'y' & 'z'.
+    y = (typeof y !== 'number') ? self._orientation[1] : y;
+    z = (typeof z !== 'number') ? self._orientation[2] : z;
+
+    // Setup the group's spatial orientation if no ID is passed.
+    if (typeof id === 'undefined') {
+      // Return the group's spatial orientation if no parameters are passed.
+      if (typeof x === 'number') {
+        self._orientation = [x, y, z];
+      } else {
+        return self._orientation;
+      }
+    }
+
+    // Change the spatial orientation of one or all sounds in group.
+    var ids = self._getSoundIds(id);
+    for (var i=0; i<ids.length; i++) {
+      // Get the sound.
+      var sound = self._soundById(ids[i]);
+
+      if (sound) {
+        if (typeof x === 'number') {
+          sound._orientation = [x, y, z];
+
+          if (sound._node) {
+            // Check if there is a panner setup and create a new one if not.
+            if (!sound._panner) {
+              // Make sure we have a position to setup the node with.
+              if (!sound._pos) {
+                sound._pos = self._pos || [0, 0, -0.5];
+              }
+
+              setupPanner(sound, 'spatial');
+            }
+
+            if (typeof sound._panner.orientationX !== 'undefined') {
+              sound._panner.orientationX.setValueAtTime(x, Howler.ctx.currentTime);
+              sound._panner.orientationY.setValueAtTime(y, Howler.ctx.currentTime);
+              sound._panner.orientationZ.setValueAtTime(z, Howler.ctx.currentTime);
+            } else {
+              sound._panner.setOrientation(x, y, z);
+            }
+          }
+
+          self._emit('orientation', sound._id);
+        } else {
+          return sound._orientation;
+        }
+      }
+    }
+
+    return self;
+  };
+
+  /**
+   * Get/set the panner node's attributes for a sound or group of sounds.
+   * This method can optionall take 0, 1 or 2 arguments.
+   *   pannerAttr() -> Returns the group's values.
+   *   pannerAttr(id) -> Returns the sound id's values.
+   *   pannerAttr(o) -> Set's the values of all sounds in this Howl group.
+   *   pannerAttr(o, id) -> Set's the values of passed sound id.
+   *
+   *   Attributes:
+   *     coneInnerAngle - (360 by default) A parameter for directional audio sources, this is an angle, in degrees,
+   *                      inside of which there will be no volume reduction.
+   *     coneOuterAngle - (360 by default) A parameter for directional audio sources, this is an angle, in degrees,
+   *                      outside of which the volume will be reduced to a constant value of `coneOuterGain`.
+   *     coneOuterGain - (0 by default) A parameter for directional audio sources, this is the gain outside of the
+   *                     `coneOuterAngle`. It is a linear value in the range `[0, 1]`.
+   *     distanceModel - ('inverse' by default) Determines algorithm used to reduce volume as audio moves away from
+   *                     listener. Can be `linear`, `inverse` or `exponential.
+   *     maxDistance - (10000 by default) The maximum distance between source and listener, after which the volume
+   *                   will not be reduced any further.
+   *     refDistance - (1 by default) A reference distance for reducing volume as source moves further from the listener.
+   *                   This is simply a variable of the distance model and has a different effect depending on which model
+   *                   is used and the scale of your coordinates. Generally, volume will be equal to 1 at this distance.
+   *     rolloffFactor - (1 by default) How quickly the volume reduces as source moves from listener. This is simply a
+   *                     variable of the distance model and can be in the range of `[0, 1]` with `linear` and `[0, ∞]`
+   *                     with `inverse` and `exponential`.
+   *     panningModel - ('HRTF' by default) Determines which spatialization algorithm is used to position audio.
+   *                     Can be `HRTF` or `equalpower`.
+   *
+   * @return {Howl/Object} Returns self or current panner attributes.
+   */
+  Howl.prototype.pannerAttr = function() {
+    var self = this;
+    var args = arguments;
+    var o, id, sound;
+
+    // Stop right here if not using Web Audio.
+    if (!self._webAudio) {
+      return self;
+    }
+
+    // Determine the values based on arguments.
+    if (args.length === 0) {
+      // Return the group's panner attribute values.
+      return self._pannerAttr;
+    } else if (args.length === 1) {
+      if (typeof args[0] === 'object') {
+        o = args[0];
+
+        // Set the grou's panner attribute values.
+        if (typeof id === 'undefined') {
+          if (!o.pannerAttr) {
+            o.pannerAttr = {
+              coneInnerAngle: o.coneInnerAngle,
+              coneOuterAngle: o.coneOuterAngle,
+              coneOuterGain: o.coneOuterGain,
+              distanceModel: o.distanceModel,
+              maxDistance: o.maxDistance,
+              refDistance: o.refDistance,
+              rolloffFactor: o.rolloffFactor,
+              panningModel: o.panningModel
+            };
+          }
+
+          self._pannerAttr = {
+            coneInnerAngle: typeof o.pannerAttr.coneInnerAngle !== 'undefined' ? o.pannerAttr.coneInnerAngle : self._coneInnerAngle,
+            coneOuterAngle: typeof o.pannerAttr.coneOuterAngle !== 'undefined' ? o.pannerAttr.coneOuterAngle : self._coneOuterAngle,
+            coneOuterGain: typeof o.pannerAttr.coneOuterGain !== 'undefined' ? o.pannerAttr.coneOuterGain : self._coneOuterGain,
+            distanceModel: typeof o.pannerAttr.distanceModel !== 'undefined' ? o.pannerAttr.distanceModel : self._distanceModel,
+            maxDistance: typeof o.pannerAttr.maxDistance !== 'undefined' ? o.pannerAttr.maxDistance : self._maxDistance,
+            refDistance: typeof o.pannerAttr.refDistance !== 'undefined' ? o.pannerAttr.refDistance : self._refDistance,
+            rolloffFactor: typeof o.pannerAttr.rolloffFactor !== 'undefined' ? o.pannerAttr.rolloffFactor : self._rolloffFactor,
+            panningModel: typeof o.pannerAttr.panningModel !== 'undefined' ? o.pannerAttr.panningModel : self._panningModel
+          };
+        }
+      } else {
+        // Return this sound's panner attribute values.
+        sound = self._soundById(parseInt(args[0], 10));
+        return sound ? sound._pannerAttr : self._pannerAttr;
+      }
+    } else if (args.length === 2) {
+      o = args[0];
+      id = parseInt(args[1], 10);
+    }
+
+    // Update the values of the specified sounds.
+    var ids = self._getSoundIds(id);
+    for (var i=0; i<ids.length; i++) {
+      sound = self._soundById(ids[i]);
+
+      if (sound) {
+        // Merge the new values into the sound.
+        var pa = sound._pannerAttr;
+        pa = {
+          coneInnerAngle: typeof o.coneInnerAngle !== 'undefined' ? o.coneInnerAngle : pa.coneInnerAngle,
+          coneOuterAngle: typeof o.coneOuterAngle !== 'undefined' ? o.coneOuterAngle : pa.coneOuterAngle,
+          coneOuterGain: typeof o.coneOuterGain !== 'undefined' ? o.coneOuterGain : pa.coneOuterGain,
+          distanceModel: typeof o.distanceModel !== 'undefined' ? o.distanceModel : pa.distanceModel,
+          maxDistance: typeof o.maxDistance !== 'undefined' ? o.maxDistance : pa.maxDistance,
+          refDistance: typeof o.refDistance !== 'undefined' ? o.refDistance : pa.refDistance,
+          rolloffFactor: typeof o.rolloffFactor !== 'undefined' ? o.rolloffFactor : pa.rolloffFactor,
+          panningModel: typeof o.panningModel !== 'undefined' ? o.panningModel : pa.panningModel
+        };
+
+        // Create a new panner node if one doesn't already exist.
+        var panner = sound._panner;
+        if (!panner) {
+          // Make sure we have a position to setup the node with.
+          if (!sound._pos) {
+            sound._pos = self._pos || [0, 0, -0.5];
+          }
+
+          // Create a new panner node.
+          setupPanner(sound, 'spatial');
+          panner = sound._panner
+        }
+
+        // Update the panner values or create a new panner if none exists.
+        panner.coneInnerAngle = pa.coneInnerAngle;
+        panner.coneOuterAngle = pa.coneOuterAngle;
+        panner.coneOuterGain = pa.coneOuterGain;
+        panner.distanceModel = pa.distanceModel;
+        panner.maxDistance = pa.maxDistance;
+        panner.refDistance = pa.refDistance;
+        panner.rolloffFactor = pa.rolloffFactor;
+        panner.panningModel = pa.panningModel;
+      }
+    }
+
+    return self;
+  };
+
+  /** Single Sound Methods **/
+  /***************************************************************************/
+
+  /**
+   * Add new properties to the core Sound init.
+   * @param  {Function} _super Core Sound init method.
+   * @return {Sound}
+   */
+  Sound.prototype.init = (function(_super) {
+    return function() {
+      var self = this;
+      var parent = self._parent;
+
+      // Setup user-defined default properties.
+      self._orientation = parent._orientation;
+      self._stereo = parent._stereo;
+      self._pos = parent._pos;
+      self._pannerAttr = parent._pannerAttr;
+
+      // Complete initilization with howler.js core Sound's init function.
+      _super.call(this);
+
+      // If a stereo or position was specified, set it up.
+      if (self._stereo) {
+        parent.stereo(self._stereo);
+      } else if (self._pos) {
+        parent.pos(self._pos[0], self._pos[1], self._pos[2], self._id);
+      }
+    };
+  })(Sound.prototype.init);
+
+  /**
+   * Override the Sound.reset method to clean up properties from the spatial plugin.
+   * @param  {Function} _super Sound reset method.
+   * @return {Sound}
+   */
+  Sound.prototype.reset = (function(_super) {
+    return function() {
+      var self = this;
+      var parent = self._parent;
+
+      // Reset all spatial plugin properties on this sound.
+      self._orientation = parent._orientation;
+      self._stereo = parent._stereo;
+      self._pos = parent._pos;
+      self._pannerAttr = parent._pannerAttr;
+
+      // If a stereo or position was specified, set it up.
+      if (self._stereo) {
+        parent.stereo(self._stereo);
+      } else if (self._pos) {
+        parent.pos(self._pos[0], self._pos[1], self._pos[2], self._id);
+      } else if (self._panner) {
+        // Disconnect the panner.
+        self._panner.disconnect(0);
+        self._panner = undefined;
+        parent._refreshBuffer(self);
+      }
+
+      // Complete resetting of the sound.
+      return _super.call(this);
+    };
+  })(Sound.prototype.reset);
+
+  /** Helper Methods **/
+  /***************************************************************************/
+
+  /**
+   * Create a new panner node and save it on the sound.
+   * @param  {Sound} sound Specific sound to setup panning on.
+   * @param {String} type Type of panner to create: 'stereo' or 'spatial'.
+   */
+  var setupPanner = function(sound, type) {
+    type = type || 'spatial';
+
+    // Create the new panner node.
+    if (type === 'spatial') {
+      sound._panner = Howler.ctx.createPanner();
+      sound._panner.coneInnerAngle = sound._pannerAttr.coneInnerAngle;
+      sound._panner.coneOuterAngle = sound._pannerAttr.coneOuterAngle;
+      sound._panner.coneOuterGain = sound._pannerAttr.coneOuterGain;
+      sound._panner.distanceModel = sound._pannerAttr.distanceModel;
+      sound._panner.maxDistance = sound._pannerAttr.maxDistance;
+      sound._panner.refDistance = sound._pannerAttr.refDistance;
+      sound._panner.rolloffFactor = sound._pannerAttr.rolloffFactor;
+      sound._panner.panningModel = sound._pannerAttr.panningModel;
+
+      if (typeof sound._panner.positionX !== 'undefined') {
+        sound._panner.positionX.setValueAtTime(sound._pos[0], Howler.ctx.currentTime);
+        sound._panner.positionY.setValueAtTime(sound._pos[1], Howler.ctx.currentTime);
+        sound._panner.positionZ.setValueAtTime(sound._pos[2], Howler.ctx.currentTime);
+      } else {
+        sound._panner.setPosition(sound._pos[0], sound._pos[1], sound._pos[2]);
+      }
+
+      if (typeof sound._panner.orientationX !== 'undefined') {
+        sound._panner.orientationX.setValueAtTime(sound._orientation[0], Howler.ctx.currentTime);
+        sound._panner.orientationY.setValueAtTime(sound._orientation[1], Howler.ctx.currentTime);
+        sound._panner.orientationZ.setValueAtTime(sound._orientation[2], Howler.ctx.currentTime);
+      } else {
+        sound._panner.setOrientation(sound._orientation[0], sound._orientation[1], sound._orientation[2]);
+      }
+    } else {
+      sound._panner = Howler.ctx.createStereoPanner();
+      sound._panner.pan.setValueAtTime(sound._stereo, Howler.ctx.currentTime);
+    }
+
+    sound._panner.connect(sound._node);
+
+    // Update the connections.
+    if (!sound._paused) {
+      sound._parent.pause(sound._id, true).play(sound._id, true);
+    }
+  };
+})();

File diff suppressed because it is too large
+ 1 - 0
node_modules/howler/dist/howler.min.js


File diff suppressed because it is too large
+ 1 - 0
node_modules/howler/dist/howler.spatial.min.js


+ 41 - 0
node_modules/howler/package.json

@@ -0,0 +1,41 @@
+{
+  "name": "howler",
+  "version": "2.2.4",
+  "description": "Javascript audio library for the modern web.",
+  "homepage": "https://howlerjs.com",
+  "keywords": [
+    "howler",
+    "howler.js",
+    "audio",
+    "sound",
+    "web audio",
+    "webaudio",
+    "browser",
+    "html5",
+    "html5 audio",
+    "audio sprite",
+    "audiosprite"
+  ],
+  "author": "James Simpson <james@goldfirestudios.com> (http://goldfirestudios.com)",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/goldfire/howler.js.git"
+  },
+  "scripts": {
+    "build": "VERSION=`printf 'v' && node -e 'console.log(require(\"./package.json\").version)'` && sed -i '' '2s/.*/ *  howler.js '\"$VERSION\"'/' src/howler.core.js && sed -i '' '4s/.*/ *  howler.js '\"$VERSION\"'/' src/plugins/howler.spatial.js && uglifyjs --preamble \"/*! howler.js $VERSION | (c) 2013-2020, James Simpson of GoldFire Studios | MIT License | howlerjs.com */\" src/howler.core.js -c -m --screw-ie8 -o dist/howler.core.min.js && uglifyjs --preamble \"/*! howler.js $VERSION | Spatial Plugin | (c) 2013-2020, James Simpson of GoldFire Studios | MIT License | howlerjs.com */\" src/plugins/howler.spatial.js -c -m --screw-ie8 -o dist/howler.spatial.min.js && awk 'FNR==1{echo \"\"}1' dist/howler.core.min.js dist/howler.spatial.min.js | sed '3s~.*~/*! Spatial Plugin */~' | perl -pe 'chomp if eof' > dist/howler.min.js && awk '(NR>1 && FNR==1){printf (\"\\n\\n\")};1' src/howler.core.js src/plugins/howler.spatial.js > dist/howler.js",
+    "release": "VERSION=`printf 'v' && node -e 'console.log(require(\"./package.json\").version)'` && git tag $VERSION && git push && git push origin $VERSION && npm publish"
+  },
+  "devDependencies": {
+    "uglify-js": "2.x"
+  },
+  "main": "dist/howler.js",
+  "license": "MIT",
+  "files": [
+    "src",
+    "dist/howler.js",
+    "dist/howler.min.js",
+    "dist/howler.core.min.js",
+    "dist/howler.spatial.min.js",
+    "LICENSE.md"
+  ]
+}

+ 2587 - 0
node_modules/howler/src/howler.core.js

@@ -0,0 +1,2587 @@
+/*!
+ *  howler.js v2.2.4
+ *  howlerjs.com
+ *
+ *  (c) 2013-2020, James Simpson of GoldFire Studios
+ *  goldfirestudios.com
+ *
+ *  MIT License
+ */
+
+(function() {
+
+  'use strict';
+
+  /** Global Methods **/
+  /***************************************************************************/
+
+  /**
+   * Create the global controller. All contained methods and properties apply
+   * to all sounds that are currently playing or will be in the future.
+   */
+  var HowlerGlobal = function() {
+    this.init();
+  };
+  HowlerGlobal.prototype = {
+    /**
+     * Initialize the global Howler object.
+     * @return {Howler}
+     */
+    init: function() {
+      var self = this || Howler;
+
+      // Create a global ID counter.
+      self._counter = 1000;
+
+      // Pool of unlocked HTML5 Audio objects.
+      self._html5AudioPool = [];
+      self.html5PoolSize = 10;
+
+      // Internal properties.
+      self._codecs = {};
+      self._howls = [];
+      self._muted = false;
+      self._volume = 1;
+      self._canPlayEvent = 'canplaythrough';
+      self._navigator = (typeof window !== 'undefined' && window.navigator) ? window.navigator : null;
+
+      // Public properties.
+      self.masterGain = null;
+      self.noAudio = false;
+      self.usingWebAudio = true;
+      self.autoSuspend = true;
+      self.ctx = null;
+
+      // Set to false to disable the auto audio unlocker.
+      self.autoUnlock = true;
+
+      // Setup the various state values for global tracking.
+      self._setup();
+
+      return self;
+    },
+
+    /**
+     * Get/set the global volume for all sounds.
+     * @param  {Float} vol Volume from 0.0 to 1.0.
+     * @return {Howler/Float}     Returns self or current volume.
+     */
+    volume: function(vol) {
+      var self = this || Howler;
+      vol = parseFloat(vol);
+
+      // If we don't have an AudioContext created yet, run the setup.
+      if (!self.ctx) {
+        setupAudioContext();
+      }
+
+      if (typeof vol !== 'undefined' && vol >= 0 && vol <= 1) {
+        self._volume = vol;
+
+        // Don't update any of the nodes if we are muted.
+        if (self._muted) {
+          return self;
+        }
+
+        // When using Web Audio, we just need to adjust the master gain.
+        if (self.usingWebAudio) {
+          self.masterGain.gain.setValueAtTime(vol, Howler.ctx.currentTime);
+        }
+
+        // Loop through and change volume for all HTML5 audio nodes.
+        for (var i=0; i<self._howls.length; i++) {
+          if (!self._howls[i]._webAudio) {
+            // Get all of the sounds in this Howl group.
+            var ids = self._howls[i]._getSoundIds();
+
+            // Loop through all sounds and change the volumes.
+            for (var j=0; j<ids.length; j++) {
+              var sound = self._howls[i]._soundById(ids[j]);
+
+              if (sound && sound._node) {
+                sound._node.volume = sound._volume * vol;
+              }
+            }
+          }
+        }
+
+        return self;
+      }
+
+      return self._volume;
+    },
+
+    /**
+     * Handle muting and unmuting globally.
+     * @param  {Boolean} muted Is muted or not.
+     */
+    mute: function(muted) {
+      var self = this || Howler;
+
+      // If we don't have an AudioContext created yet, run the setup.
+      if (!self.ctx) {
+        setupAudioContext();
+      }
+
+      self._muted = muted;
+
+      // With Web Audio, we just need to mute the master gain.
+      if (self.usingWebAudio) {
+        self.masterGain.gain.setValueAtTime(muted ? 0 : self._volume, Howler.ctx.currentTime);
+      }
+
+      // Loop through and mute all HTML5 Audio nodes.
+      for (var i=0; i<self._howls.length; i++) {
+        if (!self._howls[i]._webAudio) {
+          // Get all of the sounds in this Howl group.
+          var ids = self._howls[i]._getSoundIds();
+
+          // Loop through all sounds and mark the audio node as muted.
+          for (var j=0; j<ids.length; j++) {
+            var sound = self._howls[i]._soundById(ids[j]);
+
+            if (sound && sound._node) {
+              sound._node.muted = (muted) ? true : sound._muted;
+            }
+          }
+        }
+      }
+
+      return self;
+    },
+
+    /**
+     * Handle stopping all sounds globally.
+     */
+    stop: function() {
+      var self = this || Howler;
+
+      // Loop through all Howls and stop them.
+      for (var i=0; i<self._howls.length; i++) {
+        self._howls[i].stop();
+      }
+
+      return self;
+    },
+
+    /**
+     * Unload and destroy all currently loaded Howl objects.
+     * @return {Howler}
+     */
+    unload: function() {
+      var self = this || Howler;
+
+      for (var i=self._howls.length-1; i>=0; i--) {
+        self._howls[i].unload();
+      }
+
+      // Create a new AudioContext to make sure it is fully reset.
+      if (self.usingWebAudio && self.ctx && typeof self.ctx.close !== 'undefined') {
+        self.ctx.close();
+        self.ctx = null;
+        setupAudioContext();
+      }
+
+      return self;
+    },
+
+    /**
+     * Check for codec support of specific extension.
+     * @param  {String} ext Audio file extention.
+     * @return {Boolean}
+     */
+    codecs: function(ext) {
+      return (this || Howler)._codecs[ext.replace(/^x-/, '')];
+    },
+
+    /**
+     * Setup various state values for global tracking.
+     * @return {Howler}
+     */
+    _setup: function() {
+      var self = this || Howler;
+
+      // Keeps track of the suspend/resume state of the AudioContext.
+      self.state = self.ctx ? self.ctx.state || 'suspended' : 'suspended';
+
+      // Automatically begin the 30-second suspend process
+      self._autoSuspend();
+
+      // Check if audio is available.
+      if (!self.usingWebAudio) {
+        // No audio is available on this system if noAudio is set to true.
+        if (typeof Audio !== 'undefined') {
+          try {
+            var test = new Audio();
+
+            // Check if the canplaythrough event is available.
+            if (typeof test.oncanplaythrough === 'undefined') {
+              self._canPlayEvent = 'canplay';
+            }
+          } catch(e) {
+            self.noAudio = true;
+          }
+        } else {
+          self.noAudio = true;
+        }
+      }
+
+      // Test to make sure audio isn't disabled in Internet Explorer.
+      try {
+        var test = new Audio();
+        if (test.muted) {
+          self.noAudio = true;
+        }
+      } catch (e) {}
+
+      // Check for supported codecs.
+      if (!self.noAudio) {
+        self._setupCodecs();
+      }
+
+      return self;
+    },
+
+    /**
+     * Check for browser support for various codecs and cache the results.
+     * @return {Howler}
+     */
+    _setupCodecs: function() {
+      var self = this || Howler;
+      var audioTest = null;
+
+      // Must wrap in a try/catch because IE11 in server mode throws an error.
+      try {
+        audioTest = (typeof Audio !== 'undefined') ? new Audio() : null;
+      } catch (err) {
+        return self;
+      }
+
+      if (!audioTest || typeof audioTest.canPlayType !== 'function') {
+        return self;
+      }
+
+      var mpegTest = audioTest.canPlayType('audio/mpeg;').replace(/^no$/, '');
+
+      // Opera version <33 has mixed MP3 support, so we need to check for and block it.
+      var ua = self._navigator ? self._navigator.userAgent : '';
+      var checkOpera = ua.match(/OPR\/(\d+)/g);
+      var isOldOpera = (checkOpera && parseInt(checkOpera[0].split('/')[1], 10) < 33);
+      var checkSafari = ua.indexOf('Safari') !== -1 && ua.indexOf('Chrome') === -1;
+      var safariVersion = ua.match(/Version\/(.*?) /);
+      var isOldSafari = (checkSafari && safariVersion && parseInt(safariVersion[1], 10) < 15);
+
+      self._codecs = {
+        mp3: !!(!isOldOpera && (mpegTest || audioTest.canPlayType('audio/mp3;').replace(/^no$/, ''))),
+        mpeg: !!mpegTest,
+        opus: !!audioTest.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ''),
+        ogg: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ''),
+        oga: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ''),
+        wav: !!(audioTest.canPlayType('audio/wav; codecs="1"') || audioTest.canPlayType('audio/wav')).replace(/^no$/, ''),
+        aac: !!audioTest.canPlayType('audio/aac;').replace(/^no$/, ''),
+        caf: !!audioTest.canPlayType('audio/x-caf;').replace(/^no$/, ''),
+        m4a: !!(audioTest.canPlayType('audio/x-m4a;') || audioTest.canPlayType('audio/m4a;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''),
+        m4b: !!(audioTest.canPlayType('audio/x-m4b;') || audioTest.canPlayType('audio/m4b;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''),
+        mp4: !!(audioTest.canPlayType('audio/x-mp4;') || audioTest.canPlayType('audio/mp4;') || audioTest.canPlayType('audio/aac;')).replace(/^no$/, ''),
+        weba: !!(!isOldSafari && audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, '')),
+        webm: !!(!isOldSafari && audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, '')),
+        dolby: !!audioTest.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ''),
+        flac: !!(audioTest.canPlayType('audio/x-flac;') || audioTest.canPlayType('audio/flac;')).replace(/^no$/, '')
+      };
+
+      return self;
+    },
+
+    /**
+     * Some browsers/devices will only allow audio to be played after a user interaction.
+     * Attempt to automatically unlock audio on the first user interaction.
+     * Concept from: http://paulbakaus.com/tutorials/html5/web-audio-on-ios/
+     * @return {Howler}
+     */
+    _unlockAudio: function() {
+      var self = this || Howler;
+
+      // Only run this if Web Audio is supported and it hasn't already been unlocked.
+      if (self._audioUnlocked || !self.ctx) {
+        return;
+      }
+
+      self._audioUnlocked = false;
+      self.autoUnlock = false;
+
+      // Some mobile devices/platforms have distortion issues when opening/closing tabs and/or web views.
+      // Bugs in the browser (especially Mobile Safari) can cause the sampleRate to change from 44100 to 48000.
+      // By calling Howler.unload(), we create a new AudioContext with the correct sampleRate.
+      if (!self._mobileUnloaded && self.ctx.sampleRate !== 44100) {
+        self._mobileUnloaded = true;
+        self.unload();
+      }
+
+      // Scratch buffer for enabling iOS to dispose of web audio buffers correctly, as per:
+      // http://stackoverflow.com/questions/24119684
+      self._scratchBuffer = self.ctx.createBuffer(1, 1, 22050);
+
+      // Call this method on touch start to create and play a buffer,
+      // then check if the audio actually played to determine if
+      // audio has now been unlocked on iOS, Android, etc.
+      var unlock = function(e) {
+        // Create a pool of unlocked HTML5 Audio objects that can
+        // be used for playing sounds without user interaction. HTML5
+        // Audio objects must be individually unlocked, as opposed
+        // to the WebAudio API which only needs a single activation.
+        // This must occur before WebAudio setup or the source.onended
+        // event will not fire.
+        while (self._html5AudioPool.length < self.html5PoolSize) {
+          try {
+            var audioNode = new Audio();
+
+            // Mark this Audio object as unlocked to ensure it can get returned
+            // to the unlocked pool when released.
+            audioNode._unlocked = true;
+
+            // Add the audio node to the pool.
+            self._releaseHtml5Audio(audioNode);
+          } catch (e) {
+            self.noAudio = true;
+            break;
+          }
+        }
+
+        // Loop through any assigned audio nodes and unlock them.
+        for (var i=0; i<self._howls.length; i++) {
+          if (!self._howls[i]._webAudio) {
+            // Get all of the sounds in this Howl group.
+            var ids = self._howls[i]._getSoundIds();
+
+            // Loop through all sounds and unlock the audio nodes.
+            for (var j=0; j<ids.length; j++) {
+              var sound = self._howls[i]._soundById(ids[j]);
+
+              if (sound && sound._node && !sound._node._unlocked) {
+                sound._node._unlocked = true;
+                sound._node.load();
+              }
+            }
+          }
+        }
+
+        // Fix Android can not play in suspend state.
+        self._autoResume();
+
+        // Create an empty buffer.
+        var source = self.ctx.createBufferSource();
+        source.buffer = self._scratchBuffer;
+        source.connect(self.ctx.destination);
+
+        // Play the empty buffer.
+        if (typeof source.start === 'undefined') {
+          source.noteOn(0);
+        } else {
+          source.start(0);
+        }
+
+        // Calling resume() on a stack initiated by user gesture is what actually unlocks the audio on Android Chrome >= 55.
+        if (typeof self.ctx.resume === 'function') {
+          self.ctx.resume();
+        }
+
+        // Setup a timeout to check that we are unlocked on the next event loop.
+        source.onended = function() {
+          source.disconnect(0);
+
+          // Update the unlocked state and prevent this check from happening again.
+          self._audioUnlocked = true;
+
+          // Remove the touch start listener.
+          document.removeEventListener('touchstart', unlock, true);
+          document.removeEventListener('touchend', unlock, true);
+          document.removeEventListener('click', unlock, true);
+          document.removeEventListener('keydown', unlock, true);
+
+          // Let all sounds know that audio has been unlocked.
+          for (var i=0; i<self._howls.length; i++) {
+            self._howls[i]._emit('unlock');
+          }
+        };
+      };
+
+      // Setup a touch start listener to attempt an unlock in.
+      document.addEventListener('touchstart', unlock, true);
+      document.addEventListener('touchend', unlock, true);
+      document.addEventListener('click', unlock, true);
+      document.addEventListener('keydown', unlock, true);
+
+      return self;
+    },
+
+    /**
+     * Get an unlocked HTML5 Audio object from the pool. If none are left,
+     * return a new Audio object and throw a warning.
+     * @return {Audio} HTML5 Audio object.
+     */
+    _obtainHtml5Audio: function() {
+      var self = this || Howler;
+
+      // Return the next object from the pool if one exists.
+      if (self._html5AudioPool.length) {
+        return self._html5AudioPool.pop();
+      }
+
+      //.Check if the audio is locked and throw a warning.
+      var testPlay = new Audio().play();
+      if (testPlay && typeof Promise !== 'undefined' && (testPlay instanceof Promise || typeof testPlay.then === 'function')) {
+        testPlay.catch(function() {
+          console.warn('HTML5 Audio pool exhausted, returning potentially locked audio object.');
+        });
+      }
+
+      return new Audio();
+    },
+
+    /**
+     * Return an activated HTML5 Audio object to the pool.
+     * @return {Howler}
+     */
+    _releaseHtml5Audio: function(audio) {
+      var self = this || Howler;
+
+      // Don't add audio to the pool if we don't know if it has been unlocked.
+      if (audio._unlocked) {
+        self._html5AudioPool.push(audio);
+      }
+
+      return self;
+    },
+
+    /**
+     * Automatically suspend the Web Audio AudioContext after no sound has played for 30 seconds.
+     * This saves processing/energy and fixes various browser-specific bugs with audio getting stuck.
+     * @return {Howler}
+     */
+    _autoSuspend: function() {
+      var self = this;
+
+      if (!self.autoSuspend || !self.ctx || typeof self.ctx.suspend === 'undefined' || !Howler.usingWebAudio) {
+        return;
+      }
+
+      // Check if any sounds are playing.
+      for (var i=0; i<self._howls.length; i++) {
+        if (self._howls[i]._webAudio) {
+          for (var j=0; j<self._howls[i]._sounds.length; j++) {
+            if (!self._howls[i]._sounds[j]._paused) {
+              return self;
+            }
+          }
+        }
+      }
+
+      if (self._suspendTimer) {
+        clearTimeout(self._suspendTimer);
+      }
+
+      // If no sound has played after 30 seconds, suspend the context.
+      self._suspendTimer = setTimeout(function() {
+        if (!self.autoSuspend) {
+          return;
+        }
+
+        self._suspendTimer = null;
+        self.state = 'suspending';
+
+        // Handle updating the state of the audio context after suspending.
+        var handleSuspension = function() {
+          self.state = 'suspended';
+
+          if (self._resumeAfterSuspend) {
+            delete self._resumeAfterSuspend;
+            self._autoResume();
+          }
+        };
+
+        // Either the state gets suspended or it is interrupted.
+        // Either way, we need to update the state to suspended.
+        self.ctx.suspend().then(handleSuspension, handleSuspension);
+      }, 30000);
+
+      return self;
+    },
+
+    /**
+     * Automatically resume the Web Audio AudioContext when a new sound is played.
+     * @return {Howler}
+     */
+    _autoResume: function() {
+      var self = this;
+
+      if (!self.ctx || typeof self.ctx.resume === 'undefined' || !Howler.usingWebAudio) {
+        return;
+      }
+
+      if (self.state === 'running' && self.ctx.state !== 'interrupted' && self._suspendTimer) {
+        clearTimeout(self._suspendTimer);
+        self._suspendTimer = null;
+      } else if (self.state === 'suspended' || self.state === 'running' && self.ctx.state === 'interrupted') {
+        self.ctx.resume().then(function() {
+          self.state = 'running';
+
+          // Emit to all Howls that the audio has resumed.
+          for (var i=0; i<self._howls.length; i++) {
+            self._howls[i]._emit('resume');
+          }
+        });
+
+        if (self._suspendTimer) {
+          clearTimeout(self._suspendTimer);
+          self._suspendTimer = null;
+        }
+      } else if (self.state === 'suspending') {
+        self._resumeAfterSuspend = true;
+      }
+
+      return self;
+    }
+  };
+
+  // Setup the global audio controller.
+  var Howler = new HowlerGlobal();
+
+  /** Group Methods **/
+  /***************************************************************************/
+
+  /**
+   * Create an audio group controller.
+   * @param {Object} o Passed in properties for this group.
+   */
+  var Howl = function(o) {
+    var self = this;
+
+    // Throw an error if no source is provided.
+    if (!o.src || o.src.length === 0) {
+      console.error('An array of source files must be passed with any new Howl.');
+      return;
+    }
+
+    self.init(o);
+  };
+  Howl.prototype = {
+    /**
+     * Initialize a new Howl group object.
+     * @param  {Object} o Passed in properties for this group.
+     * @return {Howl}
+     */
+    init: function(o) {
+      var self = this;
+
+      // If we don't have an AudioContext created yet, run the setup.
+      if (!Howler.ctx) {
+        setupAudioContext();
+      }
+
+      // Setup user-defined default properties.
+      self._autoplay = o.autoplay || false;
+      self._format = (typeof o.format !== 'string') ? o.format : [o.format];
+      self._html5 = o.html5 || false;
+      self._muted = o.mute || false;
+      self._loop = o.loop || false;
+      self._pool = o.pool || 5;
+      self._preload = (typeof o.preload === 'boolean' || o.preload === 'metadata') ? o.preload : true;
+      self._rate = o.rate || 1;
+      self._sprite = o.sprite || {};
+      self._src = (typeof o.src !== 'string') ? o.src : [o.src];
+      self._volume = o.volume !== undefined ? o.volume : 1;
+      self._xhr = {
+        method: o.xhr && o.xhr.method ? o.xhr.method : 'GET',
+        headers: o.xhr && o.xhr.headers ? o.xhr.headers : null,
+        withCredentials: o.xhr && o.xhr.withCredentials ? o.xhr.withCredentials : false,
+      };
+
+      // Setup all other default properties.
+      self._duration = 0;
+      self._state = 'unloaded';
+      self._sounds = [];
+      self._endTimers = {};
+      self._queue = [];
+      self._playLock = false;
+
+      // Setup event listeners.
+      self._onend = o.onend ? [{fn: o.onend}] : [];
+      self._onfade = o.onfade ? [{fn: o.onfade}] : [];
+      self._onload = o.onload ? [{fn: o.onload}] : [];
+      self._onloaderror = o.onloaderror ? [{fn: o.onloaderror}] : [];
+      self._onplayerror = o.onplayerror ? [{fn: o.onplayerror}] : [];
+      self._onpause = o.onpause ? [{fn: o.onpause}] : [];
+      self._onplay = o.onplay ? [{fn: o.onplay}] : [];
+      self._onstop = o.onstop ? [{fn: o.onstop}] : [];
+      self._onmute = o.onmute ? [{fn: o.onmute}] : [];
+      self._onvolume = o.onvolume ? [{fn: o.onvolume}] : [];
+      self._onrate = o.onrate ? [{fn: o.onrate}] : [];
+      self._onseek = o.onseek ? [{fn: o.onseek}] : [];
+      self._onunlock = o.onunlock ? [{fn: o.onunlock}] : [];
+      self._onresume = [];
+
+      // Web Audio or HTML5 Audio?
+      self._webAudio = Howler.usingWebAudio && !self._html5;
+
+      // Automatically try to enable audio.
+      if (typeof Howler.ctx !== 'undefined' && Howler.ctx && Howler.autoUnlock) {
+        Howler._unlockAudio();
+      }
+
+      // Keep track of this Howl group in the global controller.
+      Howler._howls.push(self);
+
+      // If they selected autoplay, add a play event to the load queue.
+      if (self._autoplay) {
+        self._queue.push({
+          event: 'play',
+          action: function() {
+            self.play();
+          }
+        });
+      }
+
+      // Load the source file unless otherwise specified.
+      if (self._preload && self._preload !== 'none') {
+        self.load();
+      }
+
+      return self;
+    },
+
+    /**
+     * Load the audio file.
+     * @return {Howler}
+     */
+    load: function() {
+      var self = this;
+      var url = null;
+
+      // If no audio is available, quit immediately.
+      if (Howler.noAudio) {
+        self._emit('loaderror', null, 'No audio support.');
+        return;
+      }
+
+      // Make sure our source is in an array.
+      if (typeof self._src === 'string') {
+        self._src = [self._src];
+      }
+
+      // Loop through the sources and pick the first one that is compatible.
+      for (var i=0; i<self._src.length; i++) {
+        var ext, str;
+
+        if (self._format && self._format[i]) {
+          // If an extension was specified, use that instead.
+          ext = self._format[i];
+        } else {
+          // Make sure the source is a string.
+          str = self._src[i];
+          if (typeof str !== 'string') {
+            self._emit('loaderror', null, 'Non-string found in selected audio sources - ignoring.');
+            continue;
+          }
+
+          // Extract the file extension from the URL or base64 data URI.
+          ext = /^data:audio\/([^;,]+);/i.exec(str);
+          if (!ext) {
+            ext = /\.([^.]+)$/.exec(str.split('?', 1)[0]);
+          }
+
+          if (ext) {
+            ext = ext[1].toLowerCase();
+          }
+        }
+
+        // Log a warning if no extension was found.
+        if (!ext) {
+          console.warn('No file extension was found. Consider using the "format" property or specify an extension.');
+        }
+
+        // Check if this extension is available.
+        if (ext && Howler.codecs(ext)) {
+          url = self._src[i];
+          break;
+        }
+      }
+
+      if (!url) {
+        self._emit('loaderror', null, 'No codec support for selected audio sources.');
+        return;
+      }
+
+      self._src = url;
+      self._state = 'loading';
+
+      // If the hosting page is HTTPS and the source isn't,
+      // drop down to HTML5 Audio to avoid Mixed Content errors.
+      if (window.location.protocol === 'https:' && url.slice(0, 5) === 'http:') {
+        self._html5 = true;
+        self._webAudio = false;
+      }
+
+      // Create a new sound object and add it to the pool.
+      new Sound(self);
+
+      // Load and decode the audio data for playback.
+      if (self._webAudio) {
+        loadBuffer(self);
+      }
+
+      return self;
+    },
+
+    /**
+     * Play a sound or resume previous playback.
+     * @param  {String/Number} sprite   Sprite name for sprite playback or sound id to continue previous.
+     * @param  {Boolean} internal Internal Use: true prevents event firing.
+     * @return {Number}          Sound ID.
+     */
+    play: function(sprite, internal) {
+      var self = this;
+      var id = null;
+
+      // Determine if a sprite, sound id or nothing was passed
+      if (typeof sprite === 'number') {
+        id = sprite;
+        sprite = null;
+      } else if (typeof sprite === 'string' && self._state === 'loaded' && !self._sprite[sprite]) {
+        // If the passed sprite doesn't exist, do nothing.
+        return null;
+      } else if (typeof sprite === 'undefined') {
+        // Use the default sound sprite (plays the full audio length).
+        sprite = '__default';
+
+        // Check if there is a single paused sound that isn't ended.
+        // If there is, play that sound. If not, continue as usual.
+        if (!self._playLock) {
+          var num = 0;
+          for (var i=0; i<self._sounds.length; i++) {
+            if (self._sounds[i]._paused && !self._sounds[i]._ended) {
+              num++;
+              id = self._sounds[i]._id;
+            }
+          }
+
+          if (num === 1) {
+            sprite = null;
+          } else {
+            id = null;
+          }
+        }
+      }
+
+      // Get the selected node, or get one from the pool.
+      var sound = id ? self._soundById(id) : self._inactiveSound();
+
+      // If the sound doesn't exist, do nothing.
+      if (!sound) {
+        return null;
+      }
+
+      // Select the sprite definition.
+      if (id && !sprite) {
+        sprite = sound._sprite || '__default';
+      }
+
+      // If the sound hasn't loaded, we must wait to get the audio's duration.
+      // We also need to wait to make sure we don't run into race conditions with
+      // the order of function calls.
+      if (self._state !== 'loaded') {
+        // Set the sprite value on this sound.
+        sound._sprite = sprite;
+
+        // Mark this sound as not ended in case another sound is played before this one loads.
+        sound._ended = false;
+
+        // Add the sound to the queue to be played on load.
+        var soundId = sound._id;
+        self._queue.push({
+          event: 'play',
+          action: function() {
+            self.play(soundId);
+          }
+        });
+
+        return soundId;
+      }
+
+      // Don't play the sound if an id was passed and it is already playing.
+      if (id && !sound._paused) {
+        // Trigger the play event, in order to keep iterating through queue.
+        if (!internal) {
+          self._loadQueue('play');
+        }
+
+        return sound._id;
+      }
+
+      // Make sure the AudioContext isn't suspended, and resume it if it is.
+      if (self._webAudio) {
+        Howler._autoResume();
+      }
+
+      // Determine how long to play for and where to start playing.
+      var seek = Math.max(0, sound._seek > 0 ? sound._seek : self._sprite[sprite][0] / 1000);
+      var duration = Math.max(0, ((self._sprite[sprite][0] + self._sprite[sprite][1]) / 1000) - seek);
+      var timeout = (duration * 1000) / Math.abs(sound._rate);
+      var start = self._sprite[sprite][0] / 1000;
+      var stop = (self._sprite[sprite][0] + self._sprite[sprite][1]) / 1000;
+      sound._sprite = sprite;
+
+      // Mark the sound as ended instantly so that this async playback
+      // doesn't get grabbed by another call to play while this one waits to start.
+      sound._ended = false;
+
+      // Update the parameters of the sound.
+      var setParams = function() {
+        sound._paused = false;
+        sound._seek = seek;
+        sound._start = start;
+        sound._stop = stop;
+        sound._loop = !!(sound._loop || self._sprite[sprite][2]);
+      };
+
+      // End the sound instantly if seek is at the end.
+      if (seek >= stop) {
+        self._ended(sound);
+        return;
+      }
+
+      // Begin the actual playback.
+      var node = sound._node;
+      if (self._webAudio) {
+        // Fire this when the sound is ready to play to begin Web Audio playback.
+        var playWebAudio = function() {
+          self._playLock = false;
+          setParams();
+          self._refreshBuffer(sound);
+
+          // Setup the playback params.
+          var vol = (sound._muted || self._muted) ? 0 : sound._volume;
+          node.gain.setValueAtTime(vol, Howler.ctx.currentTime);
+          sound._playStart = Howler.ctx.currentTime;
+
+          // Play the sound using the supported method.
+          if (typeof node.bufferSource.start === 'undefined') {
+            sound._loop ? node.bufferSource.noteGrainOn(0, seek, 86400) : node.bufferSource.noteGrainOn(0, seek, duration);
+          } else {
+            sound._loop ? node.bufferSource.start(0, seek, 86400) : node.bufferSource.start(0, seek, duration);
+          }
+
+          // Start a new timer if none is present.
+          if (timeout !== Infinity) {
+            self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
+          }
+
+          if (!internal) {
+            setTimeout(function() {
+              self._emit('play', sound._id);
+              self._loadQueue();
+            }, 0);
+          }
+        };
+
+        if (Howler.state === 'running' && Howler.ctx.state !== 'interrupted') {
+          playWebAudio();
+        } else {
+          self._playLock = true;
+
+          // Wait for the audio context to resume before playing.
+          self.once('resume', playWebAudio);
+
+          // Cancel the end timer.
+          self._clearTimer(sound._id);
+        }
+      } else {
+        // Fire this when the sound is ready to play to begin HTML5 Audio playback.
+        var playHtml5 = function() {
+          node.currentTime = seek;
+          node.muted = sound._muted || self._muted || Howler._muted || node.muted;
+          node.volume = sound._volume * Howler.volume();
+          node.playbackRate = sound._rate;
+
+          // Some browsers will throw an error if this is called without user interaction.
+          try {
+            var play = node.play();
+
+            // Support older browsers that don't support promises, and thus don't have this issue.
+            if (play && typeof Promise !== 'undefined' && (play instanceof Promise || typeof play.then === 'function')) {
+              // Implements a lock to prevent DOMException: The play() request was interrupted by a call to pause().
+              self._playLock = true;
+
+              // Set param values immediately.
+              setParams();
+
+              // Releases the lock and executes queued actions.
+              play
+                .then(function() {
+                  self._playLock = false;
+                  node._unlocked = true;
+                  if (!internal) {
+                    self._emit('play', sound._id);
+                  } else {
+                    self._loadQueue();
+                  }
+                })
+                .catch(function() {
+                  self._playLock = false;
+                  self._emit('playerror', sound._id, 'Playback was unable to start. This is most commonly an issue ' +
+                    'on mobile devices and Chrome where playback was not within a user interaction.');
+
+                  // Reset the ended and paused values.
+                  sound._ended = true;
+                  sound._paused = true;
+                });
+            } else if (!internal) {
+              self._playLock = false;
+              setParams();
+              self._emit('play', sound._id);
+            }
+
+            // Setting rate before playing won't work in IE, so we set it again here.
+            node.playbackRate = sound._rate;
+
+            // If the node is still paused, then we can assume there was a playback issue.
+            if (node.paused) {
+              self._emit('playerror', sound._id, 'Playback was unable to start. This is most commonly an issue ' +
+                'on mobile devices and Chrome where playback was not within a user interaction.');
+              return;
+            }
+
+            // Setup the end timer on sprites or listen for the ended event.
+            if (sprite !== '__default' || sound._loop) {
+              self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
+            } else {
+              self._endTimers[sound._id] = function() {
+                // Fire ended on this audio node.
+                self._ended(sound);
+
+                // Clear this listener.
+                node.removeEventListener('ended', self._endTimers[sound._id], false);
+              };
+              node.addEventListener('ended', self._endTimers[sound._id], false);
+            }
+          } catch (err) {
+            self._emit('playerror', sound._id, err);
+          }
+        };
+
+        // If this is streaming audio, make sure the src is set and load again.
+        if (node.src === 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA') {
+          node.src = self._src;
+          node.load();
+        }
+
+        // Play immediately if ready, or wait for the 'canplaythrough'e vent.
+        var loadedNoReadyState = (window && window.ejecta) || (!node.readyState && Howler._navigator.isCocoonJS);
+        if (node.readyState >= 3 || loadedNoReadyState) {
+          playHtml5();
+        } else {
+          self._playLock = true;
+          self._state = 'loading';
+
+          var listener = function() {
+            self._state = 'loaded';
+            
+            // Begin playback.
+            playHtml5();
+
+            // Clear this listener.
+            node.removeEventListener(Howler._canPlayEvent, listener, false);
+          };
+          node.addEventListener(Howler._canPlayEvent, listener, false);
+
+          // Cancel the end timer.
+          self._clearTimer(sound._id);
+        }
+      }
+
+      return sound._id;
+    },
+
+    /**
+     * Pause playback and save current position.
+     * @param  {Number} id The sound ID (empty to pause all in group).
+     * @return {Howl}
+     */
+    pause: function(id) {
+      var self = this;
+
+      // If the sound hasn't loaded or a play() promise is pending, add it to the load queue to pause when capable.
+      if (self._state !== 'loaded' || self._playLock) {
+        self._queue.push({
+          event: 'pause',
+          action: function() {
+            self.pause(id);
+          }
+        });
+
+        return self;
+      }
+
+      // If no id is passed, get all ID's to be paused.
+      var ids = self._getSoundIds(id);
+
+      for (var i=0; i<ids.length; i++) {
+        // Clear the end timer.
+        self._clearTimer(ids[i]);
+
+        // Get the sound.
+        var sound = self._soundById(ids[i]);
+
+        if (sound && !sound._paused) {
+          // Reset the seek position.
+          sound._seek = self.seek(ids[i]);
+          sound._rateSeek = 0;
+          sound._paused = true;
+
+          // Stop currently running fades.
+          self._stopFade(ids[i]);
+
+          if (sound._node) {
+            if (self._webAudio) {
+              // Make sure the sound has been created.
+              if (!sound._node.bufferSource) {
+                continue;
+              }
+
+              if (typeof sound._node.bufferSource.stop === 'undefined') {
+                sound._node.bufferSource.noteOff(0);
+              } else {
+                sound._node.bufferSource.stop(0);
+              }
+
+              // Clean up the buffer source.
+              self._cleanBuffer(sound._node);
+            } else if (!isNaN(sound._node.duration) || sound._node.duration === Infinity) {
+              sound._node.pause();
+            }
+          }
+        }
+
+        // Fire the pause event, unless `true` is passed as the 2nd argument.
+        if (!arguments[1]) {
+          self._emit('pause', sound ? sound._id : null);
+        }
+      }
+
+      return self;
+    },
+
+    /**
+     * Stop playback and reset to start.
+     * @param  {Number} id The sound ID (empty to stop all in group).
+     * @param  {Boolean} internal Internal Use: true prevents event firing.
+     * @return {Howl}
+     */
+    stop: function(id, internal) {
+      var self = this;
+
+      // If the sound hasn't loaded, add it to the load queue to stop when capable.
+      if (self._state !== 'loaded' || self._playLock) {
+        self._queue.push({
+          event: 'stop',
+          action: function() {
+            self.stop(id);
+          }
+        });
+
+        return self;
+      }
+
+      // If no id is passed, get all ID's to be stopped.
+      var ids = self._getSoundIds(id);
+
+      for (var i=0; i<ids.length; i++) {
+        // Clear the end timer.
+        self._clearTimer(ids[i]);
+
+        // Get the sound.
+        var sound = self._soundById(ids[i]);
+
+        if (sound) {
+          // Reset the seek position.
+          sound._seek = sound._start || 0;
+          sound._rateSeek = 0;
+          sound._paused = true;
+          sound._ended = true;
+
+          // Stop currently running fades.
+          self._stopFade(ids[i]);
+
+          if (sound._node) {
+            if (self._webAudio) {
+              // Make sure the sound's AudioBufferSourceNode has been created.
+              if (sound._node.bufferSource) {
+                if (typeof sound._node.bufferSource.stop === 'undefined') {
+                  sound._node.bufferSource.noteOff(0);
+                } else {
+                  sound._node.bufferSource.stop(0);
+                }
+
+                // Clean up the buffer source.
+                self._cleanBuffer(sound._node);
+              }
+            } else if (!isNaN(sound._node.duration) || sound._node.duration === Infinity) {
+              sound._node.currentTime = sound._start || 0;
+              sound._node.pause();
+
+              // If this is a live stream, stop download once the audio is stopped.
+              if (sound._node.duration === Infinity) {
+                self._clearSound(sound._node);
+              }
+            }
+          }
+
+          if (!internal) {
+            self._emit('stop', sound._id);
+          }
+        }
+      }
+
+      return self;
+    },
+
+    /**
+     * Mute/unmute a single sound or all sounds in this Howl group.
+     * @param  {Boolean} muted Set to true to mute and false to unmute.
+     * @param  {Number} id    The sound ID to update (omit to mute/unmute all).
+     * @return {Howl}
+     */
+    mute: function(muted, id) {
+      var self = this;
+
+      // If the sound hasn't loaded, add it to the load queue to mute when capable.
+      if (self._state !== 'loaded'|| self._playLock) {
+        self._queue.push({
+          event: 'mute',
+          action: function() {
+            self.mute(muted, id);
+          }
+        });
+
+        return self;
+      }
+
+      // If applying mute/unmute to all sounds, update the group's value.
+      if (typeof id === 'undefined') {
+        if (typeof muted === 'boolean') {
+          self._muted = muted;
+        } else {
+          return self._muted;
+        }
+      }
+
+      // If no id is passed, get all ID's to be muted.
+      var ids = self._getSoundIds(id);
+
+      for (var i=0; i<ids.length; i++) {
+        // Get the sound.
+        var sound = self._soundById(ids[i]);
+
+        if (sound) {
+          sound._muted = muted;
+
+          // Cancel active fade and set the volume to the end value.
+          if (sound._interval) {
+            self._stopFade(sound._id);
+          }
+
+          if (self._webAudio && sound._node) {
+            sound._node.gain.setValueAtTime(muted ? 0 : sound._volume, Howler.ctx.currentTime);
+          } else if (sound._node) {
+            sound._node.muted = Howler._muted ? true : muted;
+          }
+
+          self._emit('mute', sound._id);
+        }
+      }
+
+      return self;
+    },
+
+    /**
+     * Get/set the volume of this sound or of the Howl group. This method can optionally take 0, 1 or 2 arguments.
+     *   volume() -> Returns the group's volume value.
+     *   volume(id) -> Returns the sound id's current volume.
+     *   volume(vol) -> Sets the volume of all sounds in this Howl group.
+     *   volume(vol, id) -> Sets the volume of passed sound id.
+     * @return {Howl/Number} Returns self or current volume.
+     */
+    volume: function() {
+      var self = this;
+      var args = arguments;
+      var vol, id;
+
+      // Determine the values based on arguments.
+      if (args.length === 0) {
+        // Return the value of the groups' volume.
+        return self._volume;
+      } else if (args.length === 1 || args.length === 2 && typeof args[1] === 'undefined') {
+        // First check if this is an ID, and if not, assume it is a new volume.
+        var ids = self._getSoundIds();
+        var index = ids.indexOf(args[0]);
+        if (index >= 0) {
+          id = parseInt(args[0], 10);
+        } else {
+          vol = parseFloat(args[0]);
+        }
+      } else if (args.length >= 2) {
+        vol = parseFloat(args[0]);
+        id = parseInt(args[1], 10);
+      }
+
+      // Update the volume or return the current volume.
+      var sound;
+      if (typeof vol !== 'undefined' && vol >= 0 && vol <= 1) {
+        // If the sound hasn't loaded, add it to the load queue to change volume when capable.
+        if (self._state !== 'loaded'|| self._playLock) {
+          self._queue.push({
+            event: 'volume',
+            action: function() {
+              self.volume.apply(self, args);
+            }
+          });
+
+          return self;
+        }
+
+        // Set the group volume.
+        if (typeof id === 'undefined') {
+          self._volume = vol;
+        }
+
+        // Update one or all volumes.
+        id = self._getSoundIds(id);
+        for (var i=0; i<id.length; i++) {
+          // Get the sound.
+          sound = self._soundById(id[i]);
+
+          if (sound) {
+            sound._volume = vol;
+
+            // Stop currently running fades.
+            if (!args[2]) {
+              self._stopFade(id[i]);
+            }
+
+            if (self._webAudio && sound._node && !sound._muted) {
+              sound._node.gain.setValueAtTime(vol, Howler.ctx.currentTime);
+            } else if (sound._node && !sound._muted) {
+              sound._node.volume = vol * Howler.volume();
+            }
+
+            self._emit('volume', sound._id);
+          }
+        }
+      } else {
+        sound = id ? self._soundById(id) : self._sounds[0];
+        return sound ? sound._volume : 0;
+      }
+
+      return self;
+    },
+
+    /**
+     * Fade a currently playing sound between two volumes (if no id is passed, all sounds will fade).
+     * @param  {Number} from The value to fade from (0.0 to 1.0).
+     * @param  {Number} to   The volume to fade to (0.0 to 1.0).
+     * @param  {Number} len  Time in milliseconds to fade.
+     * @param  {Number} id   The sound id (omit to fade all sounds).
+     * @return {Howl}
+     */
+    fade: function(from, to, len, id) {
+      var self = this;
+
+      // If the sound hasn't loaded, add it to the load queue to fade when capable.
+      if (self._state !== 'loaded' || self._playLock) {
+        self._queue.push({
+          event: 'fade',
+          action: function() {
+            self.fade(from, to, len, id);
+          }
+        });
+
+        return self;
+      }
+
+      // Make sure the to/from/len values are numbers.
+      from = Math.min(Math.max(0, parseFloat(from)), 1);
+      to = Math.min(Math.max(0, parseFloat(to)), 1);
+      len = parseFloat(len);
+
+      // Set the volume to the start position.
+      self.volume(from, id);
+
+      // Fade the volume of one or all sounds.
+      var ids = self._getSoundIds(id);
+      for (var i=0; i<ids.length; i++) {
+        // Get the sound.
+        var sound = self._soundById(ids[i]);
+
+        // Create a linear fade or fall back to timeouts with HTML5 Audio.
+        if (sound) {
+          // Stop the previous fade if no sprite is being used (otherwise, volume handles this).
+          if (!id) {
+            self._stopFade(ids[i]);
+          }
+
+          // If we are using Web Audio, let the native methods do the actual fade.
+          if (self._webAudio && !sound._muted) {
+            var currentTime = Howler.ctx.currentTime;
+            var end = currentTime + (len / 1000);
+            sound._volume = from;
+            sound._node.gain.setValueAtTime(from, currentTime);
+            sound._node.gain.linearRampToValueAtTime(to, end);
+          }
+
+          self._startFadeInterval(sound, from, to, len, ids[i], typeof id === 'undefined');
+        }
+      }
+
+      return self;
+    },
+
+    /**
+     * Starts the internal interval to fade a sound.
+     * @param  {Object} sound Reference to sound to fade.
+     * @param  {Number} from The value to fade from (0.0 to 1.0).
+     * @param  {Number} to   The volume to fade to (0.0 to 1.0).
+     * @param  {Number} len  Time in milliseconds to fade.
+     * @param  {Number} id   The sound id to fade.
+     * @param  {Boolean} isGroup   If true, set the volume on the group.
+     */
+    _startFadeInterval: function(sound, from, to, len, id, isGroup) {
+      var self = this;
+      var vol = from;
+      var diff = to - from;
+      var steps = Math.abs(diff / 0.01);
+      var stepLen = Math.max(4, (steps > 0) ? len / steps : len);
+      var lastTick = Date.now();
+
+      // Store the value being faded to.
+      sound._fadeTo = to;
+
+      // Update the volume value on each interval tick.
+      sound._interval = setInterval(function() {
+        // Update the volume based on the time since the last tick.
+        var tick = (Date.now() - lastTick) / len;
+        lastTick = Date.now();
+        vol += diff * tick;
+
+        // Round to within 2 decimal points.
+        vol = Math.round(vol * 100) / 100;
+
+        // Make sure the volume is in the right bounds.
+        if (diff < 0) {
+          vol = Math.max(to, vol);
+        } else {
+          vol = Math.min(to, vol);
+        }
+
+        // Change the volume.
+        if (self._webAudio) {
+          sound._volume = vol;
+        } else {
+          self.volume(vol, sound._id, true);
+        }
+
+        // Set the group's volume.
+        if (isGroup) {
+          self._volume = vol;
+        }
+
+        // When the fade is complete, stop it and fire event.
+        if ((to < from && vol <= to) || (to > from && vol >= to)) {
+          clearInterval(sound._interval);
+          sound._interval = null;
+          sound._fadeTo = null;
+          self.volume(to, sound._id);
+          self._emit('fade', sound._id);
+        }
+      }, stepLen);
+    },
+
+    /**
+     * Internal method that stops the currently playing fade when
+     * a new fade starts, volume is changed or the sound is stopped.
+     * @param  {Number} id The sound id.
+     * @return {Howl}
+     */
+    _stopFade: function(id) {
+      var self = this;
+      var sound = self._soundById(id);
+
+      if (sound && sound._interval) {
+        if (self._webAudio) {
+          sound._node.gain.cancelScheduledValues(Howler.ctx.currentTime);
+        }
+
+        clearInterval(sound._interval);
+        sound._interval = null;
+        self.volume(sound._fadeTo, id);
+        sound._fadeTo = null;
+        self._emit('fade', id);
+      }
+
+      return self;
+    },
+
+    /**
+     * Get/set the loop parameter on a sound. This method can optionally take 0, 1 or 2 arguments.
+     *   loop() -> Returns the group's loop value.
+     *   loop(id) -> Returns the sound id's loop value.
+     *   loop(loop) -> Sets the loop value for all sounds in this Howl group.
+     *   loop(loop, id) -> Sets the loop value of passed sound id.
+     * @return {Howl/Boolean} Returns self or current loop value.
+     */
+    loop: function() {
+      var self = this;
+      var args = arguments;
+      var loop, id, sound;
+
+      // Determine the values for loop and id.
+      if (args.length === 0) {
+        // Return the grou's loop value.
+        return self._loop;
+      } else if (args.length === 1) {
+        if (typeof args[0] === 'boolean') {
+          loop = args[0];
+          self._loop = loop;
+        } else {
+          // Return this sound's loop value.
+          sound = self._soundById(parseInt(args[0], 10));
+          return sound ? sound._loop : false;
+        }
+      } else if (args.length === 2) {
+        loop = args[0];
+        id = parseInt(args[1], 10);
+      }
+
+      // If no id is passed, get all ID's to be looped.
+      var ids = self._getSoundIds(id);
+      for (var i=0; i<ids.length; i++) {
+        sound = self._soundById(ids[i]);
+
+        if (sound) {
+          sound._loop = loop;
+          if (self._webAudio && sound._node && sound._node.bufferSource) {
+            sound._node.bufferSource.loop = loop;
+            if (loop) {
+              sound._node.bufferSource.loopStart = sound._start || 0;
+              sound._node.bufferSource.loopEnd = sound._stop;
+
+              // If playing, restart playback to ensure looping updates.
+              if (self.playing(ids[i])) {
+                self.pause(ids[i], true);
+                self.play(ids[i], true);
+              }
+            }
+          }
+        }
+      }
+
+      return self;
+    },
+
+    /**
+     * Get/set the playback rate of a sound. This method can optionally take 0, 1 or 2 arguments.
+     *   rate() -> Returns the first sound node's current playback rate.
+     *   rate(id) -> Returns the sound id's current playback rate.
+     *   rate(rate) -> Sets the playback rate of all sounds in this Howl group.
+     *   rate(rate, id) -> Sets the playback rate of passed sound id.
+     * @return {Howl/Number} Returns self or the current playback rate.
+     */
+    rate: function() {
+      var self = this;
+      var args = arguments;
+      var rate, id;
+
+      // Determine the values based on arguments.
+      if (args.length === 0) {
+        // We will simply return the current rate of the first node.
+        id = self._sounds[0]._id;
+      } else if (args.length === 1) {
+        // First check if this is an ID, and if not, assume it is a new rate value.
+        var ids = self._getSoundIds();
+        var index = ids.indexOf(args[0]);
+        if (index >= 0) {
+          id = parseInt(args[0], 10);
+        } else {
+          rate = parseFloat(args[0]);
+        }
+      } else if (args.length === 2) {
+        rate = parseFloat(args[0]);
+        id = parseInt(args[1], 10);
+      }
+
+      // Update the playback rate or return the current value.
+      var sound;
+      if (typeof rate === 'number') {
+        // If the sound hasn't loaded, add it to the load queue to change playback rate when capable.
+        if (self._state !== 'loaded' || self._playLock) {
+          self._queue.push({
+            event: 'rate',
+            action: function() {
+              self.rate.apply(self, args);
+            }
+          });
+
+          return self;
+        }
+
+        // Set the group rate.
+        if (typeof id === 'undefined') {
+          self._rate = rate;
+        }
+
+        // Update one or all volumes.
+        id = self._getSoundIds(id);
+        for (var i=0; i<id.length; i++) {
+          // Get the sound.
+          sound = self._soundById(id[i]);
+
+          if (sound) {
+            // Keep track of our position when the rate changed and update the playback
+            // start position so we can properly adjust the seek position for time elapsed.
+            if (self.playing(id[i])) {
+              sound._rateSeek = self.seek(id[i]);
+              sound._playStart = self._webAudio ? Howler.ctx.currentTime : sound._playStart;
+            }
+            sound._rate = rate;
+
+            // Change the playback rate.
+            if (self._webAudio && sound._node && sound._node.bufferSource) {
+              sound._node.bufferSource.playbackRate.setValueAtTime(rate, Howler.ctx.currentTime);
+            } else if (sound._node) {
+              sound._node.playbackRate = rate;
+            }
+
+            // Reset the timers.
+            var seek = self.seek(id[i]);
+            var duration = ((self._sprite[sound._sprite][0] + self._sprite[sound._sprite][1]) / 1000) - seek;
+            var timeout = (duration * 1000) / Math.abs(sound._rate);
+
+            // Start a new end timer if sound is already playing.
+            if (self._endTimers[id[i]] || !sound._paused) {
+              self._clearTimer(id[i]);
+              self._endTimers[id[i]] = setTimeout(self._ended.bind(self, sound), timeout);
+            }
+
+            self._emit('rate', sound._id);
+          }
+        }
+      } else {
+        sound = self._soundById(id);
+        return sound ? sound._rate : self._rate;
+      }
+
+      return self;
+    },
+
+    /**
+     * Get/set the seek position of a sound. This method can optionally take 0, 1 or 2 arguments.
+     *   seek() -> Returns the first sound node's current seek position.
+     *   seek(id) -> Returns the sound id's current seek position.
+     *   seek(seek) -> Sets the seek position of the first sound node.
+     *   seek(seek, id) -> Sets the seek position of passed sound id.
+     * @return {Howl/Number} Returns self or the current seek position.
+     */
+    seek: function() {
+      var self = this;
+      var args = arguments;
+      var seek, id;
+
+      // Determine the values based on arguments.
+      if (args.length === 0) {
+        // We will simply return the current position of the first node.
+        if (self._sounds.length) {
+          id = self._sounds[0]._id;
+        }
+      } else if (args.length === 1) {
+        // First check if this is an ID, and if not, assume it is a new seek position.
+        var ids = self._getSoundIds();
+        var index = ids.indexOf(args[0]);
+        if (index >= 0) {
+          id = parseInt(args[0], 10);
+        } else if (self._sounds.length) {
+          id = self._sounds[0]._id;
+          seek = parseFloat(args[0]);
+        }
+      } else if (args.length === 2) {
+        seek = parseFloat(args[0]);
+        id = parseInt(args[1], 10);
+      }
+
+      // If there is no ID, bail out.
+      if (typeof id === 'undefined') {
+        return 0;
+      }
+
+      // If the sound hasn't loaded, add it to the load queue to seek when capable.
+      if (typeof seek === 'number' && (self._state !== 'loaded' || self._playLock)) {
+        self._queue.push({
+          event: 'seek',
+          action: function() {
+            self.seek.apply(self, args);
+          }
+        });
+
+        return self;
+      }
+
+      // Get the sound.
+      var sound = self._soundById(id);
+
+      if (sound) {
+        if (typeof seek === 'number' && seek >= 0) {
+          // Pause the sound and update position for restarting playback.
+          var playing = self.playing(id);
+          if (playing) {
+            self.pause(id, true);
+          }
+
+          // Move the position of the track and cancel timer.
+          sound._seek = seek;
+          sound._ended = false;
+          self._clearTimer(id);
+
+          // Update the seek position for HTML5 Audio.
+          if (!self._webAudio && sound._node && !isNaN(sound._node.duration)) {
+            sound._node.currentTime = seek;
+          }
+
+          // Seek and emit when ready.
+          var seekAndEmit = function() {
+            // Restart the playback if the sound was playing.
+            if (playing) {
+              self.play(id, true);
+            }
+
+            self._emit('seek', id);
+          };
+
+          // Wait for the play lock to be unset before emitting (HTML5 Audio).
+          if (playing && !self._webAudio) {
+            var emitSeek = function() {
+              if (!self._playLock) {
+                seekAndEmit();
+              } else {
+                setTimeout(emitSeek, 0);
+              }
+            };
+            setTimeout(emitSeek, 0);
+          } else {
+            seekAndEmit();
+          }
+        } else {
+          if (self._webAudio) {
+            var realTime = self.playing(id) ? Howler.ctx.currentTime - sound._playStart : 0;
+            var rateSeek = sound._rateSeek ? sound._rateSeek - sound._seek : 0;
+            return sound._seek + (rateSeek + realTime * Math.abs(sound._rate));
+          } else {
+            return sound._node.currentTime;
+          }
+        }
+      }
+
+      return self;
+    },
+
+    /**
+     * Check if a specific sound is currently playing or not (if id is provided), or check if at least one of the sounds in the group is playing or not.
+     * @param  {Number}  id The sound id to check. If none is passed, the whole sound group is checked.
+     * @return {Boolean} True if playing and false if not.
+     */
+    playing: function(id) {
+      var self = this;
+
+      // Check the passed sound ID (if any).
+      if (typeof id === 'number') {
+        var sound = self._soundById(id);
+        return sound ? !sound._paused : false;
+      }
+
+      // Otherwise, loop through all sounds and check if any are playing.
+      for (var i=0; i<self._sounds.length; i++) {
+        if (!self._sounds[i]._paused) {
+          return true;
+        }
+      }
+
+      return false;
+    },
+
+    /**
+     * Get the duration of this sound. Passing a sound id will return the sprite duration.
+     * @param  {Number} id The sound id to check. If none is passed, return full source duration.
+     * @return {Number} Audio duration in seconds.
+     */
+    duration: function(id) {
+      var self = this;
+      var duration = self._duration;
+
+      // If we pass an ID, get the sound and return the sprite length.
+      var sound = self._soundById(id);
+      if (sound) {
+        duration = self._sprite[sound._sprite][1] / 1000;
+      }
+
+      return duration;
+    },
+
+    /**
+     * Returns the current loaded state of this Howl.
+     * @return {String} 'unloaded', 'loading', 'loaded'
+     */
+    state: function() {
+      return this._state;
+    },
+
+    /**
+     * Unload and destroy the current Howl object.
+     * This will immediately stop all sound instances attached to this group.
+     */
+    unload: function() {
+      var self = this;
+
+      // Stop playing any active sounds.
+      var sounds = self._sounds;
+      for (var i=0; i<sounds.length; i++) {
+        // Stop the sound if it is currently playing.
+        if (!sounds[i]._paused) {
+          self.stop(sounds[i]._id);
+        }
+
+        // Remove the source or disconnect.
+        if (!self._webAudio) {
+          // Set the source to 0-second silence to stop any downloading (except in IE).
+          self._clearSound(sounds[i]._node);
+
+          // Remove any event listeners.
+          sounds[i]._node.removeEventListener('error', sounds[i]._errorFn, false);
+          sounds[i]._node.removeEventListener(Howler._canPlayEvent, sounds[i]._loadFn, false);
+          sounds[i]._node.removeEventListener('ended', sounds[i]._endFn, false);
+
+          // Release the Audio object back to the pool.
+          Howler._releaseHtml5Audio(sounds[i]._node);
+        }
+
+        // Empty out all of the nodes.
+        delete sounds[i]._node;
+
+        // Make sure all timers are cleared out.
+        self._clearTimer(sounds[i]._id);
+      }
+
+      // Remove the references in the global Howler object.
+      var index = Howler._howls.indexOf(self);
+      if (index >= 0) {
+        Howler._howls.splice(index, 1);
+      }
+
+      // Delete this sound from the cache (if no other Howl is using it).
+      var remCache = true;
+      for (i=0; i<Howler._howls.length; i++) {
+        if (Howler._howls[i]._src === self._src || self._src.indexOf(Howler._howls[i]._src) >= 0) {
+          remCache = false;
+          break;
+        }
+      }
+
+      if (cache && remCache) {
+        delete cache[self._src];
+      }
+
+      // Clear global errors.
+      Howler.noAudio = false;
+
+      // Clear out `self`.
+      self._state = 'unloaded';
+      self._sounds = [];
+      self = null;
+
+      return null;
+    },
+
+    /**
+     * Listen to a custom event.
+     * @param  {String}   event Event name.
+     * @param  {Function} fn    Listener to call.
+     * @param  {Number}   id    (optional) Only listen to events for this sound.
+     * @param  {Number}   once  (INTERNAL) Marks event to fire only once.
+     * @return {Howl}
+     */
+    on: function(event, fn, id, once) {
+      var self = this;
+      var events = self['_on' + event];
+
+      if (typeof fn === 'function') {
+        events.push(once ? {id: id, fn: fn, once: once} : {id: id, fn: fn});
+      }
+
+      return self;
+    },
+
+    /**
+     * Remove a custom event. Call without parameters to remove all events.
+     * @param  {String}   event Event name.
+     * @param  {Function} fn    Listener to remove. Leave empty to remove all.
+     * @param  {Number}   id    (optional) Only remove events for this sound.
+     * @return {Howl}
+     */
+    off: function(event, fn, id) {
+      var self = this;
+      var events = self['_on' + event];
+      var i = 0;
+
+      // Allow passing just an event and ID.
+      if (typeof fn === 'number') {
+        id = fn;
+        fn = null;
+      }
+
+      if (fn || id) {
+        // Loop through event store and remove the passed function.
+        for (i=0; i<events.length; i++) {
+          var isId = (id === events[i].id);
+          if (fn === events[i].fn && isId || !fn && isId) {
+            events.splice(i, 1);
+            break;
+          }
+        }
+      } else if (event) {
+        // Clear out all events of this type.
+        self['_on' + event] = [];
+      } else {
+        // Clear out all events of every type.
+        var keys = Object.keys(self);
+        for (i=0; i<keys.length; i++) {
+          if ((keys[i].indexOf('_on') === 0) && Array.isArray(self[keys[i]])) {
+            self[keys[i]] = [];
+          }
+        }
+      }
+
+      return self;
+    },
+
+    /**
+     * Listen to a custom event and remove it once fired.
+     * @param  {String}   event Event name.
+     * @param  {Function} fn    Listener to call.
+     * @param  {Number}   id    (optional) Only listen to events for this sound.
+     * @return {Howl}
+     */
+    once: function(event, fn, id) {
+      var self = this;
+
+      // Setup the event listener.
+      self.on(event, fn, id, 1);
+
+      return self;
+    },
+
+    /**
+     * Emit all events of a specific type and pass the sound id.
+     * @param  {String} event Event name.
+     * @param  {Number} id    Sound ID.
+     * @param  {Number} msg   Message to go with event.
+     * @return {Howl}
+     */
+    _emit: function(event, id, msg) {
+      var self = this;
+      var events = self['_on' + event];
+
+      // Loop through event store and fire all functions.
+      for (var i=events.length-1; i>=0; i--) {
+        // Only fire the listener if the correct ID is used.
+        if (!events[i].id || events[i].id === id || event === 'load') {
+          setTimeout(function(fn) {
+            fn.call(this, id, msg);
+          }.bind(self, events[i].fn), 0);
+
+          // If this event was setup with `once`, remove it.
+          if (events[i].once) {
+            self.off(event, events[i].fn, events[i].id);
+          }
+        }
+      }
+
+      // Pass the event type into load queue so that it can continue stepping.
+      self._loadQueue(event);
+
+      return self;
+    },
+
+    /**
+     * Queue of actions initiated before the sound has loaded.
+     * These will be called in sequence, with the next only firing
+     * after the previous has finished executing (even if async like play).
+     * @return {Howl}
+     */
+    _loadQueue: function(event) {
+      var self = this;
+
+      if (self._queue.length > 0) {
+        var task = self._queue[0];
+
+        // Remove this task if a matching event was passed.
+        if (task.event === event) {
+          self._queue.shift();
+          self._loadQueue();
+        }
+
+        // Run the task if no event type is passed.
+        if (!event) {
+          task.action();
+        }
+      }
+
+      return self;
+    },
+
+    /**
+     * Fired when playback ends at the end of the duration.
+     * @param  {Sound} sound The sound object to work with.
+     * @return {Howl}
+     */
+    _ended: function(sound) {
+      var self = this;
+      var sprite = sound._sprite;
+
+      // If we are using IE and there was network latency we may be clipping
+      // audio before it completes playing. Lets check the node to make sure it
+      // believes it has completed, before ending the playback.
+      if (!self._webAudio && sound._node && !sound._node.paused && !sound._node.ended && sound._node.currentTime < sound._stop) {
+        setTimeout(self._ended.bind(self, sound), 100);
+        return self;
+      }
+
+      // Should this sound loop?
+      var loop = !!(sound._loop || self._sprite[sprite][2]);
+
+      // Fire the ended event.
+      self._emit('end', sound._id);
+
+      // Restart the playback for HTML5 Audio loop.
+      if (!self._webAudio && loop) {
+        self.stop(sound._id, true).play(sound._id);
+      }
+
+      // Restart this timer if on a Web Audio loop.
+      if (self._webAudio && loop) {
+        self._emit('play', sound._id);
+        sound._seek = sound._start || 0;
+        sound._rateSeek = 0;
+        sound._playStart = Howler.ctx.currentTime;
+
+        var timeout = ((sound._stop - sound._start) * 1000) / Math.abs(sound._rate);
+        self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
+      }
+
+      // Mark the node as paused.
+      if (self._webAudio && !loop) {
+        sound._paused = true;
+        sound._ended = true;
+        sound._seek = sound._start || 0;
+        sound._rateSeek = 0;
+        self._clearTimer(sound._id);
+
+        // Clean up the buffer source.
+        self._cleanBuffer(sound._node);
+
+        // Attempt to auto-suspend AudioContext if no sounds are still playing.
+        Howler._autoSuspend();
+      }
+
+      // When using a sprite, end the track.
+      if (!self._webAudio && !loop) {
+        self.stop(sound._id, true);
+      }
+
+      return self;
+    },
+
+    /**
+     * Clear the end timer for a sound playback.
+     * @param  {Number} id The sound ID.
+     * @return {Howl}
+     */
+    _clearTimer: function(id) {
+      var self = this;
+
+      if (self._endTimers[id]) {
+        // Clear the timeout or remove the ended listener.
+        if (typeof self._endTimers[id] !== 'function') {
+          clearTimeout(self._endTimers[id]);
+        } else {
+          var sound = self._soundById(id);
+          if (sound && sound._node) {
+            sound._node.removeEventListener('ended', self._endTimers[id], false);
+          }
+        }
+
+        delete self._endTimers[id];
+      }
+
+      return self;
+    },
+
+    /**
+     * Return the sound identified by this ID, or return null.
+     * @param  {Number} id Sound ID
+     * @return {Object}    Sound object or null.
+     */
+    _soundById: function(id) {
+      var self = this;
+
+      // Loop through all sounds and find the one with this ID.
+      for (var i=0; i<self._sounds.length; i++) {
+        if (id === self._sounds[i]._id) {
+          return self._sounds[i];
+        }
+      }
+
+      return null;
+    },
+
+    /**
+     * Return an inactive sound from the pool or create a new one.
+     * @return {Sound} Sound playback object.
+     */
+    _inactiveSound: function() {
+      var self = this;
+
+      self._drain();
+
+      // Find the first inactive node to recycle.
+      for (var i=0; i<self._sounds.length; i++) {
+        if (self._sounds[i]._ended) {
+          return self._sounds[i].reset();
+        }
+      }
+
+      // If no inactive node was found, create a new one.
+      return new Sound(self);
+    },
+
+    /**
+     * Drain excess inactive sounds from the pool.
+     */
+    _drain: function() {
+      var self = this;
+      var limit = self._pool;
+      var cnt = 0;
+      var i = 0;
+
+      // If there are less sounds than the max pool size, we are done.
+      if (self._sounds.length < limit) {
+        return;
+      }
+
+      // Count the number of inactive sounds.
+      for (i=0; i<self._sounds.length; i++) {
+        if (self._sounds[i]._ended) {
+          cnt++;
+        }
+      }
+
+      // Remove excess inactive sounds, going in reverse order.
+      for (i=self._sounds.length - 1; i>=0; i--) {
+        if (cnt <= limit) {
+          return;
+        }
+
+        if (self._sounds[i]._ended) {
+          // Disconnect the audio source when using Web Audio.
+          if (self._webAudio && self._sounds[i]._node) {
+            self._sounds[i]._node.disconnect(0);
+          }
+
+          // Remove sounds until we have the pool size.
+          self._sounds.splice(i, 1);
+          cnt--;
+        }
+      }
+    },
+
+    /**
+     * Get all ID's from the sounds pool.
+     * @param  {Number} id Only return one ID if one is passed.
+     * @return {Array}    Array of IDs.
+     */
+    _getSoundIds: function(id) {
+      var self = this;
+
+      if (typeof id === 'undefined') {
+        var ids = [];
+        for (var i=0; i<self._sounds.length; i++) {
+          ids.push(self._sounds[i]._id);
+        }
+
+        return ids;
+      } else {
+        return [id];
+      }
+    },
+
+    /**
+     * Load the sound back into the buffer source.
+     * @param  {Sound} sound The sound object to work with.
+     * @return {Howl}
+     */
+    _refreshBuffer: function(sound) {
+      var self = this;
+
+      // Setup the buffer source for playback.
+      sound._node.bufferSource = Howler.ctx.createBufferSource();
+      sound._node.bufferSource.buffer = cache[self._src];
+
+      // Connect to the correct node.
+      if (sound._panner) {
+        sound._node.bufferSource.connect(sound._panner);
+      } else {
+        sound._node.bufferSource.connect(sound._node);
+      }
+
+      // Setup looping and playback rate.
+      sound._node.bufferSource.loop = sound._loop;
+      if (sound._loop) {
+        sound._node.bufferSource.loopStart = sound._start || 0;
+        sound._node.bufferSource.loopEnd = sound._stop || 0;
+      }
+      sound._node.bufferSource.playbackRate.setValueAtTime(sound._rate, Howler.ctx.currentTime);
+
+      return self;
+    },
+
+    /**
+     * Prevent memory leaks by cleaning up the buffer source after playback.
+     * @param  {Object} node Sound's audio node containing the buffer source.
+     * @return {Howl}
+     */
+    _cleanBuffer: function(node) {
+      var self = this;
+      var isIOS = Howler._navigator && Howler._navigator.vendor.indexOf('Apple') >= 0;
+
+      if (!node.bufferSource) {
+        return self;
+      }
+
+      if (Howler._scratchBuffer && node.bufferSource) {
+        node.bufferSource.onended = null;
+        node.bufferSource.disconnect(0);
+        if (isIOS) {
+          try { node.bufferSource.buffer = Howler._scratchBuffer; } catch(e) {}
+        }
+      }
+      node.bufferSource = null;
+
+      return self;
+    },
+
+    /**
+     * Set the source to a 0-second silence to stop any downloading (except in IE).
+     * @param  {Object} node Audio node to clear.
+     */
+    _clearSound: function(node) {
+      var checkIE = /MSIE |Trident\//.test(Howler._navigator && Howler._navigator.userAgent);
+      if (!checkIE) {
+        node.src = 'data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA';
+      }
+    }
+  };
+
+  /** Single Sound Methods **/
+  /***************************************************************************/
+
+  /**
+   * Setup the sound object, which each node attached to a Howl group is contained in.
+   * @param {Object} howl The Howl parent group.
+   */
+  var Sound = function(howl) {
+    this._parent = howl;
+    this.init();
+  };
+  Sound.prototype = {
+    /**
+     * Initialize a new Sound object.
+     * @return {Sound}
+     */
+    init: function() {
+      var self = this;
+      var parent = self._parent;
+
+      // Setup the default parameters.
+      self._muted = parent._muted;
+      self._loop = parent._loop;
+      self._volume = parent._volume;
+      self._rate = parent._rate;
+      self._seek = 0;
+      self._paused = true;
+      self._ended = true;
+      self._sprite = '__default';
+
+      // Generate a unique ID for this sound.
+      self._id = ++Howler._counter;
+
+      // Add itself to the parent's pool.
+      parent._sounds.push(self);
+
+      // Create the new node.
+      self.create();
+
+      return self;
+    },
+
+    /**
+     * Create and setup a new sound object, whether HTML5 Audio or Web Audio.
+     * @return {Sound}
+     */
+    create: function() {
+      var self = this;
+      var parent = self._parent;
+      var volume = (Howler._muted || self._muted || self._parent._muted) ? 0 : self._volume;
+
+      if (parent._webAudio) {
+        // Create the gain node for controlling volume (the source will connect to this).
+        self._node = (typeof Howler.ctx.createGain === 'undefined') ? Howler.ctx.createGainNode() : Howler.ctx.createGain();
+        self._node.gain.setValueAtTime(volume, Howler.ctx.currentTime);
+        self._node.paused = true;
+        self._node.connect(Howler.masterGain);
+      } else if (!Howler.noAudio) {
+        // Get an unlocked Audio object from the pool.
+        self._node = Howler._obtainHtml5Audio();
+
+        // Listen for errors (http://dev.w3.org/html5/spec-author-view/spec.html#mediaerror).
+        self._errorFn = self._errorListener.bind(self);
+        self._node.addEventListener('error', self._errorFn, false);
+
+        // Listen for 'canplaythrough' event to let us know the sound is ready.
+        self._loadFn = self._loadListener.bind(self);
+        self._node.addEventListener(Howler._canPlayEvent, self._loadFn, false);
+
+        // Listen for the 'ended' event on the sound to account for edge-case where
+        // a finite sound has a duration of Infinity.
+        self._endFn = self._endListener.bind(self);
+        self._node.addEventListener('ended', self._endFn, false);
+
+        // Setup the new audio node.
+        self._node.src = parent._src;
+        self._node.preload = parent._preload === true ? 'auto' : parent._preload;
+        self._node.volume = volume * Howler.volume();
+
+        // Begin loading the source.
+        self._node.load();
+      }
+
+      return self;
+    },
+
+    /**
+     * Reset the parameters of this sound to the original state (for recycle).
+     * @return {Sound}
+     */
+    reset: function() {
+      var self = this;
+      var parent = self._parent;
+
+      // Reset all of the parameters of this sound.
+      self._muted = parent._muted;
+      self._loop = parent._loop;
+      self._volume = parent._volume;
+      self._rate = parent._rate;
+      self._seek = 0;
+      self._rateSeek = 0;
+      self._paused = true;
+      self._ended = true;
+      self._sprite = '__default';
+
+      // Generate a new ID so that it isn't confused with the previous sound.
+      self._id = ++Howler._counter;
+
+      return self;
+    },
+
+    /**
+     * HTML5 Audio error listener callback.
+     */
+    _errorListener: function() {
+      var self = this;
+
+      // Fire an error event and pass back the code.
+      self._parent._emit('loaderror', self._id, self._node.error ? self._node.error.code : 0);
+
+      // Clear the event listener.
+      self._node.removeEventListener('error', self._errorFn, false);
+    },
+
+    /**
+     * HTML5 Audio canplaythrough listener callback.
+     */
+    _loadListener: function() {
+      var self = this;
+      var parent = self._parent;
+
+      // Round up the duration to account for the lower precision in HTML5 Audio.
+      parent._duration = Math.ceil(self._node.duration * 10) / 10;
+
+      // Setup a sprite if none is defined.
+      if (Object.keys(parent._sprite).length === 0) {
+        parent._sprite = {__default: [0, parent._duration * 1000]};
+      }
+
+      if (parent._state !== 'loaded') {
+        parent._state = 'loaded';
+        parent._emit('load');
+        parent._loadQueue();
+      }
+
+      // Clear the event listener.
+      self._node.removeEventListener(Howler._canPlayEvent, self._loadFn, false);
+    },
+
+    /**
+     * HTML5 Audio ended listener callback.
+     */
+    _endListener: function() {
+      var self = this;
+      var parent = self._parent;
+
+      // Only handle the `ended`` event if the duration is Infinity.
+      if (parent._duration === Infinity) {
+        // Update the parent duration to match the real audio duration.
+        // Round up the duration to account for the lower precision in HTML5 Audio.
+        parent._duration = Math.ceil(self._node.duration * 10) / 10;
+
+        // Update the sprite that corresponds to the real duration.
+        if (parent._sprite.__default[1] === Infinity) {
+          parent._sprite.__default[1] = parent._duration * 1000;
+        }
+
+        // Run the regular ended method.
+        parent._ended(self);
+      }
+
+      // Clear the event listener since the duration is now correct.
+      self._node.removeEventListener('ended', self._endFn, false);
+    }
+  };
+
+  /** Helper Methods **/
+  /***************************************************************************/
+
+  var cache = {};
+
+  /**
+   * Buffer a sound from URL, Data URI or cache and decode to audio source (Web Audio API).
+   * @param  {Howl} self
+   */
+  var loadBuffer = function(self) {
+    var url = self._src;
+
+    // Check if the buffer has already been cached and use it instead.
+    if (cache[url]) {
+      // Set the duration from the cache.
+      self._duration = cache[url].duration;
+
+      // Load the sound into this Howl.
+      loadSound(self);
+
+      return;
+    }
+
+    if (/^data:[^;]+;base64,/.test(url)) {
+      // Decode the base64 data URI without XHR, since some browsers don't support it.
+      var data = atob(url.split(',')[1]);
+      var dataView = new Uint8Array(data.length);
+      for (var i=0; i<data.length; ++i) {
+        dataView[i] = data.charCodeAt(i);
+      }
+
+      decodeAudioData(dataView.buffer, self);
+    } else {
+      // Load the buffer from the URL.
+      var xhr = new XMLHttpRequest();
+      xhr.open(self._xhr.method, url, true);
+      xhr.withCredentials = self._xhr.withCredentials;
+      xhr.responseType = 'arraybuffer';
+
+      // Apply any custom headers to the request.
+      if (self._xhr.headers) {
+        Object.keys(self._xhr.headers).forEach(function(key) {
+          xhr.setRequestHeader(key, self._xhr.headers[key]);
+        });
+      }
+
+      xhr.onload = function() {
+        // Make sure we get a successful response back.
+        var code = (xhr.status + '')[0];
+        if (code !== '0' && code !== '2' && code !== '3') {
+          self._emit('loaderror', null, 'Failed loading audio file with status: ' + xhr.status + '.');
+          return;
+        }
+
+        decodeAudioData(xhr.response, self);
+      };
+      xhr.onerror = function() {
+        // If there is an error, switch to HTML5 Audio.
+        if (self._webAudio) {
+          self._html5 = true;
+          self._webAudio = false;
+          self._sounds = [];
+          delete cache[url];
+          self.load();
+        }
+      };
+      safeXhrSend(xhr);
+    }
+  };
+
+  /**
+   * Send the XHR request wrapped in a try/catch.
+   * @param  {Object} xhr XHR to send.
+   */
+  var safeXhrSend = function(xhr) {
+    try {
+      xhr.send();
+    } catch (e) {
+      xhr.onerror();
+    }
+  };
+
+  /**
+   * Decode audio data from an array buffer.
+   * @param  {ArrayBuffer} arraybuffer The audio data.
+   * @param  {Howl}        self
+   */
+  var decodeAudioData = function(arraybuffer, self) {
+    // Fire a load error if something broke.
+    var error = function() {
+      self._emit('loaderror', null, 'Decoding audio data failed.');
+    };
+
+    // Load the sound on success.
+    var success = function(buffer) {
+      if (buffer && self._sounds.length > 0) {
+        cache[self._src] = buffer;
+        loadSound(self, buffer);
+      } else {
+        error();
+      }
+    };
+
+    // Decode the buffer into an audio source.
+    if (typeof Promise !== 'undefined' && Howler.ctx.decodeAudioData.length === 1) {
+      Howler.ctx.decodeAudioData(arraybuffer).then(success).catch(error);
+    } else {
+      Howler.ctx.decodeAudioData(arraybuffer, success, error);
+    }
+  }
+
+  /**
+   * Sound is now loaded, so finish setting everything up and fire the loaded event.
+   * @param  {Howl} self
+   * @param  {Object} buffer The decoded buffer sound source.
+   */
+  var loadSound = function(self, buffer) {
+    // Set the duration.
+    if (buffer && !self._duration) {
+      self._duration = buffer.duration;
+    }
+
+    // Setup a sprite if none is defined.
+    if (Object.keys(self._sprite).length === 0) {
+      self._sprite = {__default: [0, self._duration * 1000]};
+    }
+
+    // Fire the loaded event.
+    if (self._state !== 'loaded') {
+      self._state = 'loaded';
+      self._emit('load');
+      self._loadQueue();
+    }
+  };
+
+  /**
+   * Setup the audio context when available, or switch to HTML5 Audio mode.
+   */
+  var setupAudioContext = function() {
+    // If we have already detected that Web Audio isn't supported, don't run this step again.
+    if (!Howler.usingWebAudio) {
+      return;
+    }
+
+    // Check if we are using Web Audio and setup the AudioContext if we are.
+    try {
+      if (typeof AudioContext !== 'undefined') {
+        Howler.ctx = new AudioContext();
+      } else if (typeof webkitAudioContext !== 'undefined') {
+        Howler.ctx = new webkitAudioContext();
+      } else {
+        Howler.usingWebAudio = false;
+      }
+    } catch(e) {
+      Howler.usingWebAudio = false;
+    }
+
+    // If the audio context creation still failed, set using web audio to false.
+    if (!Howler.ctx) {
+      Howler.usingWebAudio = false;
+    }
+
+    // Check if a webview is being used on iOS8 or earlier (rather than the browser).
+    // If it is, disable Web Audio as it causes crashing.
+    var iOS = (/iP(hone|od|ad)/.test(Howler._navigator && Howler._navigator.platform));
+    var appVersion = Howler._navigator && Howler._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);
+    var version = appVersion ? parseInt(appVersion[1], 10) : null;
+    if (iOS && version && version < 9) {
+      var safari = /safari/.test(Howler._navigator && Howler._navigator.userAgent.toLowerCase());
+      if (Howler._navigator && !safari) {
+        Howler.usingWebAudio = false;
+      }
+    }
+
+    // Create and expose the master GainNode when using Web Audio (useful for plugins or advanced usage).
+    if (Howler.usingWebAudio) {
+      Howler.masterGain = (typeof Howler.ctx.createGain === 'undefined') ? Howler.ctx.createGainNode() : Howler.ctx.createGain();
+      Howler.masterGain.gain.setValueAtTime(Howler._muted ? 0 : Howler._volume, Howler.ctx.currentTime);
+      Howler.masterGain.connect(Howler.ctx.destination);
+    }
+
+    // Re-run the setup on Howler.
+    Howler._setup();
+  };
+
+  // Add support for AMD (Asynchronous Module Definition) libraries such as require.js.
+  if (typeof define === 'function' && define.amd) {
+    define([], function() {
+      return {
+        Howler: Howler,
+        Howl: Howl
+      };
+    });
+  }
+
+  // Add support for CommonJS libraries such as browserify.
+  if (typeof exports !== 'undefined') {
+    exports.Howler = Howler;
+    exports.Howl = Howl;
+  }
+
+  // Add to global in Node.js (for testing, etc).
+  if (typeof global !== 'undefined') {
+    global.HowlerGlobal = HowlerGlobal;
+    global.Howler = Howler;
+    global.Howl = Howl;
+    global.Sound = Sound;
+  } else if (typeof window !== 'undefined') {  // Define globally in case AMD is not available or unused.
+    window.HowlerGlobal = HowlerGlobal;
+    window.Howler = Howler;
+    window.Howl = Howl;
+    window.Sound = Sound;
+  }
+})();

+ 659 - 0
node_modules/howler/src/plugins/howler.spatial.js

@@ -0,0 +1,659 @@
+/*!
+ *  Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
+ *  
+ *  howler.js v2.2.4
+ *  howlerjs.com
+ *
+ *  (c) 2013-2020, James Simpson of GoldFire Studios
+ *  goldfirestudios.com
+ *
+ *  MIT License
+ */
+
+(function() {
+
+  'use strict';
+
+  // Setup default properties.
+  HowlerGlobal.prototype._pos = [0, 0, 0];
+  HowlerGlobal.prototype._orientation = [0, 0, -1, 0, 1, 0];
+
+  /** Global Methods **/
+  /***************************************************************************/
+
+  /**
+   * Helper method to update the stereo panning position of all current Howls.
+   * Future Howls will not use this value unless explicitly set.
+   * @param  {Number} pan A value of -1.0 is all the way left and 1.0 is all the way right.
+   * @return {Howler/Number}     Self or current stereo panning value.
+   */
+  HowlerGlobal.prototype.stereo = function(pan) {
+    var self = this;
+
+    // Stop right here if not using Web Audio.
+    if (!self.ctx || !self.ctx.listener) {
+      return self;
+    }
+
+    // Loop through all Howls and update their stereo panning.
+    for (var i=self._howls.length-1; i>=0; i--) {
+      self._howls[i].stereo(pan);
+    }
+
+    return self;
+  };
+
+  /**
+   * Get/set the position of the listener in 3D cartesian space. Sounds using
+   * 3D position will be relative to the listener's position.
+   * @param  {Number} x The x-position of the listener.
+   * @param  {Number} y The y-position of the listener.
+   * @param  {Number} z The z-position of the listener.
+   * @return {Howler/Array}   Self or current listener position.
+   */
+  HowlerGlobal.prototype.pos = function(x, y, z) {
+    var self = this;
+
+    // Stop right here if not using Web Audio.
+    if (!self.ctx || !self.ctx.listener) {
+      return self;
+    }
+
+    // Set the defaults for optional 'y' & 'z'.
+    y = (typeof y !== 'number') ? self._pos[1] : y;
+    z = (typeof z !== 'number') ? self._pos[2] : z;
+
+    if (typeof x === 'number') {
+      self._pos = [x, y, z];
+
+      if (typeof self.ctx.listener.positionX !== 'undefined') {
+        self.ctx.listener.positionX.setTargetAtTime(self._pos[0], Howler.ctx.currentTime, 0.1);
+        self.ctx.listener.positionY.setTargetAtTime(self._pos[1], Howler.ctx.currentTime, 0.1);
+        self.ctx.listener.positionZ.setTargetAtTime(self._pos[2], Howler.ctx.currentTime, 0.1);
+      } else {
+        self.ctx.listener.setPosition(self._pos[0], self._pos[1], self._pos[2]);
+      }
+    } else {
+      return self._pos;
+    }
+
+    return self;
+  };
+
+  /**
+   * Get/set the direction the listener is pointing in the 3D cartesian space.
+   * A front and up vector must be provided. The front is the direction the
+   * face of the listener is pointing, and up is the direction the top of the
+   * listener is pointing. Thus, these values are expected to be at right angles
+   * from each other.
+   * @param  {Number} x   The x-orientation of the listener.
+   * @param  {Number} y   The y-orientation of the listener.
+   * @param  {Number} z   The z-orientation of the listener.
+   * @param  {Number} xUp The x-orientation of the top of the listener.
+   * @param  {Number} yUp The y-orientation of the top of the listener.
+   * @param  {Number} zUp The z-orientation of the top of the listener.
+   * @return {Howler/Array}     Returns self or the current orientation vectors.
+   */
+  HowlerGlobal.prototype.orientation = function(x, y, z, xUp, yUp, zUp) {
+    var self = this;
+
+    // Stop right here if not using Web Audio.
+    if (!self.ctx || !self.ctx.listener) {
+      return self;
+    }
+
+    // Set the defaults for optional 'y' & 'z'.
+    var or = self._orientation;
+    y = (typeof y !== 'number') ? or[1] : y;
+    z = (typeof z !== 'number') ? or[2] : z;
+    xUp = (typeof xUp !== 'number') ? or[3] : xUp;
+    yUp = (typeof yUp !== 'number') ? or[4] : yUp;
+    zUp = (typeof zUp !== 'number') ? or[5] : zUp;
+
+    if (typeof x === 'number') {
+      self._orientation = [x, y, z, xUp, yUp, zUp];
+
+      if (typeof self.ctx.listener.forwardX !== 'undefined') {
+        self.ctx.listener.forwardX.setTargetAtTime(x, Howler.ctx.currentTime, 0.1);
+        self.ctx.listener.forwardY.setTargetAtTime(y, Howler.ctx.currentTime, 0.1);
+        self.ctx.listener.forwardZ.setTargetAtTime(z, Howler.ctx.currentTime, 0.1);
+        self.ctx.listener.upX.setTargetAtTime(xUp, Howler.ctx.currentTime, 0.1);
+        self.ctx.listener.upY.setTargetAtTime(yUp, Howler.ctx.currentTime, 0.1);
+        self.ctx.listener.upZ.setTargetAtTime(zUp, Howler.ctx.currentTime, 0.1);
+      } else {
+        self.ctx.listener.setOrientation(x, y, z, xUp, yUp, zUp);
+      }
+    } else {
+      return or;
+    }
+
+    return self;
+  };
+
+  /** Group Methods **/
+  /***************************************************************************/
+
+  /**
+   * Add new properties to the core init.
+   * @param  {Function} _super Core init method.
+   * @return {Howl}
+   */
+  Howl.prototype.init = (function(_super) {
+    return function(o) {
+      var self = this;
+
+      // Setup user-defined default properties.
+      self._orientation = o.orientation || [1, 0, 0];
+      self._stereo = o.stereo || null;
+      self._pos = o.pos || null;
+      self._pannerAttr = {
+        coneInnerAngle: typeof o.coneInnerAngle !== 'undefined' ? o.coneInnerAngle : 360,
+        coneOuterAngle: typeof o.coneOuterAngle !== 'undefined' ? o.coneOuterAngle : 360,
+        coneOuterGain: typeof o.coneOuterGain !== 'undefined' ? o.coneOuterGain : 0,
+        distanceModel: typeof o.distanceModel !== 'undefined' ? o.distanceModel : 'inverse',
+        maxDistance: typeof o.maxDistance !== 'undefined' ? o.maxDistance : 10000,
+        panningModel: typeof o.panningModel !== 'undefined' ? o.panningModel : 'HRTF',
+        refDistance: typeof o.refDistance !== 'undefined' ? o.refDistance : 1,
+        rolloffFactor: typeof o.rolloffFactor !== 'undefined' ? o.rolloffFactor : 1
+      };
+
+      // Setup event listeners.
+      self._onstereo = o.onstereo ? [{fn: o.onstereo}] : [];
+      self._onpos = o.onpos ? [{fn: o.onpos}] : [];
+      self._onorientation = o.onorientation ? [{fn: o.onorientation}] : [];
+
+      // Complete initilization with howler.js core's init function.
+      return _super.call(this, o);
+    };
+  })(Howl.prototype.init);
+
+  /**
+   * Get/set the stereo panning of the audio source for this sound or all in the group.
+   * @param  {Number} pan  A value of -1.0 is all the way left and 1.0 is all the way right.
+   * @param  {Number} id (optional) The sound ID. If none is passed, all in group will be updated.
+   * @return {Howl/Number}    Returns self or the current stereo panning value.
+   */
+  Howl.prototype.stereo = function(pan, id) {
+    var self = this;
+
+    // Stop right here if not using Web Audio.
+    if (!self._webAudio) {
+      return self;
+    }
+
+    // If the sound hasn't loaded, add it to the load queue to change stereo pan when capable.
+    if (self._state !== 'loaded') {
+      self._queue.push({
+        event: 'stereo',
+        action: function() {
+          self.stereo(pan, id);
+        }
+      });
+
+      return self;
+    }
+
+    // Check for PannerStereoNode support and fallback to PannerNode if it doesn't exist.
+    var pannerType = (typeof Howler.ctx.createStereoPanner === 'undefined') ? 'spatial' : 'stereo';
+
+    // Setup the group's stereo panning if no ID is passed.
+    if (typeof id === 'undefined') {
+      // Return the group's stereo panning if no parameters are passed.
+      if (typeof pan === 'number') {
+        self._stereo = pan;
+        self._pos = [pan, 0, 0];
+      } else {
+        return self._stereo;
+      }
+    }
+
+    // Change the streo panning of one or all sounds in group.
+    var ids = self._getSoundIds(id);
+    for (var i=0; i<ids.length; i++) {
+      // Get the sound.
+      var sound = self._soundById(ids[i]);
+
+      if (sound) {
+        if (typeof pan === 'number') {
+          sound._stereo = pan;
+          sound._pos = [pan, 0, 0];
+
+          if (sound._node) {
+            // If we are falling back, make sure the panningModel is equalpower.
+            sound._pannerAttr.panningModel = 'equalpower';
+
+            // Check if there is a panner setup and create a new one if not.
+            if (!sound._panner || !sound._panner.pan) {
+              setupPanner(sound, pannerType);
+            }
+
+            if (pannerType === 'spatial') {
+              if (typeof sound._panner.positionX !== 'undefined') {
+                sound._panner.positionX.setValueAtTime(pan, Howler.ctx.currentTime);
+                sound._panner.positionY.setValueAtTime(0, Howler.ctx.currentTime);
+                sound._panner.positionZ.setValueAtTime(0, Howler.ctx.currentTime);
+              } else {
+                sound._panner.setPosition(pan, 0, 0);
+              }
+            } else {
+              sound._panner.pan.setValueAtTime(pan, Howler.ctx.currentTime);
+            }
+          }
+
+          self._emit('stereo', sound._id);
+        } else {
+          return sound._stereo;
+        }
+      }
+    }
+
+    return self;
+  };
+
+  /**
+   * Get/set the 3D spatial position of the audio source for this sound or group relative to the global listener.
+   * @param  {Number} x  The x-position of the audio source.
+   * @param  {Number} y  The y-position of the audio source.
+   * @param  {Number} z  The z-position of the audio source.
+   * @param  {Number} id (optional) The sound ID. If none is passed, all in group will be updated.
+   * @return {Howl/Array}    Returns self or the current 3D spatial position: [x, y, z].
+   */
+  Howl.prototype.pos = function(x, y, z, id) {
+    var self = this;
+
+    // Stop right here if not using Web Audio.
+    if (!self._webAudio) {
+      return self;
+    }
+
+    // If the sound hasn't loaded, add it to the load queue to change position when capable.
+    if (self._state !== 'loaded') {
+      self._queue.push({
+        event: 'pos',
+        action: function() {
+          self.pos(x, y, z, id);
+        }
+      });
+
+      return self;
+    }
+
+    // Set the defaults for optional 'y' & 'z'.
+    y = (typeof y !== 'number') ? 0 : y;
+    z = (typeof z !== 'number') ? -0.5 : z;
+
+    // Setup the group's spatial position if no ID is passed.
+    if (typeof id === 'undefined') {
+      // Return the group's spatial position if no parameters are passed.
+      if (typeof x === 'number') {
+        self._pos = [x, y, z];
+      } else {
+        return self._pos;
+      }
+    }
+
+    // Change the spatial position of one or all sounds in group.
+    var ids = self._getSoundIds(id);
+    for (var i=0; i<ids.length; i++) {
+      // Get the sound.
+      var sound = self._soundById(ids[i]);
+
+      if (sound) {
+        if (typeof x === 'number') {
+          sound._pos = [x, y, z];
+
+          if (sound._node) {
+            // Check if there is a panner setup and create a new one if not.
+            if (!sound._panner || sound._panner.pan) {
+              setupPanner(sound, 'spatial');
+            }
+
+            if (typeof sound._panner.positionX !== 'undefined') {
+              sound._panner.positionX.setValueAtTime(x, Howler.ctx.currentTime);
+              sound._panner.positionY.setValueAtTime(y, Howler.ctx.currentTime);
+              sound._panner.positionZ.setValueAtTime(z, Howler.ctx.currentTime);
+            } else {
+              sound._panner.setPosition(x, y, z);
+            }
+          }
+
+          self._emit('pos', sound._id);
+        } else {
+          return sound._pos;
+        }
+      }
+    }
+
+    return self;
+  };
+
+  /**
+   * Get/set the direction the audio source is pointing in the 3D cartesian coordinate
+   * space. Depending on how direction the sound is, based on the `cone` attributes,
+   * a sound pointing away from the listener can be quiet or silent.
+   * @param  {Number} x  The x-orientation of the source.
+   * @param  {Number} y  The y-orientation of the source.
+   * @param  {Number} z  The z-orientation of the source.
+   * @param  {Number} id (optional) The sound ID. If none is passed, all in group will be updated.
+   * @return {Howl/Array}    Returns self or the current 3D spatial orientation: [x, y, z].
+   */
+  Howl.prototype.orientation = function(x, y, z, id) {
+    var self = this;
+
+    // Stop right here if not using Web Audio.
+    if (!self._webAudio) {
+      return self;
+    }
+
+    // If the sound hasn't loaded, add it to the load queue to change orientation when capable.
+    if (self._state !== 'loaded') {
+      self._queue.push({
+        event: 'orientation',
+        action: function() {
+          self.orientation(x, y, z, id);
+        }
+      });
+
+      return self;
+    }
+
+    // Set the defaults for optional 'y' & 'z'.
+    y = (typeof y !== 'number') ? self._orientation[1] : y;
+    z = (typeof z !== 'number') ? self._orientation[2] : z;
+
+    // Setup the group's spatial orientation if no ID is passed.
+    if (typeof id === 'undefined') {
+      // Return the group's spatial orientation if no parameters are passed.
+      if (typeof x === 'number') {
+        self._orientation = [x, y, z];
+      } else {
+        return self._orientation;
+      }
+    }
+
+    // Change the spatial orientation of one or all sounds in group.
+    var ids = self._getSoundIds(id);
+    for (var i=0; i<ids.length; i++) {
+      // Get the sound.
+      var sound = self._soundById(ids[i]);
+
+      if (sound) {
+        if (typeof x === 'number') {
+          sound._orientation = [x, y, z];
+
+          if (sound._node) {
+            // Check if there is a panner setup and create a new one if not.
+            if (!sound._panner) {
+              // Make sure we have a position to setup the node with.
+              if (!sound._pos) {
+                sound._pos = self._pos || [0, 0, -0.5];
+              }
+
+              setupPanner(sound, 'spatial');
+            }
+
+            if (typeof sound._panner.orientationX !== 'undefined') {
+              sound._panner.orientationX.setValueAtTime(x, Howler.ctx.currentTime);
+              sound._panner.orientationY.setValueAtTime(y, Howler.ctx.currentTime);
+              sound._panner.orientationZ.setValueAtTime(z, Howler.ctx.currentTime);
+            } else {
+              sound._panner.setOrientation(x, y, z);
+            }
+          }
+
+          self._emit('orientation', sound._id);
+        } else {
+          return sound._orientation;
+        }
+      }
+    }
+
+    return self;
+  };
+
+  /**
+   * Get/set the panner node's attributes for a sound or group of sounds.
+   * This method can optionall take 0, 1 or 2 arguments.
+   *   pannerAttr() -> Returns the group's values.
+   *   pannerAttr(id) -> Returns the sound id's values.
+   *   pannerAttr(o) -> Set's the values of all sounds in this Howl group.
+   *   pannerAttr(o, id) -> Set's the values of passed sound id.
+   *
+   *   Attributes:
+   *     coneInnerAngle - (360 by default) A parameter for directional audio sources, this is an angle, in degrees,
+   *                      inside of which there will be no volume reduction.
+   *     coneOuterAngle - (360 by default) A parameter for directional audio sources, this is an angle, in degrees,
+   *                      outside of which the volume will be reduced to a constant value of `coneOuterGain`.
+   *     coneOuterGain - (0 by default) A parameter for directional audio sources, this is the gain outside of the
+   *                     `coneOuterAngle`. It is a linear value in the range `[0, 1]`.
+   *     distanceModel - ('inverse' by default) Determines algorithm used to reduce volume as audio moves away from
+   *                     listener. Can be `linear`, `inverse` or `exponential.
+   *     maxDistance - (10000 by default) The maximum distance between source and listener, after which the volume
+   *                   will not be reduced any further.
+   *     refDistance - (1 by default) A reference distance for reducing volume as source moves further from the listener.
+   *                   This is simply a variable of the distance model and has a different effect depending on which model
+   *                   is used and the scale of your coordinates. Generally, volume will be equal to 1 at this distance.
+   *     rolloffFactor - (1 by default) How quickly the volume reduces as source moves from listener. This is simply a
+   *                     variable of the distance model and can be in the range of `[0, 1]` with `linear` and `[0, ∞]`
+   *                     with `inverse` and `exponential`.
+   *     panningModel - ('HRTF' by default) Determines which spatialization algorithm is used to position audio.
+   *                     Can be `HRTF` or `equalpower`.
+   *
+   * @return {Howl/Object} Returns self or current panner attributes.
+   */
+  Howl.prototype.pannerAttr = function() {
+    var self = this;
+    var args = arguments;
+    var o, id, sound;
+
+    // Stop right here if not using Web Audio.
+    if (!self._webAudio) {
+      return self;
+    }
+
+    // Determine the values based on arguments.
+    if (args.length === 0) {
+      // Return the group's panner attribute values.
+      return self._pannerAttr;
+    } else if (args.length === 1) {
+      if (typeof args[0] === 'object') {
+        o = args[0];
+
+        // Set the grou's panner attribute values.
+        if (typeof id === 'undefined') {
+          if (!o.pannerAttr) {
+            o.pannerAttr = {
+              coneInnerAngle: o.coneInnerAngle,
+              coneOuterAngle: o.coneOuterAngle,
+              coneOuterGain: o.coneOuterGain,
+              distanceModel: o.distanceModel,
+              maxDistance: o.maxDistance,
+              refDistance: o.refDistance,
+              rolloffFactor: o.rolloffFactor,
+              panningModel: o.panningModel
+            };
+          }
+
+          self._pannerAttr = {
+            coneInnerAngle: typeof o.pannerAttr.coneInnerAngle !== 'undefined' ? o.pannerAttr.coneInnerAngle : self._coneInnerAngle,
+            coneOuterAngle: typeof o.pannerAttr.coneOuterAngle !== 'undefined' ? o.pannerAttr.coneOuterAngle : self._coneOuterAngle,
+            coneOuterGain: typeof o.pannerAttr.coneOuterGain !== 'undefined' ? o.pannerAttr.coneOuterGain : self._coneOuterGain,
+            distanceModel: typeof o.pannerAttr.distanceModel !== 'undefined' ? o.pannerAttr.distanceModel : self._distanceModel,
+            maxDistance: typeof o.pannerAttr.maxDistance !== 'undefined' ? o.pannerAttr.maxDistance : self._maxDistance,
+            refDistance: typeof o.pannerAttr.refDistance !== 'undefined' ? o.pannerAttr.refDistance : self._refDistance,
+            rolloffFactor: typeof o.pannerAttr.rolloffFactor !== 'undefined' ? o.pannerAttr.rolloffFactor : self._rolloffFactor,
+            panningModel: typeof o.pannerAttr.panningModel !== 'undefined' ? o.pannerAttr.panningModel : self._panningModel
+          };
+        }
+      } else {
+        // Return this sound's panner attribute values.
+        sound = self._soundById(parseInt(args[0], 10));
+        return sound ? sound._pannerAttr : self._pannerAttr;
+      }
+    } else if (args.length === 2) {
+      o = args[0];
+      id = parseInt(args[1], 10);
+    }
+
+    // Update the values of the specified sounds.
+    var ids = self._getSoundIds(id);
+    for (var i=0; i<ids.length; i++) {
+      sound = self._soundById(ids[i]);
+
+      if (sound) {
+        // Merge the new values into the sound.
+        var pa = sound._pannerAttr;
+        pa = {
+          coneInnerAngle: typeof o.coneInnerAngle !== 'undefined' ? o.coneInnerAngle : pa.coneInnerAngle,
+          coneOuterAngle: typeof o.coneOuterAngle !== 'undefined' ? o.coneOuterAngle : pa.coneOuterAngle,
+          coneOuterGain: typeof o.coneOuterGain !== 'undefined' ? o.coneOuterGain : pa.coneOuterGain,
+          distanceModel: typeof o.distanceModel !== 'undefined' ? o.distanceModel : pa.distanceModel,
+          maxDistance: typeof o.maxDistance !== 'undefined' ? o.maxDistance : pa.maxDistance,
+          refDistance: typeof o.refDistance !== 'undefined' ? o.refDistance : pa.refDistance,
+          rolloffFactor: typeof o.rolloffFactor !== 'undefined' ? o.rolloffFactor : pa.rolloffFactor,
+          panningModel: typeof o.panningModel !== 'undefined' ? o.panningModel : pa.panningModel
+        };
+
+        // Create a new panner node if one doesn't already exist.
+        var panner = sound._panner;
+        if (!panner) {
+          // Make sure we have a position to setup the node with.
+          if (!sound._pos) {
+            sound._pos = self._pos || [0, 0, -0.5];
+          }
+
+          // Create a new panner node.
+          setupPanner(sound, 'spatial');
+          panner = sound._panner
+        }
+
+        // Update the panner values or create a new panner if none exists.
+        panner.coneInnerAngle = pa.coneInnerAngle;
+        panner.coneOuterAngle = pa.coneOuterAngle;
+        panner.coneOuterGain = pa.coneOuterGain;
+        panner.distanceModel = pa.distanceModel;
+        panner.maxDistance = pa.maxDistance;
+        panner.refDistance = pa.refDistance;
+        panner.rolloffFactor = pa.rolloffFactor;
+        panner.panningModel = pa.panningModel;
+      }
+    }
+
+    return self;
+  };
+
+  /** Single Sound Methods **/
+  /***************************************************************************/
+
+  /**
+   * Add new properties to the core Sound init.
+   * @param  {Function} _super Core Sound init method.
+   * @return {Sound}
+   */
+  Sound.prototype.init = (function(_super) {
+    return function() {
+      var self = this;
+      var parent = self._parent;
+
+      // Setup user-defined default properties.
+      self._orientation = parent._orientation;
+      self._stereo = parent._stereo;
+      self._pos = parent._pos;
+      self._pannerAttr = parent._pannerAttr;
+
+      // Complete initilization with howler.js core Sound's init function.
+      _super.call(this);
+
+      // If a stereo or position was specified, set it up.
+      if (self._stereo) {
+        parent.stereo(self._stereo);
+      } else if (self._pos) {
+        parent.pos(self._pos[0], self._pos[1], self._pos[2], self._id);
+      }
+    };
+  })(Sound.prototype.init);
+
+  /**
+   * Override the Sound.reset method to clean up properties from the spatial plugin.
+   * @param  {Function} _super Sound reset method.
+   * @return {Sound}
+   */
+  Sound.prototype.reset = (function(_super) {
+    return function() {
+      var self = this;
+      var parent = self._parent;
+
+      // Reset all spatial plugin properties on this sound.
+      self._orientation = parent._orientation;
+      self._stereo = parent._stereo;
+      self._pos = parent._pos;
+      self._pannerAttr = parent._pannerAttr;
+
+      // If a stereo or position was specified, set it up.
+      if (self._stereo) {
+        parent.stereo(self._stereo);
+      } else if (self._pos) {
+        parent.pos(self._pos[0], self._pos[1], self._pos[2], self._id);
+      } else if (self._panner) {
+        // Disconnect the panner.
+        self._panner.disconnect(0);
+        self._panner = undefined;
+        parent._refreshBuffer(self);
+      }
+
+      // Complete resetting of the sound.
+      return _super.call(this);
+    };
+  })(Sound.prototype.reset);
+
+  /** Helper Methods **/
+  /***************************************************************************/
+
+  /**
+   * Create a new panner node and save it on the sound.
+   * @param  {Sound} sound Specific sound to setup panning on.
+   * @param {String} type Type of panner to create: 'stereo' or 'spatial'.
+   */
+  var setupPanner = function(sound, type) {
+    type = type || 'spatial';
+
+    // Create the new panner node.
+    if (type === 'spatial') {
+      sound._panner = Howler.ctx.createPanner();
+      sound._panner.coneInnerAngle = sound._pannerAttr.coneInnerAngle;
+      sound._panner.coneOuterAngle = sound._pannerAttr.coneOuterAngle;
+      sound._panner.coneOuterGain = sound._pannerAttr.coneOuterGain;
+      sound._panner.distanceModel = sound._pannerAttr.distanceModel;
+      sound._panner.maxDistance = sound._pannerAttr.maxDistance;
+      sound._panner.refDistance = sound._pannerAttr.refDistance;
+      sound._panner.rolloffFactor = sound._pannerAttr.rolloffFactor;
+      sound._panner.panningModel = sound._pannerAttr.panningModel;
+
+      if (typeof sound._panner.positionX !== 'undefined') {
+        sound._panner.positionX.setValueAtTime(sound._pos[0], Howler.ctx.currentTime);
+        sound._panner.positionY.setValueAtTime(sound._pos[1], Howler.ctx.currentTime);
+        sound._panner.positionZ.setValueAtTime(sound._pos[2], Howler.ctx.currentTime);
+      } else {
+        sound._panner.setPosition(sound._pos[0], sound._pos[1], sound._pos[2]);
+      }
+
+      if (typeof sound._panner.orientationX !== 'undefined') {
+        sound._panner.orientationX.setValueAtTime(sound._orientation[0], Howler.ctx.currentTime);
+        sound._panner.orientationY.setValueAtTime(sound._orientation[1], Howler.ctx.currentTime);
+        sound._panner.orientationZ.setValueAtTime(sound._orientation[2], Howler.ctx.currentTime);
+      } else {
+        sound._panner.setOrientation(sound._orientation[0], sound._orientation[1], sound._orientation[2]);
+      }
+    } else {
+      sound._panner = Howler.ctx.createStereoPanner();
+      sound._panner.pan.setValueAtTime(sound._stereo, Howler.ctx.currentTime);
+    }
+
+    sound._panner.connect(sound._node);
+
+    // Update the connections.
+    if (!sound._paused) {
+      sound._parent.pause(sound._id, true).play(sound._id, true);
+    }
+  };
+})();

+ 7 - 0
package-lock.json

@@ -5,6 +5,7 @@
   "packages": {
     "": {
       "dependencies": {
+        "howler": "^2.2.4",
         "pinyin": "^4.0.0-alpha.2"
       }
     },
@@ -19,6 +20,12 @@
         "node": ">= 0.6.x"
       }
     },
+    "node_modules/howler": {
+      "version": "2.2.4",
+      "resolved": "https://registry.npmmirror.com/howler/-/howler-2.2.4.tgz",
+      "integrity": "sha512-iARIBPgcQrwtEr+tALF+rapJ8qSc+Set2GJQl7xT1MQzWaVkFebdJhR3alVlSiUf5U7nAANKuj3aWpwerocD5w==",
+      "license": "MIT"
+    },
     "node_modules/keypress": {
       "version": "0.1.0",
       "resolved": "https://registry.npmmirror.com/keypress/-/keypress-0.1.0.tgz",

+ 1 - 0
package.json

@@ -1,5 +1,6 @@
 {
   "dependencies": {
+    "howler": "^2.2.4",
     "pinyin": "^4.0.0-alpha.2"
   }
 }

+ 2 - 5
pages/index/audit/confirm-receipt.vue

@@ -41,22 +41,19 @@ const formData = ref({
     searchType: '2',
     search: '',
 });
-const searchKeyword = ref('');
 
 // 处理查询
 const handleSubmit = () => {
-    console.log('查询:', searchKeyword.value);
     if(!formData.value.search){
         uni.$u.toast('请扫描/输入物流单号')
         return
     }
     uni.$u.http.post('/app/orderinfo/confirmOrder', formData.value).then(res => {
-        console.log(res)
         if (res.code == 200) {
-            let text = code + '收货成功'
+            let text = formData.value.search + '收货成功'
             uni.$u.ttsModule.speak(text)
         } else {
-            let text = code + '订单不存在'
+            let text = formData.value.search + '订单不存在'
             uni.$u.ttsModule.speak(text)
         }
     })

+ 100 - 105
pages/index/detail/batch-audit.vue

@@ -1,17 +1,28 @@
 <template>
     <view class="batch-audit">
-        <BookItem v-for="(item, index) in scannedBooksDetail" :key="item.isbn" :item="item" showClose
-            @close="(isbn) => handleClose(index, isbn)" />
+        <BookItem
+            v-for="(item, index) in scannedBooksDetail"
+            :key="item.isbn"
+            :item="item"
+            showClose
+            @close="(isbn) => handleClose(index, isbn)"
+        />
 
         <view class="fixed-bottom">
             <u-button type="warning" size="large" @click="handleScanCode">扫码</u-button>
             <u-button type="primary" size="large" @click="showQualityModal">确定</u-button>
         </view>
 
-        <u-modal :show="showModal" :title="'品相选择'" @cancel="closeModal" :showCancelButton="true"
-            :closeOnClickOverlay="true" @confirm="handleAudit">
+        <u-modal
+            :show="showModal"
+            :title="'品相选择'"
+            @cancel="closeModal"
+            :showCancelButton="true"
+            :closeOnClickOverlay="true"
+            @confirm="handleAudit"
+        >
             <view class="quality-selector">
-                <view class="quality-circle" :class="{ 'selected': isQualitySelected }" @click="toggleQuality">
+                <view class="quality-circle" :class="{ selected: isQualitySelected }" @click="toggleQuality">
                     <text>良好</text>
                 </view>
             </view>
@@ -20,97 +31,81 @@
 </template>
 
 <script setup>
-import { ref } from 'vue'
-import { onLoad, onShow } from '@dcloudio/uni-app'
-import BookItem from './components/BookItem2.vue'
+import { ref } from "vue";
+import { onLoad, onShow } from "@dcloudio/uni-app";
+import BookItem from "./components/BookItem2.vue";
 
-const detailMap = ref({})
-const scannedBooksDetail = ref([])
+const detailMap = ref({});
+const scannedBooksDetail = ref([]);
 // 获取图书详情 /app/book/getSimpleBookInfoByIsbn/{isbn}
 const getBookInfo = (isbn) => {
     if (detailMap.value[isbn]) {
-        scannedBooksDetail.value.push(detailMap.value[isbn])
-        return
+        scannedBooksDetail.value.push(detailMap.value[isbn]);
+        return;
     }
-    uni.$u.http.get(`/app/book/getSimpleBookInfoByIsbn/${isbn}`).then(res => {
+    uni.$u.http.get(`/app/book/getSimpleBookInfoByIsbn/${isbn}`).then((res) => {
         if (res.code == 200) {
-            detailMap.value[isbn] = res.data
-            scannedBooksDetail.value.push(res.data)
-            console.log(scannedBooksDetail.value, 'xxaaxx')
+            detailMap.value[isbn] = res.data;
+            scannedBooksDetail.value.push(res.data);
         }
-    })
-}
+    });
+};
 
 const handleClose = (index, isbn) => {
-    scannedBooksDetail.value.splice(index, 1)
-    scannedBooks.value = scannedBooks.value.filter(item => item != isbn)
-}
+    scannedBooksDetail.value.splice(index, 1);
+    scannedBooks.value = scannedBooks.value.filter((item) => item != isbn);
+};
 //isbn正则校验是否符合
 function checkIsbn(isbn) {
     const isbn13Regex = /^(?:97[89]-?\d{1,5}-?\d{1,7}-?\d{1,6}-?\d)$/;
     if (isbn13Regex.test(isbn)) {
-        return true
+        return true;
     }
-    return false
+    return false;
 }
 //存储已经扫码的图书
-const scannedBooks = ref([])
+const scannedBooks = ref([]);
 //扫码之后的逻辑
 function handleScan(isbn) {
     if (!checkIsbn(isbn)) {
-        let text = `不是正确的ISBN码`
-        uni.$u.ttsModule.speak(text)
-        return
+        let text = `不是正确的ISBN码`;
+        uni.$u.ttsModule.speak(text);
+        return;
     }
 
-    let isbns = orderDetail.value.detailVoList.map(item => item.isbn)
+    let isbns = orderDetail.value.detailVoList.map((item) => item.isbn);
     //订单总数本
     if (isbns.includes(isbn)) {
-        let book = orderDetail.value.detailVoList.find(item => item.isbn == isbn)
+        let book = orderDetail.value.detailVoList.find((item) => item.isbn == isbn);
 
         if (book.auditCommentList?.length > 0) {
-            let text = ''
-            if (book.auditCommentList.every(item => item.sts == 1)) {
-                text = `${isbn}已审核为良好`
-                uni.$u.ttsModule.speak(text)
-                return
-            }
-
-            //已审核数量
-            let hasAuditNum = book.auditCommentList.filter(item => item.sts !== 0).length || 0
             //未审核数量
-            let notAuditNum = book.auditCommentList.filter(item => item.sts === 0).length || 0
-            //极差数量
-            let poorNum = book.auditCommentList?.filter(item => item.sts == 3).length || 0
+            let notAuditNum = book.auditCommentList.filter((item) => item.sts === 0).length || 0;
             //已扫描书籍中当前isbn的数量
-            let scannedNum = scannedBooks.value.filter(item => item == isbn).length || 0
+            let scannedNum = scannedBooks.value.filter((item) => item == isbn).length || 0;
 
-            if (scannedNum >= notAuditNum + poorNum) {
-                let text = `${isbn}已超出订单中的数量`
-                return uni.$u.ttsModule.speak(text)
+            if (scannedNum >= notAuditNum) {
+                let text = `${isbn}已超出订单中的数量`;
+                return uni.$u.ttsModule.speak(text);
             } else {
                 //扫描到套装书
                 if (book.suit == 1) {
-                    let text = `${isbn}请注意套装书是否齐全`
-                    uni.$u.ttsModule.speak(text)
+                    let text = `${isbn}请注意套装书是否齐全`;
+                    uni.$u.ttsModule.speak(text);
                 }
                 //扫描到需要取出的书
                 if (book.bookWarn == 1) {
-                    let text = `请注意${isbn}需要取出`
-                    uni.$u.ttsModule.speak(text)
-                }
-                if (scannedNum >= notAuditNum && scannedNum < notAuditNum + poorNum) {
-                    let text = `${isbn}已审核为极差`
-                    uni.$u.ttsModule.speak(text)
+                    let text = `请注意${isbn}需要取出`;
+                    uni.$u.ttsModule.speak(text);
                 }
 
-                scannedBooks.value.push(isbn)
-                getBookInfo(isbn)
+                scannedBooks.value.push(isbn);
+                getBookInfo(isbn);
             }
         }
     } else {
-        let text = `此订单中不存在${isbn}这本书 `
-        uni.$u.ttsModule.speak(text)
+        let text = `此订单中不存在${isbn}这本书 `;
+        uni.$u.ttsModule.speak(text);
     }
 }
 
@@ -118,82 +113,82 @@ function handleScan(isbn) {
 function handleScanCode() {
     uni.scanCode({
         success: (res) => {
-            handleScan(res.result)
+            handleScan(res.result);
         },
-    })
+    });
 }
 
-
-const checkUserId = ref()
-const orderId = ref()
-const orderDetail = ref({})
-const showModal = ref(false)
-const isQualitySelected = ref(false)
+const checkUserId = ref();
+const orderId = ref();
+const orderDetail = ref({});
+const showModal = ref(false);
+const isQualitySelected = ref(false);
 
 const showQualityModal = () => {
-    showModal.value = true
-}
+    showModal.value = true;
+};
 
 const closeModal = () => {
-    showModal.value = false
-}
+    showModal.value = false;
+};
 
 const toggleQuality = () => {
-    isQualitySelected.value = !isQualitySelected.value
-}
+    isQualitySelected.value = !isQualitySelected.value;
+};
 
 //审核 /app/orderinfo/checkOrder
 const handleAudit = () => {
     if (!isQualitySelected.value) {
-        uni.$u.toast('请选择品相')
-        uni.$u.ttsModule.speak('请选择品相')
-        return
+        uni.$u.toast("请选择品相");
+        uni.$u.ttsModule.speak("请选择品相");
+        return;
     }
 
-    let checkUserInfo = uni.getStorageSync('checkUserInfo')
+    let checkUserInfo = uni.getStorageSync("checkUserInfo");
     if (checkUserInfo.userId) {
-        checkUserId.value = checkUserInfo.userId
+        checkUserId.value = checkUserInfo.userId;
     }
 
-    uni.$u.http.post('/app/orderinfo/checkOrder', {
-        "checkUserId": checkUserId.value,
-        "orderId": orderId.value,
-        "checkList": scannedBooks.value.map(isbn => ({ sts: 1, com: '', isbn }))
-    }).then(res => {
-        if (res.code == 200) {
-            uni.showToast({ title: '审核成功', icon: 'none' })
-            uni.$u.ttsModule.speak('审核成功')
-            uni.navigateBack({ delta: 2 })
-        } else {
-            uni.$u.toast(res.msg)
-        }
-    })
-}
+    uni.$u.http
+        .post("/app/orderinfo/checkOrderBatch", {
+            checkUserId: checkUserId.value,
+            orderId: orderId.value,
+            checkList: scannedBooks.value.map((isbn) => ({ sts: 1, com: "", isbn })),
+        })
+        .then((res) => {
+            if (res.code == 200) {
+                uni.showToast({ title: "审核成功", icon: "none" });
+                uni.$u.ttsModule.speak("审核成功");
+                uni.navigateBack({ delta: 2 });
+            } else {
+                uni.$u.toast(res.msg);
+            }
+        });
+};
 
 onLoad((options) => {
-    orderId.value = options.orderId
-    orderDetail.value = uni.getStorageSync('orderDetail')
-    scannedBooks.value = uni.getStorageSync('scannedBooks')
+    orderId.value = options.orderId;
+    orderDetail.value = uni.getStorageSync("orderDetail");
+    scannedBooks.value = uni.getStorageSync("scannedBooks");
 
-    scannedBooks.value.forEach(isbn => {
-        getBookInfo(isbn)
-    })
+    scannedBooks.value.forEach((isbn) => {
+        getBookInfo(isbn);
+    });
 
     // #ifdef APP-PLUS
     uni.$u.useGlobalEvent((e) => {
         if (e.barcode) {
-            handleScan(e.barcode)
+            handleScan(e.barcode);
         }
-    })
+    });
     // #endif
-})
+});
 onShow(() => {
-    checkUserId.value = uni.getStorageSync('userInfo')?.userId
-    orderDetail.value = uni.getStorageSync('orderDetail')
-})
+    checkUserId.value = uni.getStorageSync("userInfo")?.userId;
+    orderDetail.value = uni.getStorageSync("orderDetail");
+});
 </script>
 
-
 <style lang="scss" scoped>
 .batch-audit {
     padding: 20rpx;
@@ -224,7 +219,7 @@ onShow(() => {
     }
 
     &.selected {
-        background-color: #4CAF50;
+        background-color: #4caf50;
     }
 }
-</style>
+</style>

+ 137 - 128
pages/index/detail/book-audit.vue

@@ -1,16 +1,22 @@
 <template>
     <view class="book-audit">
-        <view class="bg-white flex flex-a-c" style="padding: 20rpx;border-radius: 10rpx;">
-            <image :src="detail.cover" mode="aspectFill" style="width: 80px;height: 100px;"></image>
+        <view class="bg-white flex flex-a-c" style="padding: 20rpx; border-radius: 10rpx">
+            <image :src="detail.cover" mode="aspectFill" style="width: 80px; height: 100px"></image>
             <view class="flex flex-d flex-1 ml-20">
                 <text class="common-title mb-20">{{ detail.bookName }}</text>
-                <text class="text-sm">ISBN: <text class="color-primary">{{ detail.isbn }}</text> </text>
-                <text class="text-sm mt-6">作者: <text>{{ detail.author }}</text> </text>
-                <text class="text-sm mt-6">出版社: <text>{{ detail.publish }}</text> </text>
+                <text class="text-sm"
+                    >ISBN: <text class="color-primary">{{ detail.isbn }}</text>
+                </text>
+                <text class="text-sm mt-6"
+                    >作者: <text>{{ detail.author }}</text>
+                </text>
+                <text class="text-sm mt-6"
+                    >出版社: <text>{{ detail.publish }}</text>
+                </text>
             </view>
         </view>
 
-        <view class="mt-20 bg-white price-info" style="border-radius: 10rpx;">
+        <view class="mt-20 bg-white price-info" style="border-radius: 10rpx">
             <view class="flex">
                 <view class="flex flex-a-c flex-1">
                     <text class="label">定价</text>
@@ -34,11 +40,19 @@
         </view>
 
         <view class="mt-20">
-            <u-subsection :list="list" mode="subsection" :current="current"
-                @change="handleSectionChange"></u-subsection>
-            <AuditInfo v-show="current == 0" :detail="auditBook" :auditList="auditBook.auditCommentList"
-                ref="auditInfoRef" />
-            <FileInfo v-show="current == 2" :orderId="orderId" :annexType="2" :isbn="auditBook.isbn" />
+            <u-subsection
+                :list="list"
+                mode="subsection"
+                :current="current"
+                @change="handleSectionChange"
+            ></u-subsection>
+            <AuditInfo
+                v-show="current == 0"
+                :detail="auditBook"
+                :auditList="auditBook.auditCommentList"
+                ref="auditInfoRef"
+            />
+            <FileInfo v-show="current == 2" :orderId="orderId" :annexType="2" :isbn="isbnScan" />
         </view>
 
         <view class="fixed-bottom">
@@ -49,106 +63,103 @@
 </template>
 
 <script setup>
-import { ref,nextTick } from 'vue'
-import { onLoad, onShow } from '@dcloudio/uni-app'
-import AuditInfo from './components/AuditInfo.vue'
-import FileInfo from './components/FileInfo.vue'
+import { ref, nextTick } from "vue";
+import { onLoad, onShow } from "@dcloudio/uni-app";
+import AuditInfo from "./components/AuditInfo.vue";
+import FileInfo from "./components/FileInfo.vue";
 
-const detail = ref({})
+const detail = ref({});
 
-// 获取图书详情 /app/book/getSimpleBookInfoByIsbn/{isbn} 
+// 获取图书详情 /app/book/getSimpleBookInfoByIsbn/{isbn}
 const getBookInfo = (isbn) => {
-    uni.$u.http.get(`/app/book/getBookByIsbn/${isbn}`).then(res => {
+    uni.$u.http.get(`/app/book/getBookByIsbn/${isbn}`).then((res) => {
         if (res.code == 200) {
-            detail.value = res.data
+            detail.value = res.data;
         }
-    })
-}
-const list = ref(['图书审核', '绑码', '附件信息'])
-const current = ref(0)
+    });
+};
+//获取图书信息和审核信息
+const auditBook = ref({});
+const getBookInfoAndAuditInfo = (isbn, orderId) => {
+    uni.$u.http.get(`/app/orderinfo/getBookCheckInfo?isbn=${isbn}&&orderId=${orderId}`).then((res) => {
+        if (res.code == 200) {
+            auditBook.value = res.data;
+            nextTick(() => {
+                auditInfoRef.value?.initAuditList(auditBook.value);
+            });
+        }
+    });
+};
+
+
+const list = ref(["图书审核", "绑码", "附件信息"]);
+const current = ref(0);
 const handleSectionChange = (index) => {
-    current.value = index
-}
+    current.value = index;
+};
 
 //图书审核
-const auditData = ref([])
+const auditData = ref([]);
 const handleAuditSelected = (data) => {
     auditData.value = data.map((item, index) => {
-        item.idx = index
-        item.com = Array.isArray(item.com) ? item.com.join(',') : item.com
-        return item
-    })
-}
+        item.idx = index;
+        item.com = Array.isArray(item.com) ? item.com.join(",") : item.com;
+        return item;
+    });
+};
 
 //存储已经扫码的图书
-const scannedBooks = ref([])
+const scannedBooks = ref([]);
 //isbn正则校验是否符合
 function checkIsbn(isbn) {
     const isbn13Regex = /^(?:97[89]-?\d{1,5}-?\d{1,7}-?\d{1,6}-?\d)$/;
     if (isbn13Regex.test(isbn)) {
-        return true
+        return true;
     }
-    return false
+    return false;
 }
 //扫码之后的逻辑
 function handleScan(isbn) {
     if (!checkIsbn(isbn)) {
-        let text = `不是正确的ISBN码`
-        uni.$u.ttsModule.speak(text)
-        return
+        let text = `不是正确的ISBN码`;
+        uni.$u.ttsModule.speak(text);
+        return;
     }
 
-    let isbns = orderDetail.value.detailVoList.map(item => item.isbn)
+    let isbns = orderDetail.value.detailVoList.map((item) => item.isbn);
 
     if (isbns.includes(isbn)) {
-        let book = orderDetail.value.detailVoList.find(item => item.isbn == isbn)
+        let book = orderDetail.value.detailVoList.find((item) => item.isbn == isbn);
 
         if (book.auditCommentList?.length > 0) {
-            let text = ''
-            if (book.auditCommentList.every(item => item.sts == 1)) {
-                text = `${isbn}已审核为良好`
-                uni.$u.ttsModule.speak(text)
-                return
+            let noAuditNum = book.auditCommentList.filter((item) => item.sts == 0).length;
+            console.log(noAuditNum, 'noAuditNum')
+            if (noAuditNum == 0) {
+                let text = `${isbn}已超出订单中的数量`;
+                uni.$u.ttsModule.speak(text);
+                return;
             }
 
-            //已审核数量
-            let hasAuditNum = book.auditCommentList.filter(item => item.sts !== 0).length || 0
-            //未审核数量
-            let notAuditNum = book.auditCommentList.filter(item => item.sts === 0).length || 0
-            //极差数量
-            let poorNum = book.auditCommentList?.filter(item => item.sts == 3).length || 0
-            //已扫描书籍中当前isbn的数量
-            let scannedNum = scannedBooks.value.filter(item => item == isbn).length || 0
-
-            if (scannedNum >= notAuditNum + poorNum) {
-                let text = `${isbn}已超出订单中的数量`
-                return uni.$u.ttsModule.speak(text)
-            } else {
-                //扫描到套装书
-                if (book.suit == 1) {
-                    let text = `${isbn}请注意套装书是否齐全`
-                    uni.$u.ttsModule.speak(text)
-                }
-                //扫描到需要取出的书
-                if (book.bookWarn == 1) {
-                    let text = `请注意${isbn}需要取出`
-                    uni.$u.ttsModule.speak(text)
-                }
-                if (scannedNum >= notAuditNum && scannedNum < notAuditNum + poorNum) {
-                    let text = `${isbn}已审核为极差`
-                    uni.$u.ttsModule.speak(text)
-                }
-
-                scannedBooks.value.push(isbn)
-                uni.setStorageSync('scannedBooks', scannedBooks.value)
-                uni.navigateTo({
-                    url: `/pages/index/detail/batch-audit?orderId=${orderId.value}`
-                })
+            //扫描到套装书
+            if (book.suit == 1) {
+                let text = `${isbn}请注意套装书是否齐全`;
+                uni.$u.ttsModule.speak(text);
+            }
+            //扫描到需要取出的书
+            if (book.bookWarn == 1) {
+                let text = `请注意${isbn}需要取出`;
+                uni.$u.ttsModule.speak(text);
             }
+
+            scannedBooks.value.push(isbn);
+            uni.setStorageSync("scannedBooks", scannedBooks.value);
+            uni.navigateTo({
+                url: `/pages/index/detail/batch-audit?orderId=${orderId.value}`,
+            });
         }
     } else {
-        let text = `此订单中不存在${isbn}这本书 `
-        uni.$u.ttsModule.speak(text)
+        let text = `此订单中不存在${isbn}这本书 `;
+        uni.$u.ttsModule.speak(text);
     }
 }
 
@@ -156,77 +167,75 @@ function handleScan(isbn) {
 function handleScanCode() {
     uni.scanCode({
         success: (res) => {
-            handleScan(res.result)
+            handleScan(res.result);
         },
-    })
+    });
 }
 
-const auditInfoRef = ref()
+const auditInfoRef = ref();
 //审核 /app/orderinfo/checkOrder
 const handleAudit = () => {
-    let checkList = auditInfoRef.value?.formatReason(auditData.value)
-    let checkUserInfo = uni.getStorageSync('checkUserInfo')
+    let checkList = auditInfoRef.value?.formatReason(auditData.value);
+    let checkUserInfo = uni.getStorageSync("checkUserInfo");
     if (checkUserInfo.userId) {
-        checkUserId.value = checkUserInfo.userId
+        checkUserId.value = checkUserInfo.userId;
     } else {
-        uni.$u.toast('请先选择审核人')
+        uni.$u.toast("请先选择审核人");
     }
 
-    uni.$u.http.post('/app/orderinfo/checkOrder', {
-        "checkUserId": checkUserId.value,
-        "orderId": orderId.value,
-        "checkList": checkList
-    }).then(res => {
-        if (res.code == 200) {
-            uni.showToast({ title: '审核成功', icon: 'none' })
-            uni.$u.ttsModule.speak('审核成功')
-            uni.navigateBack()
-        } else {
-            uni.$u.toast(res.msg)
-        }
-    })
-}
+    //审核极差的必须选择原因
+    let poorList = checkList.filter((item) => item.sts == 3);
+    if (poorList.length > 0 && !poorList.every((item) => item.com)) {
+        uni.$u.ttsModule.speak("请选择品相");
+        return;
+    }
 
-const auditBook = ref({})
-const checkUserId = ref()
-const orderId = ref()
-const orderDetail = ref({})
+    uni.$u.http
+        .post("/app/orderinfo/checkOrder", {
+            checkUserId: checkUserId.value,
+            orderId: orderId.value,
+            checkList: checkList,
+        })
+        .then((res) => {
+            if (res.code == 200) {
+                uni.showToast({ title: "审核成功", icon: "none" });
+                uni.$u.ttsModule.speak("审核成功");
+                uni.navigateBack();
+            } else {
+                uni.$u.toast(res.msg);
+            }
+        });
+};
 
-let isbnScan = ref('')
-onLoad((options) => {
-    options.isbn && getBookInfo(options.isbn)
-    scannedBooks.value = [options.isbn]
-    isbnScan.value = options.isbn
-    auditBook.value = uni.getStorageSync('auditBook')
-    orderId.value = options.orderId
-    orderDetail.value = uni.getStorageSync('orderDetail')
+const checkUserId = ref();
+const orderId = ref();
+const orderDetail = ref({});
 
-    nextTick(() => {
-        auditInfoRef.value?.initAuditList(auditBook.value)
-    })
+let isbnScan = ref("");
+onLoad((options) => {
+    options.isbn && getBookInfo(options.isbn);
+    scannedBooks.value = [options.isbn];
+    isbnScan.value = options.isbn;
+    orderId.value = options.orderId;
+    getBookInfoAndAuditInfo(options.isbn, options.orderId);
+    orderDetail.value = uni.getStorageSync("orderDetail");
 
     // #ifdef APP-PLUS
     uni.$u.useGlobalEvent((e) => {
         if (e.barcode) {
-            handleScan(e.barcode)
+            handleScan(e.barcode);
         }
-    })
+    });
     // #endif
-})
+});
 onShow(() => {
     if (isbnScan.value) {
-        checkUserId.value = uni.getStorageSync('userInfo')?.userId
-        auditBook.value = uni.getStorageSync('auditBook')
-        orderDetail.value = uni.getStorageSync('orderDetail')
-
-        nextTick(() => {
-            auditInfoRef.value?.initAuditList(auditBook.value)
-        })
+        checkUserId.value = uni.getStorageSync("userInfo")?.userId;
+        orderDetail.value = uni.getStorageSync("orderDetail");
     }
-})
+});
 </script>
 
-
 <style lang="scss" scoped>
 .book-audit {
     padding: 20rpx;
@@ -252,4 +261,4 @@ onShow(() => {
         }
     }
 }
-</style>
+</style>

+ 85 - 64
pages/index/detail/components/AuditInfo.vue

@@ -1,28 +1,38 @@
 <template>
     <view class="audit-info">
         <view class="font-bold mt-16" style="padding: 0 20rpx">
-            该书共{{ detail.num }}本,其中:良好{{ getAuditCateNum(1) }}本,一般{{ getAuditCateNum(2) }}本,极差{{ getAuditCateNum(3) }}本
+            该书共{{ detail.num }}本,其中:良好{{ getAuditCateNum(1) }}本,一般{{ getAuditCateNum(2) }}本,极差{{
+                getAuditCateNum(3)
+            }}本
         </view>
 
         <view v-if="auditCommentList.length > 0" v-for="(audit, index) in auditCommentList" :key="index">
-            <view class="mt-10 bind-code" style="padding: 10rpx 20rpx">
-                第{{ index + 1 }}本的审核意见
-            </view>
+            <view class="mt-10 bind-code" style="padding: 10rpx 20rpx"> 第{{ index + 1 }}本的审核意见 </view>
 
-            <view class="mt-20 bg-white flex flex-j-a flex-a-c" style="padding:20rpx;border-radius: 10rpx;">
+            <view class="mt-20 bg-white flex flex-j-a flex-a-c" style="padding: 20rpx; border-radius: 10rpx">
                 <view class="u-page__tag-item" v-for="(item, idx) in auditList" :key="idx">
-                    <u-tag size="large" :text="item.label" :plain="audit.sts != item.sts" type="primary"
-                        :name="item.sts" :class="{ 'disabled': item.sts == 2 }"
-                        @click="radioClick(audit, index, item.sts)">
+                    <u-tag
+                        size="large"
+                        :text="item.label"
+                        :plain="audit.sts != item.sts"
+                        type="primary"
+                        :name="item.sts"
+                        :class="{ disabled: item.sts == 2 }"
+                        @click="radioClick(audit, index, item.sts)"
+                    >
                     </u-tag>
                 </view>
             </view>
 
-            <view class="mt-20 bg-white" style="padding:20rpx;border-radius: 10rpx;" v-if="audit.sts == 3">
+            <view class="mt-20 bg-white" style="padding: 20rpx; border-radius: 10rpx" v-if="audit.sts == 3">
                 <view class="flex flex-a-c flex-wrap">
-                    <view class="mr-10 reason-item" v-for="(item, idx) in reasonList" :key="idx"
+                    <view
+                        class="mr-10 reason-item"
+                        v-for="(item, idx) in reasonList"
+                        :key="idx"
                         @click="toggleReason(audit, index, item)"
-                        :class="{ 'selected': audit.comList.includes(item.label) }">
+                        :class="{ selected: audit.comList.includes(item.label) }"
+                    >
                         {{ item.label }}
                     </view>
                 </view>
@@ -32,88 +42,99 @@
 </template>
 
 <script setup>
-import { ref, watch, nextTick, onMounted } from 'vue';
+import { ref, watch, nextTick, onMounted } from "vue";
 const props = defineProps({
     detail: {
         type: Object,
-        default: () => ({})
+        default: () => ({}),
     },
     auditList: {
         type: Array,
-        default: () => []
-    }
-})
-
+        default: () => [],
+    },
+});
 
-const auditCommentList = ref([])
+const auditCommentList = ref([]);
 
 const initAuditList = (detail) => {
-    console.log(detail, 'detail')
-    if (!detail?.auditCommentList) return
-    auditCommentList.value = detail.auditCommentList.map(item => ({
+    if (!detail?.auditCommentList) return;
+    auditCommentList.value = detail.auditCommentList.map((item, index) => ({
         ...item,
+        idx: index,
         isbn: detail.isbn,
-        comList: item.com ? (typeof item.com === 'string' ? item.com.split(',') : item.com) : []
-    }))
-}
-watch(() => props.detail, () => {
-    initAuditList(props.detail)
-}, { deep: true, immediate: true })
-
-const auditList = ref([{ sts: 1, label: '品相良好' }, { sts: 2, label: '品相一般', disabled: true }, { sts: 3, label: '品相极差' }])
-const emit = defineEmits(['selected'])
+        comList: item.com ? (typeof item.com === "string" ? item.com.split(",") : item.com) : [],
+    }));
+};
+watch(
+    () => props.detail,
+    () => {
+        initAuditList(props.detail);
+    },
+    { deep: true, immediate: true }
+);
+
+const auditList = ref([
+    { sts: 1, label: "品相良好" },
+    { sts: 2, label: "品相一般", disabled: true },
+    { sts: 3, label: "品相极差" },
+]);
+const emit = defineEmits(["selected"]);
 const radioClick = (audit, index, sts) => {
-    if (sts == 2) return
-    audit.sts = sts
-    auditCommentList.value[index] = audit
-    formatReason()
-}
+    if (sts == 2) return;
+    audit.sts = sts;
+    if (sts == 1) {
+        audit.comList = [];
+    }
+    auditCommentList.value[index] = audit;
+
+    formatReason();
+};
 
 const getAuditCateNum = (cate) => {
-    return props.detail.auditCommentList?.filter(item => item.sts == cate)?.length || 0
-}
+    return props.detail.auditCommentList?.filter((item) => item.sts == cate)?.length || 0;
+};
 
 let reasonList = ref([
-    { sts: 3, label: '明显泛黄水印/发霉/明显异味' },
-    { sts: 3, label: '老化泛黄褪色/污渍' },
-    { sts: 3, label: '明显破损/脱胶缺页/书籍变型' },
-    { sts: 3, label: '无此书' },
-    { sts: 3, label: '印刷不清晰' },
-    { sts: 3, label: '无防伪' },
-    { sts: 3, label: '无外护封/无ISBN' },
-    { sts: 3, label: '无此书多其他书' },
-    { sts: 3, label: '笔记杂乱/习题做完' },
-    { sts: 3, label: '有笔记贴' },
-    { sts: 3, label: '套装缺册' },
-    { sts: 3, label: '听力无光盘' },
-    { sts: 3, label: '图书馆/藏书印章' }
-])
+    { sts: 3, label: "明显泛黄水印/发霉/明显异味" },
+    { sts: 3, label: "老化泛黄褪色/污渍" },
+    { sts: 3, label: "明显破损/脱胶缺页/书籍变型" },
+    { sts: 3, label: "无此书" },
+    { sts: 3, label: "印刷不清晰" },
+    { sts: 3, label: "无防伪" },
+    { sts: 3, label: "无外护封/无ISBN" },
+    { sts: 3, label: "无此书多其他书" },
+    { sts: 3, label: "笔记杂乱/习题做完" },
+    { sts: 3, label: "有笔记贴" },
+    { sts: 3, label: "套装缺册" },
+    { sts: 3, label: "听力无光盘" },
+    { sts: 3, label: "图书馆/藏书印章" },
+]);
 
 const formatReason = () => {
     let list = auditCommentList.value.map((item, index) => ({
         ...item,
         idx: index,
-        com: item.comList.join(',')
-    }))
-    return list
-}
+        com: item.comList.join(","),
+    }));
+    return list;
+};
 
 const toggleReason = (audit, index, item) => {
-    const idx = audit.comList.indexOf(item.label)
-    
+    const idx = audit.comList.indexOf(item.label);
+
     if (idx > -1) {
-        audit.comList.splice(idx, 1)
+        audit.comList.splice(idx, 1);
     } else {
-        audit.comList.push(item.label)
+        audit.comList.push(item.label);
     }
-    
-    auditCommentList.value[index] = audit
-}
+
+    auditCommentList.value[index] = audit;
+};
 
 defineExpose({
     formatReason,
-    initAuditList
-})
+    initAuditList,
+});
 </script>
 
 <style lang="scss" scoped>

+ 24 - 8
pages/index/detail/components/BookInfo.vue

@@ -84,14 +84,29 @@ const formatBookList = (list) => {
 
     const handleBookCategorization = (book) => {
         let firstLetter;
-        const char = book.bookName.charAt(0);
-        if (/^[A-Za-z]$/.test(char)) {
-            firstLetter = char.toUpperCase();
-        } else if (/^[\u4E00-\u9FA5]$/.test(char)) { //中文
-            firstLetter = toPinyin.chineseToInitials(toPinyin.chineseToPinYin(char));
+        // 找到第一个中文
+        let firstChineseChar = null;
+        for (let i = 0; i < book.bookName.length; i++) {
+            const char = book.bookName.charAt(i);
+            if (/^[\u4E00-\u9FA5]$/.test(char)) { // 检查是否为中文
+                firstChineseChar = char;
+                break;
+            }
+        }
+
+        // 如果找到中文,使用其拼音首字母
+        if (firstChineseChar) {
+            firstLetter = toPinyin.chineseToInitials(toPinyin.chineseToPinYin(firstChineseChar));
         } else {
-            firstLetter = char
+            // 如果没有找到中文,使用第一个字符
+            const char = book.bookName.charAt(0);
+            if (/^[A-Za-z]$/.test(char)) {
+                firstLetter = char.toUpperCase();
+            } else {
+                firstLetter = char;
+            }
         }
+        
         let bool = otherBooks.some(item => item.title == firstLetter);
         if (!bool) {
             otherBooks.push({ id: firstLetter, title: firstLetter, list: [{ ...book }] });
@@ -103,7 +118,6 @@ const formatBookList = (list) => {
     };
 
     list.forEach(book => {
-        console.log(book, 'book')
         book.goodNum = book.auditCommentList?.filter(v => v.sts == 1).length || 0
         book.badNum = book.auditCommentList?.filter(v => v.sts == 3).length || 0
 
@@ -133,10 +147,12 @@ const formatList = ref([]);
 watch(() => props.bookList, (newVal) => {
     let { poorBooks, goodBooks, otherBooks } = formatBookList(newVal);
 
+    // 按照首字母排序 A-Z
+    otherBooks.sort((a, b) => a.id.localeCompare(b.id));
+
     let poor = poorBooks.list.length > 0 ? poorBooks : {}
     let good = goodBooks.list.length > 0 ? goodBooks : {}
     formatList.value = [...otherBooks, poor, good]
-    console.log(formatList.value, 'xxxxx')
 
 }, { immediate: true, deep: true });
 

+ 6 - 4
pages/index/detail/components/OrderInfo.vue

@@ -17,8 +17,8 @@
         </view>
         <view class="info-item" @click="handleRemark">
             <text class="label">内部备注</text>
-            <text class="content">{{ detail.manageRemark ? detail.manageRemark.length > 0 ?
-                detail.manageRemark[0]?.remark: ' ' : ' ' }}</text>
+            <text class="content">{{ detail?.manageRemark ? detail?.manageRemark.length > 0 ?
+                detail?.manageRemark[0]?.remark: ' ' : ' ' }}</text>
         </view>
         <view class="info-item">
             <text class="label">订单状态</text>
@@ -48,7 +48,8 @@
                 }}</text>
         </view>
     </view>
-    <u-modal v-model:show="showModal" title="编辑内部备注" :showCancelButton="true" @confirm="confirmRemark">
+    <u-modal :show="showModal" title="编辑内部备注" :showCancelButton="true" @confirm="confirmRemark"
+        @cancel="showModal = false">
         <view class="modal-content w100">
             <u-textarea v-model="internalRemark" placeholder="编辑内部备注" autoHeight
                 style="min-height: 100px;"></u-textarea>
@@ -136,6 +137,7 @@ function handleRemark() {
     internalRemark.value = remarkInfo.value.remark || '';
 }
 
+const emit = defineEmits(['refresh']);
 function confirmRemark() {
     // Logic to save the remark
     uni.$u.http.post('/app/orderinfo/setManageRemark', {
@@ -147,7 +149,7 @@ function confirmRemark() {
             uni.$u.toast('保存成功')
             uni.$u.ttsModule.speak('保存成功')
             showModal.value = false;
-            getOrderDetail()
+            emit('refresh')
         } else {
             uni.$u.toast(res.msg)
         }

+ 1 - 5
pages/index/detail/index.vue

@@ -8,7 +8,7 @@
                 <text @click="showAuditorSelector = true" class="color-primary">绑定</text>
             </view>
 
-            <OrderInfo :detail="orderDetail" />
+            <OrderInfo :detail="orderDetail" @refresh="getOrderDetail" />
 
             <UserInfoCard :detail="orderDetail" />
 
@@ -254,10 +254,6 @@ function handleScan(isbn) {
 
     if (isbns.includes(isbn)) {
         let book = orderDetail.value.detailVoList.find(item => item.isbn == isbn)
-        if (book.auditCommentList.every(item => item.sts == 1)) {
-            let text = `${isbn}已审核为良好`
-            return uni.$u.ttsModule.speak(text)
-        }
 
         //扫描到套装书
         if (book.suit == 1) {

+ 264 - 246
pages/index/entry/scan-book.vue

@@ -1,253 +1,271 @@
 <template>
-	<view class="container">
-		<!-- 顶部搜索框 -->
-		<u-sticky>
-			<view class="search-area">
-				<u-search v-model="searchValue" placeholder="扫描/输入ISBN或SH码" :show-action="true" actionText="查询"
-					@search="handleSearch" @custom="handleSearch">
-					<template #suffixIcon>
-						<u-icon name="close" size="20" v-if="searchValue" @click="searchValue = ''" />
-					</template>
-				</u-search>
-			</view>
-		</u-sticky>
-
-		<!-- 已扫描ISBN显示 -->
-		<view class="isbn-display" v-if="scannedISBN">
-			<text>已查询ISBN:{{ scannedISBN }}</text>
-		</view>
-
-		<!-- 内容区域 -->
-		<view class="content">
-			<!-- 空状态 -->
-			<view class="empty-state" v-if="!bookInfo">
-				<u-empty mode="data" text="暂无扫描数据" margin-top="100" />
-			</view>
-
-			<!-- 书籍详情 -->
-			<view class="book-detail" v-else>
-				<view class="common-card mb-20">
-					<view class="flex flex-d flex-a-c">
-						<image class="book-image" :src="bookInfo.cover" mode="heightFix" />
-						<text class="ml-20 font-15">{{ bookInfo.bookName }}</text>
-					</view>
-
-					<view class="book-status">
-						<text class="status-text">状态:{{bookInfo.recycleStatus?'已加入回收书单':'未加入回收书单'}}</text>
-						<text class="time-text" v-if="bookInfo.recycleTime">加入时间:{{ bookInfo.recycleTime }}</text>
-					</view>
-				</view>
-				<!-- 基本信息 -->
-				<view class="common-card info-section mb-20">
-					<view class="price-info">
-						<text class="label">定价:</text>
-						<text class="price">¥{{ bookInfo.price }}</text>
-						<text class="recycle-price">回收价:¥{{ bookInfo.expectPrice }}</text>
-					</view>
-
-					<view class="book-info">
-						<view class="info-item">
-							<text class="label">ISBN:</text>
-							<text>{{ bookInfo.isbn }}</text>
-						</view>
-						<view class="info-item">
-							<text class="label">语言:</text>
-							<text>{{ bookInfo.lang||'-' }}</text>
-						</view>
-						<view class="info-item">
-							<text class="label">作者:</text>
-							<text>{{ bookInfo.author }}</text>
-						</view>
-						<view class="info-item">
-							<text class="label">出版社:</text>
-							<text>{{ bookInfo.publish }}</text>
-						</view>
-						<view class="info-item">
-							<text class="label">出版时间:</text>
-							<text>{{ bookInfo.pubDate }}</text>
-						</view>
-					</view>
-				</view>
-
-				<!-- 简介和轨迹 -->
-				<view class="common-card tabs-section" style="padding:0">
-					<u-tabs :list="tabsList" v-model="currentTab" lineColor="#19be6b" />
-					<view class="tab-content">
-						<view v-if="currentTab === 0" class="intro-content">
-							<text class="section-title">内容简介:</text>
-							<text class="content-text">{{ bookInfo.contentBlurb }}</text>
-							<text class="section-title">作者简介:</text>
-							<text class="content-text">{{ bookInfo.anthorBlurb }}</text>
-							<text class="content-text">{{ bookInfo.catalog }}</text>
-						</view>
-						<view v-else class="track-content">
-							<text>{{ bookInfo.track }}</text>
-						</view>
-					</view>
-				</view>
-			</view>
-		</view>
-
-		<!-- 底部扫描按钮 -->
-		<view class="fixed-bottom">
-			<u-button size="large" type="primary" text="扫码(ISBN或SH码)" @click="handleScan" />
-		</view>
-	</view>
+    <view class="container">
+        <!-- 顶部搜索框 -->
+        <u-sticky>
+            <view class="search-area">
+                <u-search
+                    v-model="searchValue"
+                    placeholder="扫描/输入ISBN或SH码"
+                    :show-action="true"
+                    actionText="查询"
+                    @search="handleSearch"
+                    @custom="handleSearch"
+                >
+                    <template #suffixIcon>
+                        <u-icon name="close" size="20" v-if="searchValue" @click="searchValue = ''" />
+                    </template>
+                </u-search>
+            </view>
+        </u-sticky>
+
+        <!-- 已扫描ISBN显示 -->
+        <view class="isbn-display" v-if="scannedISBN">
+            <text>已查询ISBN:{{ scannedISBN }}</text>
+        </view>
+
+        <!-- 内容区域 -->
+        <view class="content">
+            <!-- 空状态 -->
+            <view class="empty-state" v-if="!bookInfo">
+                <u-empty mode="data" text="暂无扫描数据" margin-top="100" />
+            </view>
+
+            <!-- 书籍详情 -->
+            <view class="book-detail" v-else>
+                <view class="common-card mb-20">
+                    <view class="flex flex-d flex-a-c">
+                        <image class="book-image" :src="bookInfo.cover" mode="heightFix" />
+                        <text class="ml-20 font-15">{{ bookInfo.bookName }}</text>
+                    </view>
+
+                    <view class="book-status">
+                        <text class="status-text"
+                            >状态:{{ bookInfo.recycleStatus ? "已加入回收书单" : "未加入回收书单" }}</text
+                        >
+                        <text class="time-text" v-if="bookInfo.recycleTime">加入时间:{{ bookInfo.recycleTime }}</text>
+                    </view>
+                </view>
+                <!-- 基本信息 -->
+                <view class="common-card info-section mb-20">
+                    <view class="price-info">
+                        <text class="label">定价:</text>
+                        <text class="price">¥{{ bookInfo.price }}</text>
+                        <text class="recycle-price">回收价:¥{{ bookInfo.expectPrice }}</text>
+                    </view>
+
+                    <view class="book-info">
+                        <view class="info-item">
+                            <text class="label">ISBN:</text>
+                            <text>{{ bookInfo.isbn }}</text>
+                        </view>
+                        <view class="info-item">
+                            <text class="label">语言:</text>
+                            <text>{{ bookInfo.lang || "-" }}</text>
+                        </view>
+                        <view class="info-item">
+                            <text class="label">作者:</text>
+                            <text>{{ bookInfo.author }}</text>
+                        </view>
+                        <view class="info-item">
+                            <text class="label">出版社:</text>
+                            <text>{{ bookInfo.publish }}</text>
+                        </view>
+                        <view class="info-item">
+                            <text class="label">出版时间:</text>
+                            <text>{{ bookInfo.pubDate }}</text>
+                        </view>
+                    </view>
+                </view>
+
+                <!-- 简介和轨迹 -->
+                <view class="common-card tabs-section" style="padding: 0">
+                    <u-tabs :list="tabsList" v-model="currentTab" lineColor="#19be6b" />
+                    <view class="tab-content">
+                        <view v-if="currentTab === 0" class="intro-content">
+                            <text class="section-title">内容简介:</text>
+                            <text class="content-text">{{ bookInfo.contentBlurb }}</text>
+                            <text class="section-title">作者简介:</text>
+                            <text class="content-text">{{ bookInfo.anthorBlurb }}</text>
+                            <text class="content-text">{{ bookInfo.catalog }}</text>
+                        </view>
+                        <view v-else class="track-content">
+                            <text>{{ bookInfo.track }}</text>
+                        </view>
+                    </view>
+                </view>
+            </view>
+        </view>
+
+        <!-- 底部扫描按钮 -->
+        <view class="fixed-bottom">
+            <u-button size="large" type="primary" text="扫码(ISBN或SH码)" @click="handleScan" />
+        </view>
+    </view>
 </template>
 
 <script setup>
-	import {
-		ref
-	} from 'vue';
-
-	const searchValue = ref('');
-	const scannedISBN = ref('');
-	const currentTab = ref(0);
-	const tabsList = [{
-			name: '简介'
-		},
-		{
-			name: '轨迹'
-		}
-	];
-
-	// 模拟书籍信息
-	const bookInfo = ref(null);
-
-	// 处理搜索
-	const handleSearch = () => {
-		if (!searchValue.value) return;
-		loadBookInfo(searchValue.value);
-	};
-
-	// 处理扫描
-	const handleScan = () => {
-		uni.scanCode({
-			success: (res) => {
-				searchValue.value = res.result;
-				scannedISBN.value = res.result;
-				loadBookInfo(res.result);
-			}
-		});
-	};
-
-	// 加载书籍信息
-	const loadBookInfo = (isbn) => {
-		uni.$u.http.get(`/app/book/getBookByIsbn/${isbn}`).then(res => {
-			if (res.code == 200) {
-				bookInfo.value = res.data
-			}
-		})
-	};
+import { ref } from "vue";
+import { onLoad } from "@dcloudio/uni-app";
+
+const searchValue = ref("");
+const scannedISBN = ref("");
+const currentTab = ref(0);
+const tabsList = [
+    {
+        name: "简介",
+    },
+    {
+        name: "轨迹",
+    },
+];
+
+// 模拟书籍信息
+const bookInfo = ref(null);
+
+// 处理搜索
+const handleSearch = () => {
+    if (!searchValue.value) return;
+    loadBookInfo(searchValue.value);
+};
+
+// 处理扫描
+const handleScan = () => {
+    uni.scanCode({
+        success: (res) => {
+            searchValue.value = res.result;
+            scannedISBN.value = res.result;
+            loadBookInfo(res.result);
+        },
+    });
+};
+
+// 加载书籍信息
+const loadBookInfo = (isbn) => {
+    uni.$u.http.get(`/app/book/getBookByIsbn/${isbn}`).then((res) => {
+        if (res.code == 200) {
+            bookInfo.value = res.data;
+        }
+    });
+};
+
+onLoad(() => {
+    // #ifdef APP-PLUS
+    uni.$u.useGlobalEvent((e) => {
+        searchValue.value = e.barcode;
+        scannedISBN.value = e.barcode;
+        loadBookInfo(e.barcode);
+    });
+    // #endif
+});
 </script>
 
 <style lang="scss" scoped>
-	.container {
-		display: flex;
-		flex-direction: column;
-		box-sizing: border-box;
-		padding-bottom: 70px;
-	}
-
-	.search-box {
-		padding: 12px;
-		background-color: #fff;
-	}
-
-	.isbn-display {
-		padding: 8px 12px;
-		background-color: #e8f5e9;
-		color: #19be6b;
-		font-size: 14px;
-	}
-
-	.book-detail {
-		margin: 12px;
-		border-radius: 8px;
-		overflow: hidden;
-	}
-
-	.book-image {
-		width: 260rpx;
-		height: 300rpx;
-		object-fit: cover;
-		border-radius: 5px;
-	}
-
-	.book-status {
-		padding: 12px;
-
-		.status-text {
-			font-size: 16px;
-			color: #19be6b;
-			margin-bottom: 4px;
-			display: block;
-		}
-
-		.time-text {
-			font-size: 14px;
-			color: #999;
-		}
-	}
-
-	.info-section {
-		padding: 16px;
-
-		.price-info {
-			margin-bottom: 16px;
-
-			.price {
-				color: #19be6b;
-				font-size: 18px;
-				font-weight: bold;
-				margin-right: 12px;
-			}
-
-			.recycle-price {
-				color: #666;
-				font-size: 14px;
-			}
-		}
-	}
-
-	.info-item {
-		margin-bottom: 8px;
-		font-size: 14px;
-
-		.label {
-			color: #666;
-			margin-right: 8px;
-		}
-	}
-
-	.tab-content {
-		padding: 16px;
-		padding-top: 0;
-
-		.section-title {
-			font-weight: bold;
-			margin-top: 12px;
-			margin-bottom: 6px;
-			display: block;
-		}
-
-		.content-text {
-			font-size: 14px;
-			color: #666;
-			line-height: 1.6;
-			margin-bottom: 16px;
-		}
-	}
-
-	.footer {
-		padding: 12px;
-		background-color: #fff;
-	}
-
-	.empty-state {
-		flex: 1;
-		display: flex;
-		align-items: center;
-		justify-content: center;
-	}
-</style>
+.container {
+    display: flex;
+    flex-direction: column;
+    box-sizing: border-box;
+    padding-bottom: 70px;
+}
+
+.search-box {
+    padding: 12px;
+    background-color: #fff;
+}
+
+.isbn-display {
+    padding: 8px 12px;
+    background-color: #e8f5e9;
+    color: #19be6b;
+    font-size: 14px;
+}
+
+.book-detail {
+    margin: 12px;
+    border-radius: 8px;
+    overflow: hidden;
+}
+
+.book-image {
+    width: 260rpx;
+    height: 300rpx;
+    object-fit: cover;
+    border-radius: 5px;
+}
+
+.book-status {
+    padding: 12px;
+
+    .status-text {
+        font-size: 16px;
+        color: #19be6b;
+        margin-bottom: 4px;
+        display: block;
+    }
+
+    .time-text {
+        font-size: 14px;
+        color: #999;
+    }
+}
+
+.info-section {
+    padding: 16px;
+
+    .price-info {
+        margin-bottom: 16px;
+
+        .price {
+            color: #19be6b;
+            font-size: 18px;
+            font-weight: bold;
+            margin-right: 12px;
+        }
+
+        .recycle-price {
+            color: #666;
+            font-size: 14px;
+        }
+    }
+}
+
+.info-item {
+    margin-bottom: 8px;
+    font-size: 14px;
+
+    .label {
+        color: #666;
+        margin-right: 8px;
+    }
+}
+
+.tab-content {
+    padding: 16px;
+    padding-top: 0;
+
+    .section-title {
+        font-weight: bold;
+        margin-top: 12px;
+        margin-bottom: 6px;
+        display: block;
+    }
+
+    .content-text {
+        font-size: 14px;
+        color: #666;
+        line-height: 1.6;
+        margin-bottom: 16px;
+    }
+}
+
+.footer {
+    padding: 12px;
+    background-color: #fff;
+}
+
+.empty-state {
+    flex: 1;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+}
+</style>

+ 1 - 1
pages/index/offline/check-order.vue

@@ -23,7 +23,7 @@ import BookItem from '../components/BookItemOrder.vue';
 
 const bookList = ref([]);
 
-const totalBooks = computed(() => bookList.value.length);
+const totalBooks = computed(() => bookList.value.reduce((sum, book) => sum + parseFloat(book.quantity), 0));
 
 const totalPrice = computed(() => bookList.value.reduce((sum, book) => sum + parseFloat(book.auditPrice), 0).toFixed(2));
 

+ 119 - 110
pages/index/wms/bad-out-order.vue

@@ -3,9 +3,14 @@
         <!-- 搜索框 -->
         <u-sticky>
             <view class="search-area flex-c mb-20">
-                <u-search v-model="searchText" placeholder="请输入运单号/订单编号" :show-action="false" :clearabled="true"
-                    @change="onSearch" height="40">
-
+                <u-search
+                    v-model="searchText"
+                    placeholder="请输入运单号/订单编号"
+                    :show-action="false"
+                    :clearabled="true"
+                    @change="onSearch"
+                    height="40"
+                >
                 </u-search>
                 <u-icon name="scan" size="28" color="#19be6b" @click="openScan"></u-icon>
             </view>
@@ -22,10 +27,10 @@
             <template v-if="hasData">
                 <view class="info-section">
                     <view class="info-item">库位:{{ locationInfo.positionCode }}</view>
-                    <view class="info-item">物流单号:{{ locationInfo.waybillCode||'-' }}</view>
+                    <view class="info-item">物流单号:{{ locationInfo.waybillCode || "-" }}</view>
                     <view class="info-item">订单编号:{{ locationInfo.orderId }}</view>
                     <view class="info-item">订单商品:{{ locationInfo.badNum }}</view>
-                    <view class="info-item">备注信息:{{ locationInfo.remark||'-' }}</view>
+                    <view class="info-item">备注信息:{{ locationInfo.remark || "-" }}</view>
                 </view>
 
                 <!-- 极差商品列表 -->
@@ -45,178 +50,182 @@
         </view>
 
         <!-- 备注弹窗 -->
-        <remark-dialog v-model:visible="remarkVisible" :initial-value="currentRemark"
-            @confirm="handleRemarkConfirm"></remark-dialog>
+        <remark-dialog
+            v-model:visible="remarkVisible"
+            :initial-value="currentRemark"
+            @confirm="handleRemarkConfirm"
+        ></remark-dialog>
     </view>
 </template>
 
 <script setup>
-import { ref, onMounted } from 'vue'
-import BadOutCard from './components/BadOutCard.vue'
-import RemarkDialog from './components/RemarkDialog.vue';
-import VolumeTTS from '@/utils/VolumeTTS.js';
-import { onLoad } from '@dcloudio/uni-app'
+import { ref, onMounted } from "vue";
+import BadOutCard from "./components/BadOutCard.vue";
+import RemarkDialog from "./components/RemarkDialog.vue";
+import VolumeTTS from "@/utils/VolumeTTS.js";
+import { onLoad } from "@dcloudio/uni-app";
 
-const ttsModule = ref(null)
-const searchText = ref('')
-const errorMsg = ref('')
-const hasData = ref(false)
+const searchText = ref("");
+const errorMsg = ref("");
+const hasData = ref(false);
 
 // 位置信息
 const locationInfo = ref({
-    positionCode: '',
-    waybillCode: '',
-    orderId: '',
-    badNum: '',
-    remark: ''
-})
+    positionCode: "",
+    waybillCode: "",
+    orderId: "",
+    badNum: "",
+    remark: "",
+});
 
 // 极差商品列表
-const badList = ref([])
+const badList = ref([]);
 
 onLoad((options) => {
     if (options.searchText) {
-        searchText.value = options.searchText
-        onSearch()
+        searchText.value = options.searchText;
+        onSearch();
     }
-    ttsModule.value = new VolumeTTS()
-})
+});
 
 // 判断搜索类型
 const getSearchType = (text) => {
     // 这里可以根据实际业务逻辑调整判断条件
     // 假设订单号都是纯数字,物流号包含字母
-    return /^[0-9]+$/.test(text) ? 1 : 2
-}
+    return /^[0-9]+$/.test(text) ? 1 : 2;
+};
 
 // 搜索处理
 const onSearch = async () => {
     if (!searchText.value) {
-        errorMsg.value = '请输入运单号或订单编号'
-        hasData.value = false
-        return
+        errorMsg.value = "请输入运单号或订单编号";
+        hasData.value = false;
+        return;
     }
 
     try {
-        const searchType = getSearchType(searchText.value)
-        const res = await uni.$u.http.post('/app/stock/findOrderOutStock', {
+        const searchType = getSearchType(searchText.value);
+        const res = await uni.$u.http.post("/app/stock/findOrderOutStock", {
             search: searchText.value,
-            searchType: searchType
-        })
+            searchType: searchType,
+        });
         if (res.code == 200) {
-            const data = res.data
-            errorMsg.value = ''
-            hasData.value = true
+            const data = res.data;
+            errorMsg.value = "";
+            hasData.value = true;
             // 更新页面数据
             locationInfo.value = {
-                positionCode: data.positionCode || '',
-                waybillCode: data.waybillCode || '',
-                orderId: data.orderId || '',
-                badNum: data.badNum || '',
-                remark: data.remark || ''
-            }
-            badList.value = data.detailVoList || []
+                positionCode: data.positionCode || "",
+                waybillCode: data.waybillCode || "",
+                orderId: data.orderId || "",
+                badNum: data.badNum || "",
+                remark: data.remark || "",
+            };
+            badList.value = data.detailVoList || [];
         } else {
-            errorMsg.value = res.msg || '未找到相关数据'
-            hasData.value = false
-            return
+            errorMsg.value = res.msg || "未找到相关数据";
+            hasData.value = false;
+            return;
         }
     } catch (error) {
-        errorMsg.value = error.message || '获取数据失败'
-        hasData.value = false
+        errorMsg.value = error.message || "获取数据失败";
+        hasData.value = false;
         uni.showToast({
-            title: '获取数据失败',
-            icon: 'none'
-        })
+            title: "获取数据失败",
+            icon: "none",
+        });
     }
-}
+};
 
 // 打开扫码
 const openScan = () => {
     // #ifdef APP-PLUS || MP-WEIXIN
     uni.scanCode({
         success: (res) => {
-            searchText.value = res.result
-            onSearch()
+            searchText.value = res.result;
+            onSearch();
         },
         fail: (err) => {
             uni.showToast({
-                title: '扫码失败',
-                icon: 'error'
-            })
-        }
-    })
+                title: "扫码失败",
+                icon: "error",
+            });
+        },
+    });
     // #endif
 
     // #ifdef H5
     uni.showToast({
-        title: 'H5环境不支持扫码',
-        icon: 'none'
-    })
+        title: "H5环境不支持扫码",
+        icon: "none",
+    });
     // #endif
-}
+};
 
 // 确认出库
 const onConfirm = () => {
     uni.showModal({
-        title: '确认提示',
-        content: '是否确认出库?',
+        title: "确认提示",
+        content: "是否确认出库?",
         success: async (res) => {
             if (res.confirm) {
-                try {
-                    await uni.$u.http.post('/app/stock/outStock', {
+                uni.$u.http
+                    .post("/app/stock/outStock", {
                         orderId: locationInfo.value.orderId,
                         positionCode: locationInfo.value.positionCode,
-                        outputRemark: locationInfo.value.remark
-                    })
-
-                    uni.showToast({
-                        title: '出库成功',
-                        icon: 'success'
-                    })
-                    ttsModule.value.speak('出库成功')
-
-                    // 清空数据
-                    searchText.value = ''
-                    locationInfo.value = {
-                        positionCode: '',
-                        waybillCode: '',
-                        orderId: '',
-                        badNum: '',
-                        remark: ''
-                    }
-                    badList.value = []
-                } catch (error) {
-                    uni.showToast({
-                        title: '出库失败',
-                        icon: 'none'
+                        outputRemark: locationInfo.value.remark,
                     })
-                }
+                    .then((res) => {
+                        if (res.code == 200) {
+                            uni.showToast({
+                                title: "出库成功",
+                                icon: "success",
+                            });
+                            uni.$u.ttsModule.speak("出库成功");
+
+                            // 清空数据
+                            searchText.value = "";
+                            locationInfo.value = {
+                                positionCode: "",
+                                waybillCode: "",
+                                orderId: "",
+                                badNum: "",
+                                remark: "",
+                            };
+                            badList.value = [];
+                        } else {
+                            uni.showToast({
+                                title: res.msg,
+                                icon: "none",
+                            });
+                            uni.$u.ttsModule.speak(res.msg);
+                        }
+                    });
             }
-        }
-    })
-}
+        },
+    });
+};
 
 // 备注弹窗相关
-const remarkVisible = ref(false)
-const currentRemark = ref('')
-const currentEditIndex = ref(-1)
+const remarkVisible = ref(false);
+const currentRemark = ref("");
+const currentEditIndex = ref(-1);
 
 // 打开备注弹窗
-const openRemarkDialog = (index, remark = '') => {
-    currentEditIndex.value = index
-    currentRemark.value = remark
-    remarkVisible.value = true
-}
+const openRemarkDialog = (index, remark = "") => {
+    currentEditIndex.value = index;
+    currentRemark.value = remark;
+    remarkVisible.value = true;
+};
 
 // 处理备注确认
 const handleRemarkConfirm = (remark) => {
     if (currentEditIndex.value >= 0) {
-        orders.value[currentEditIndex.value].remark = remark
+        orders.value[currentEditIndex.value].remark = remark;
     }
-    currentEditIndex.value = -1
-    currentRemark.value = ''
-}
+    currentEditIndex.value = -1;
+    currentRemark.value = "";
+};
 </script>
 
 <style scoped>
@@ -285,4 +294,4 @@ const handleRemarkConfirm = (remark) => {
     padding: 20rpx;
     box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
 }
-</style>
+</style>

+ 73 - 62
pages/index/wms/speedy-check.vue

@@ -1,12 +1,18 @@
 <template>
-    <view class="container" style="padding-top: 44px;padding-bottom: 10px;">
-        <u-navbar title="快速盘点" :border="false" fixed safe-area-inset-top bgColor="#22ac38"
-        titleStyle="font-size:36rpx;color:#fff">
+    <view class="container" style="padding-top: 44px; padding-bottom: 10px">
+        <u-navbar
+            title="快速盘点"
+            :border="false"
+            fixed
+            safe-area-inset-top
+            bgColor="#22ac38"
+            titleStyle="font-size:36rpx;color:#fff"
+        >
             <template #left>
                 <u-icon name="arrow-left" color="#fff" size="20" @click="goBack"></u-icon>
             </template>
             <template #right>
-                <text style="color: #ffffff;" @click="onSubmit">提交</text>
+                <text style="color: #ffffff" @click="onSubmit">提交</text>
             </template>
         </u-navbar>
         <!-- 盘点信息选择区域 -->
@@ -116,7 +122,7 @@
 
 <script setup>
 import { reactive, ref } from "vue";
-import { onLoad,onUnload } from "@dcloudio/uni-app";
+import { onLoad, onUnload } from "@dcloudio/uni-app";
 import LocationOrderItem from "./components/LocationOrderItem.vue";
 
 const goBack = () => {
@@ -125,9 +131,9 @@ const goBack = () => {
 
 // 盘点方式相关
 const showCheckMethodPicker = ref(false);
-const checkMethod = ref("实际数量");
-const resetType = ref(1);
-const checkMethodOptions = ["实际数量", "增加数量", "减少数量"];
+const checkMethod = ref("增加数量");
+const resetType = ref(0);
+const checkMethodOptions = ["增加数量", "减少数量", "实际数量"];
 
 //获取用户的默认仓库
 const getUserDefaultWarehouse = () => {
@@ -145,9 +151,9 @@ const locationList = ref([]);
 const selectedLocation = ref("");
 
 //根据仓库获取库位列表
-const godownId = ref()
+const godownId = ref();
 const getWarehouseLocationList = (id) => {
-    godownId.value = id
+    godownId.value = id;
     uni.$u.http.get("/app/stock/getGodownPosition?godownId=" + id).then((res) => {
         if (res.code == 200) {
             locationList.value = res.data;
@@ -188,42 +194,45 @@ const selectLocation = (item) => {
 //盘点提交
 const onSubmit = () => {
     if (products.value.length === 0) {
-        uni.$u.toast('请添加盘点订单');
+        uni.$u.toast("请添加盘点订单");
         return;
     }
 
     // 构建请求参数
     const params = {
-        godownId: godownId.value, 
+        godownId: godownId.value,
         positionCode: location.value,
-        orderInfo: products.value.map(item => ({
+        orderInfo: products.value.map((item) => ({
             orderId: item.orderId,
             waybillCode: item.waybillCode,
             bookNum: item.badNum,
-            remark: item.remark || ''
+            remark: item.remark || "",
         })),
-        resetType: resetType.value
+        resetType: resetType.value,
     };
 
     // 调用重置库存API
-    uni.$u.http.post('/app/stock/resetStock', params).then(res => {
-        if (res.code === 200) {
-            uni.$u.toast('盘点成功');
-            location.value = ""
-            products.value = []
-            searchValue.value = ""
-        } else {
-            uni.$u.toast(res.msg || '提交失败');
-        }
-    }).catch(err => {
-        uni.$u.toast('提交失败');
-        console.error(err);
-    });
-}
+    uni.$u.http
+        .post("/app/stock/resetStock", params)
+        .then((res) => {
+            if (res.code === 200) {
+                uni.$u.toast("盘点成功");
+                location.value = "";
+                products.value = [];
+                searchValue.value = "";
+            } else {
+                uni.$u.toast(res.msg || "提交失败");
+            }
+        })
+        .catch((err) => {
+            uni.$u.toast("提交失败");
+            console.error(err);
+        });
+};
 
 const onSearch = () => {
     if (!searchValue.value) {
-        uni.$u.toast('请输入快递单号或订单编号');
+        uni.$u.toast("请输入快递单号或订单编号");
         return;
     }
 
@@ -231,34 +240,36 @@ const onSearch = () => {
     const searchType = /^[0-9]+$/.test(searchValue.value) ? 1 : 2;
 
     // 调用接口获取订单数据
-    uni.$u.http.get('/app/stock/searchBadOrderForReset', {
-        params: {
-            searchType,
-            search: searchValue.value
-        }
-    }).then(res => {
-        if (res.code === 200) {
-            // 检查是否已存在相同订单
-            const exists = products.value.some(item => 
-                item.orderId === res.data.orderId || 
-                item.waybillCode === res.data.waybillCode
-            );
-
-            if (exists) {
-                uni.$u.toast('该订单已添加');
-                return;
+    uni.$u.http
+        .get("/app/stock/searchBadOrderForReset", {
+            params: {
+                searchType,
+                search: searchValue.value,
+            },
+        })
+        .then((res) => {
+            if (res.code === 200) {
+                // 检查是否已存在相同订单
+                const exists = products.value.some(
+                    (item) => item.orderId === res.data.orderId || item.waybillCode === res.data.waybillCode
+                );
+
+                if (exists) {
+                    uni.$u.toast("该订单已添加");
+                    return;
+                }
+
+                // 添加新订单到列表
+                products.value.push(res.data);
+                searchValue.value = ""; // 清空搜索框
+            } else {
+                uni.$u.toast(res.msg || "查询失败");
             }
-
-            // 添加新订单到列表
-            products.value.push(res.data);
-            searchValue.value = ''; // 清空搜索框
-        } else {
-            uni.$u.toast(res.msg || '查询失败');
-        }
-    }).catch(err => {
-        uni.$u.toast('查询失败');
-        console.error(err);
-    });
+        })
+        .catch((err) => {
+            uni.$u.toast("查询失败");
+            console.error(err);
+        });
 };
 
 const openScan = () => {
@@ -270,10 +281,10 @@ const openScan = () => {
         },
         fail: (err) => {
             uni.showToast({
-                title: '扫码失败',
-                icon: 'error'
+                title: "扫码失败",
+                icon: "error",
             });
-        }
+        },
     });
     // #endif
 };
@@ -299,7 +310,7 @@ const open = () => {
 onLoad(() => {
     getUserDefaultWarehouse();
 
-    uni.$on('selectedProducts', (list) => {
+    uni.$on("selectedProducts", (list) => {
         products.value = list;
     });
 
@@ -314,7 +325,7 @@ onLoad(() => {
 });
 
 onUnload(() => {
-    uni.$off('selectedProducts');
+    uni.$off("selectedProducts");
 });
 </script>
 

+ 0 - 1
pages/login/login.vue

@@ -134,7 +134,6 @@
 				uni.switchTab({
 					url: "/pages/index/index"
 				})
-				console.log(res,'xxxxx')
 				uni.setStorageSync('token', res.data)
                 getUserInfo()
 				uni.$u.ttsModule.speak('书嗨,不辜负每一个爱书的人')

+ 1 - 1
pages/my/components/orderItem.vue

@@ -32,7 +32,7 @@
                 <text class="flex-1">审核金额:{{ item.finalMoney || '待核算' }}</text>
             </view>
             <view class="detail-row">
-                <text>内部备注:{{ item.manageRemark ? item.manageRemark[0].remark : '-' }}</text>
+                <text>内部备注:{{ item?.manageRemark ? item?.manageRemark[0]?.remark : '-' }}</text>
             </view>
         </view>
 

BIN
static/bap.mp3


+ 1 - 1
static/css/mystyle.css

@@ -180,7 +180,7 @@
 
 .fixed-bottom {
 	padding: 40rpx 0rpx;
-	padding-bottom: env(safe-area-inset-bottom);
+	padding-bottom: 0;
 	position: fixed;
 	width: 100%;
 	bottom: 0;

File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/build/app-plus/app-service.js


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/build/app-plus/app.css


+ 33 - 0
unpackage/dist/build/app-plus/manifest.json

@@ -20,6 +20,7 @@
     "Speech": {},
     "Barcode": {},
     "Bluetooth": {},
+    "Webview-x5": {},
     "UniNView": {
       "description": "UniNView原生渲染"
     }
@@ -44,6 +45,38 @@
     "nvueStyleCompiler": "uni-app",
     "compilerVersion": 3,
     "distribute": {
+      "icons": {
+        "android": {
+          "hdpi": "unpackage/res/icons/72x72.png",
+          "xhdpi": "unpackage/res/icons/96x96.png",
+          "xxhdpi": "unpackage/res/icons/144x144.png",
+          "xxxhdpi": "unpackage/res/icons/192x192.png"
+        },
+        "ios": {
+          "appstore": "unpackage/res/icons/1024x1024.png",
+          "ipad": {
+            "app": "unpackage/res/icons/76x76.png",
+            "app@2x": "unpackage/res/icons/152x152.png",
+            "notification": "unpackage/res/icons/20x20.png",
+            "notification@2x": "unpackage/res/icons/40x40.png",
+            "proapp@2x": "unpackage/res/icons/167x167.png",
+            "settings": "unpackage/res/icons/29x29.png",
+            "settings@2x": "unpackage/res/icons/58x58.png",
+            "spotlight": "unpackage/res/icons/40x40.png",
+            "spotlight@2x": "unpackage/res/icons/80x80.png"
+          },
+          "iphone": {
+            "app@2x": "unpackage/res/icons/120x120.png",
+            "app@3x": "unpackage/res/icons/180x180.png",
+            "notification@2x": "unpackage/res/icons/40x40.png",
+            "notification@3x": "unpackage/res/icons/60x60.png",
+            "settings@2x": "unpackage/res/icons/58x58.png",
+            "settings@3x": "unpackage/res/icons/87x87.png",
+            "spotlight@2x": "unpackage/res/icons/80x80.png",
+            "spotlight@3x": "unpackage/res/icons/120x120.png"
+          }
+        }
+      },
       "google": {
         "permissions": [
           "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",

File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/build/app-plus/pages/index/audit/confirm-receipt.css


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/build/app-plus/pages/index/audit/isbn-order.css


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/build/app-plus/pages/index/audit/sender.css


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/build/app-plus/pages/index/detail/batch-audit.css


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/build/app-plus/pages/index/detail/book-audit.css


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/build/app-plus/pages/index/detail/index.css


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/build/app-plus/pages/index/entry/scan-book.css


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/build/app-plus/pages/index/offline/check-order.css


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/build/app-plus/pages/index/wms/bad-out-order.css


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/build/app-plus/pages/index/wms/order-query-list.css


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/build/app-plus/pages/index/wms/speedy-check.css


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/build/app-plus/pages/login/login.css


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/build/app-plus/pages/my/page/audit-unfinished.css


File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/build/app-plus/pages/my/page/user-info.css


BIN
unpackage/dist/build/app-plus/static/bap.mp3


+ 1 - 1
unpackage/dist/build/app-plus/static/css/mystyle.css

@@ -180,7 +180,7 @@
 
 .fixed-bottom {
 	padding: 40rpx 0rpx;
-	padding-bottom: env(safe-area-inset-bottom);
+	padding-bottom: 0;
 	position: fixed;
 	width: 100%;
 	bottom: 0;

+ 15 - 5
unpackage/dist/cache/.vite/deps/_metadata.json

@@ -1,15 +1,25 @@
 {
-  "hash": "ad46c4bd",
+  "hash": "c3b66125",
   "configHash": "0f433167",
-  "lockfileHash": "b565e997",
-  "browserHash": "5a2beea0",
+  "lockfileHash": "4656f6a4",
+  "browserHash": "578a5606",
   "optimized": {
     "pinyin": {
       "src": "../../../../../node_modules/pinyin/esm/pinyin-web.js",
       "file": "pinyin.js",
-      "fileHash": "dcdf7b73",
+      "fileHash": "4e6e8efb",
       "needsInterop": false
+    },
+    "howler": {
+      "src": "../../../../../node_modules/howler/dist/howler.js",
+      "file": "howler.js",
+      "fileHash": "366ec08a",
+      "needsInterop": true
     }
   },
-  "chunks": {}
+  "chunks": {
+    "chunk-TYRVL62N": {
+      "file": "chunk-TYRVL62N.js"
+    }
+  }
 }

+ 16 - 0
unpackage/dist/cache/.vite/deps/chunk-TYRVL62N.js

@@ -0,0 +1,16 @@
+var __defProp = Object.defineProperty;
+var __getOwnPropNames = Object.getOwnPropertyNames;
+var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+var __commonJS = (cb, mod) => function __require() {
+  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
+};
+var __publicField = (obj, key, value) => {
+  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
+  return value;
+};
+
+export {
+  __commonJS,
+  __publicField
+};
+//# sourceMappingURL=chunk-TYRVL62N.js.map

+ 7 - 0
unpackage/dist/cache/.vite/deps/chunk-TYRVL62N.js.map

@@ -0,0 +1,7 @@
+{
+  "version": 3,
+  "sources": [],
+  "sourcesContent": [],
+  "mappings": "",
+  "names": []
+}

+ 2241 - 0
unpackage/dist/cache/.vite/deps/howler.js

@@ -0,0 +1,2241 @@
+import {
+  __commonJS
+} from "./chunk-TYRVL62N.js";
+
+// E:/书嗨项目/shuhi-app-fornt/node_modules/howler/dist/howler.js
+var require_howler = __commonJS({
+  "E:/书嗨项目/shuhi-app-fornt/node_modules/howler/dist/howler.js"(exports) {
+    (function() {
+      "use strict";
+      var HowlerGlobal2 = function() {
+        this.init();
+      };
+      HowlerGlobal2.prototype = {
+        /**
+         * Initialize the global Howler object.
+         * @return {Howler}
+         */
+        init: function() {
+          var self = this || Howler2;
+          self._counter = 1e3;
+          self._html5AudioPool = [];
+          self.html5PoolSize = 10;
+          self._codecs = {};
+          self._howls = [];
+          self._muted = false;
+          self._volume = 1;
+          self._canPlayEvent = "canplaythrough";
+          self._navigator = typeof window !== "undefined" && window.navigator ? window.navigator : null;
+          self.masterGain = null;
+          self.noAudio = false;
+          self.usingWebAudio = true;
+          self.autoSuspend = true;
+          self.ctx = null;
+          self.autoUnlock = true;
+          self._setup();
+          return self;
+        },
+        /**
+         * Get/set the global volume for all sounds.
+         * @param  {Float} vol Volume from 0.0 to 1.0.
+         * @return {Howler/Float}     Returns self or current volume.
+         */
+        volume: function(vol) {
+          var self = this || Howler2;
+          vol = parseFloat(vol);
+          if (!self.ctx) {
+            setupAudioContext();
+          }
+          if (typeof vol !== "undefined" && vol >= 0 && vol <= 1) {
+            self._volume = vol;
+            if (self._muted) {
+              return self;
+            }
+            if (self.usingWebAudio) {
+              self.masterGain.gain.setValueAtTime(vol, Howler2.ctx.currentTime);
+            }
+            for (var i = 0; i < self._howls.length; i++) {
+              if (!self._howls[i]._webAudio) {
+                var ids = self._howls[i]._getSoundIds();
+                for (var j = 0; j < ids.length; j++) {
+                  var sound = self._howls[i]._soundById(ids[j]);
+                  if (sound && sound._node) {
+                    sound._node.volume = sound._volume * vol;
+                  }
+                }
+              }
+            }
+            return self;
+          }
+          return self._volume;
+        },
+        /**
+         * Handle muting and unmuting globally.
+         * @param  {Boolean} muted Is muted or not.
+         */
+        mute: function(muted) {
+          var self = this || Howler2;
+          if (!self.ctx) {
+            setupAudioContext();
+          }
+          self._muted = muted;
+          if (self.usingWebAudio) {
+            self.masterGain.gain.setValueAtTime(muted ? 0 : self._volume, Howler2.ctx.currentTime);
+          }
+          for (var i = 0; i < self._howls.length; i++) {
+            if (!self._howls[i]._webAudio) {
+              var ids = self._howls[i]._getSoundIds();
+              for (var j = 0; j < ids.length; j++) {
+                var sound = self._howls[i]._soundById(ids[j]);
+                if (sound && sound._node) {
+                  sound._node.muted = muted ? true : sound._muted;
+                }
+              }
+            }
+          }
+          return self;
+        },
+        /**
+         * Handle stopping all sounds globally.
+         */
+        stop: function() {
+          var self = this || Howler2;
+          for (var i = 0; i < self._howls.length; i++) {
+            self._howls[i].stop();
+          }
+          return self;
+        },
+        /**
+         * Unload and destroy all currently loaded Howl objects.
+         * @return {Howler}
+         */
+        unload: function() {
+          var self = this || Howler2;
+          for (var i = self._howls.length - 1; i >= 0; i--) {
+            self._howls[i].unload();
+          }
+          if (self.usingWebAudio && self.ctx && typeof self.ctx.close !== "undefined") {
+            self.ctx.close();
+            self.ctx = null;
+            setupAudioContext();
+          }
+          return self;
+        },
+        /**
+         * Check for codec support of specific extension.
+         * @param  {String} ext Audio file extention.
+         * @return {Boolean}
+         */
+        codecs: function(ext) {
+          return (this || Howler2)._codecs[ext.replace(/^x-/, "")];
+        },
+        /**
+         * Setup various state values for global tracking.
+         * @return {Howler}
+         */
+        _setup: function() {
+          var self = this || Howler2;
+          self.state = self.ctx ? self.ctx.state || "suspended" : "suspended";
+          self._autoSuspend();
+          if (!self.usingWebAudio) {
+            if (typeof Audio !== "undefined") {
+              try {
+                var test = new Audio();
+                if (typeof test.oncanplaythrough === "undefined") {
+                  self._canPlayEvent = "canplay";
+                }
+              } catch (e) {
+                self.noAudio = true;
+              }
+            } else {
+              self.noAudio = true;
+            }
+          }
+          try {
+            var test = new Audio();
+            if (test.muted) {
+              self.noAudio = true;
+            }
+          } catch (e) {
+          }
+          if (!self.noAudio) {
+            self._setupCodecs();
+          }
+          return self;
+        },
+        /**
+         * Check for browser support for various codecs and cache the results.
+         * @return {Howler}
+         */
+        _setupCodecs: function() {
+          var self = this || Howler2;
+          var audioTest = null;
+          try {
+            audioTest = typeof Audio !== "undefined" ? new Audio() : null;
+          } catch (err) {
+            return self;
+          }
+          if (!audioTest || typeof audioTest.canPlayType !== "function") {
+            return self;
+          }
+          var mpegTest = audioTest.canPlayType("audio/mpeg;").replace(/^no$/, "");
+          var ua = self._navigator ? self._navigator.userAgent : "";
+          var checkOpera = ua.match(/OPR\/(\d+)/g);
+          var isOldOpera = checkOpera && parseInt(checkOpera[0].split("/")[1], 10) < 33;
+          var checkSafari = ua.indexOf("Safari") !== -1 && ua.indexOf("Chrome") === -1;
+          var safariVersion = ua.match(/Version\/(.*?) /);
+          var isOldSafari = checkSafari && safariVersion && parseInt(safariVersion[1], 10) < 15;
+          self._codecs = {
+            mp3: !!(!isOldOpera && (mpegTest || audioTest.canPlayType("audio/mp3;").replace(/^no$/, ""))),
+            mpeg: !!mpegTest,
+            opus: !!audioTest.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ""),
+            ogg: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""),
+            oga: !!audioTest.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""),
+            wav: !!(audioTest.canPlayType('audio/wav; codecs="1"') || audioTest.canPlayType("audio/wav")).replace(/^no$/, ""),
+            aac: !!audioTest.canPlayType("audio/aac;").replace(/^no$/, ""),
+            caf: !!audioTest.canPlayType("audio/x-caf;").replace(/^no$/, ""),
+            m4a: !!(audioTest.canPlayType("audio/x-m4a;") || audioTest.canPlayType("audio/m4a;") || audioTest.canPlayType("audio/aac;")).replace(/^no$/, ""),
+            m4b: !!(audioTest.canPlayType("audio/x-m4b;") || audioTest.canPlayType("audio/m4b;") || audioTest.canPlayType("audio/aac;")).replace(/^no$/, ""),
+            mp4: !!(audioTest.canPlayType("audio/x-mp4;") || audioTest.canPlayType("audio/mp4;") || audioTest.canPlayType("audio/aac;")).replace(/^no$/, ""),
+            weba: !!(!isOldSafari && audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, "")),
+            webm: !!(!isOldSafari && audioTest.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, "")),
+            dolby: !!audioTest.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ""),
+            flac: !!(audioTest.canPlayType("audio/x-flac;") || audioTest.canPlayType("audio/flac;")).replace(/^no$/, "")
+          };
+          return self;
+        },
+        /**
+         * Some browsers/devices will only allow audio to be played after a user interaction.
+         * Attempt to automatically unlock audio on the first user interaction.
+         * Concept from: http://paulbakaus.com/tutorials/html5/web-audio-on-ios/
+         * @return {Howler}
+         */
+        _unlockAudio: function() {
+          var self = this || Howler2;
+          if (self._audioUnlocked || !self.ctx) {
+            return;
+          }
+          self._audioUnlocked = false;
+          self.autoUnlock = false;
+          if (!self._mobileUnloaded && self.ctx.sampleRate !== 44100) {
+            self._mobileUnloaded = true;
+            self.unload();
+          }
+          self._scratchBuffer = self.ctx.createBuffer(1, 1, 22050);
+          var unlock = function(e) {
+            while (self._html5AudioPool.length < self.html5PoolSize) {
+              try {
+                var audioNode = new Audio();
+                audioNode._unlocked = true;
+                self._releaseHtml5Audio(audioNode);
+              } catch (e2) {
+                self.noAudio = true;
+                break;
+              }
+            }
+            for (var i = 0; i < self._howls.length; i++) {
+              if (!self._howls[i]._webAudio) {
+                var ids = self._howls[i]._getSoundIds();
+                for (var j = 0; j < ids.length; j++) {
+                  var sound = self._howls[i]._soundById(ids[j]);
+                  if (sound && sound._node && !sound._node._unlocked) {
+                    sound._node._unlocked = true;
+                    sound._node.load();
+                  }
+                }
+              }
+            }
+            self._autoResume();
+            var source = self.ctx.createBufferSource();
+            source.buffer = self._scratchBuffer;
+            source.connect(self.ctx.destination);
+            if (typeof source.start === "undefined") {
+              source.noteOn(0);
+            } else {
+              source.start(0);
+            }
+            if (typeof self.ctx.resume === "function") {
+              self.ctx.resume();
+            }
+            source.onended = function() {
+              source.disconnect(0);
+              self._audioUnlocked = true;
+              document.removeEventListener("touchstart", unlock, true);
+              document.removeEventListener("touchend", unlock, true);
+              document.removeEventListener("click", unlock, true);
+              document.removeEventListener("keydown", unlock, true);
+              for (var i2 = 0; i2 < self._howls.length; i2++) {
+                self._howls[i2]._emit("unlock");
+              }
+            };
+          };
+          document.addEventListener("touchstart", unlock, true);
+          document.addEventListener("touchend", unlock, true);
+          document.addEventListener("click", unlock, true);
+          document.addEventListener("keydown", unlock, true);
+          return self;
+        },
+        /**
+         * Get an unlocked HTML5 Audio object from the pool. If none are left,
+         * return a new Audio object and throw a warning.
+         * @return {Audio} HTML5 Audio object.
+         */
+        _obtainHtml5Audio: function() {
+          var self = this || Howler2;
+          if (self._html5AudioPool.length) {
+            return self._html5AudioPool.pop();
+          }
+          var testPlay = new Audio().play();
+          if (testPlay && typeof Promise !== "undefined" && (testPlay instanceof Promise || typeof testPlay.then === "function")) {
+            testPlay.catch(function() {
+              console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.");
+            });
+          }
+          return new Audio();
+        },
+        /**
+         * Return an activated HTML5 Audio object to the pool.
+         * @return {Howler}
+         */
+        _releaseHtml5Audio: function(audio) {
+          var self = this || Howler2;
+          if (audio._unlocked) {
+            self._html5AudioPool.push(audio);
+          }
+          return self;
+        },
+        /**
+         * Automatically suspend the Web Audio AudioContext after no sound has played for 30 seconds.
+         * This saves processing/energy and fixes various browser-specific bugs with audio getting stuck.
+         * @return {Howler}
+         */
+        _autoSuspend: function() {
+          var self = this;
+          if (!self.autoSuspend || !self.ctx || typeof self.ctx.suspend === "undefined" || !Howler2.usingWebAudio) {
+            return;
+          }
+          for (var i = 0; i < self._howls.length; i++) {
+            if (self._howls[i]._webAudio) {
+              for (var j = 0; j < self._howls[i]._sounds.length; j++) {
+                if (!self._howls[i]._sounds[j]._paused) {
+                  return self;
+                }
+              }
+            }
+          }
+          if (self._suspendTimer) {
+            clearTimeout(self._suspendTimer);
+          }
+          self._suspendTimer = setTimeout(function() {
+            if (!self.autoSuspend) {
+              return;
+            }
+            self._suspendTimer = null;
+            self.state = "suspending";
+            var handleSuspension = function() {
+              self.state = "suspended";
+              if (self._resumeAfterSuspend) {
+                delete self._resumeAfterSuspend;
+                self._autoResume();
+              }
+            };
+            self.ctx.suspend().then(handleSuspension, handleSuspension);
+          }, 3e4);
+          return self;
+        },
+        /**
+         * Automatically resume the Web Audio AudioContext when a new sound is played.
+         * @return {Howler}
+         */
+        _autoResume: function() {
+          var self = this;
+          if (!self.ctx || typeof self.ctx.resume === "undefined" || !Howler2.usingWebAudio) {
+            return;
+          }
+          if (self.state === "running" && self.ctx.state !== "interrupted" && self._suspendTimer) {
+            clearTimeout(self._suspendTimer);
+            self._suspendTimer = null;
+          } else if (self.state === "suspended" || self.state === "running" && self.ctx.state === "interrupted") {
+            self.ctx.resume().then(function() {
+              self.state = "running";
+              for (var i = 0; i < self._howls.length; i++) {
+                self._howls[i]._emit("resume");
+              }
+            });
+            if (self._suspendTimer) {
+              clearTimeout(self._suspendTimer);
+              self._suspendTimer = null;
+            }
+          } else if (self.state === "suspending") {
+            self._resumeAfterSuspend = true;
+          }
+          return self;
+        }
+      };
+      var Howler2 = new HowlerGlobal2();
+      var Howl2 = function(o) {
+        var self = this;
+        if (!o.src || o.src.length === 0) {
+          console.error("An array of source files must be passed with any new Howl.");
+          return;
+        }
+        self.init(o);
+      };
+      Howl2.prototype = {
+        /**
+         * Initialize a new Howl group object.
+         * @param  {Object} o Passed in properties for this group.
+         * @return {Howl}
+         */
+        init: function(o) {
+          var self = this;
+          if (!Howler2.ctx) {
+            setupAudioContext();
+          }
+          self._autoplay = o.autoplay || false;
+          self._format = typeof o.format !== "string" ? o.format : [o.format];
+          self._html5 = o.html5 || false;
+          self._muted = o.mute || false;
+          self._loop = o.loop || false;
+          self._pool = o.pool || 5;
+          self._preload = typeof o.preload === "boolean" || o.preload === "metadata" ? o.preload : true;
+          self._rate = o.rate || 1;
+          self._sprite = o.sprite || {};
+          self._src = typeof o.src !== "string" ? o.src : [o.src];
+          self._volume = o.volume !== void 0 ? o.volume : 1;
+          self._xhr = {
+            method: o.xhr && o.xhr.method ? o.xhr.method : "GET",
+            headers: o.xhr && o.xhr.headers ? o.xhr.headers : null,
+            withCredentials: o.xhr && o.xhr.withCredentials ? o.xhr.withCredentials : false
+          };
+          self._duration = 0;
+          self._state = "unloaded";
+          self._sounds = [];
+          self._endTimers = {};
+          self._queue = [];
+          self._playLock = false;
+          self._onend = o.onend ? [{ fn: o.onend }] : [];
+          self._onfade = o.onfade ? [{ fn: o.onfade }] : [];
+          self._onload = o.onload ? [{ fn: o.onload }] : [];
+          self._onloaderror = o.onloaderror ? [{ fn: o.onloaderror }] : [];
+          self._onplayerror = o.onplayerror ? [{ fn: o.onplayerror }] : [];
+          self._onpause = o.onpause ? [{ fn: o.onpause }] : [];
+          self._onplay = o.onplay ? [{ fn: o.onplay }] : [];
+          self._onstop = o.onstop ? [{ fn: o.onstop }] : [];
+          self._onmute = o.onmute ? [{ fn: o.onmute }] : [];
+          self._onvolume = o.onvolume ? [{ fn: o.onvolume }] : [];
+          self._onrate = o.onrate ? [{ fn: o.onrate }] : [];
+          self._onseek = o.onseek ? [{ fn: o.onseek }] : [];
+          self._onunlock = o.onunlock ? [{ fn: o.onunlock }] : [];
+          self._onresume = [];
+          self._webAudio = Howler2.usingWebAudio && !self._html5;
+          if (typeof Howler2.ctx !== "undefined" && Howler2.ctx && Howler2.autoUnlock) {
+            Howler2._unlockAudio();
+          }
+          Howler2._howls.push(self);
+          if (self._autoplay) {
+            self._queue.push({
+              event: "play",
+              action: function() {
+                self.play();
+              }
+            });
+          }
+          if (self._preload && self._preload !== "none") {
+            self.load();
+          }
+          return self;
+        },
+        /**
+         * Load the audio file.
+         * @return {Howler}
+         */
+        load: function() {
+          var self = this;
+          var url = null;
+          if (Howler2.noAudio) {
+            self._emit("loaderror", null, "No audio support.");
+            return;
+          }
+          if (typeof self._src === "string") {
+            self._src = [self._src];
+          }
+          for (var i = 0; i < self._src.length; i++) {
+            var ext, str;
+            if (self._format && self._format[i]) {
+              ext = self._format[i];
+            } else {
+              str = self._src[i];
+              if (typeof str !== "string") {
+                self._emit("loaderror", null, "Non-string found in selected audio sources - ignoring.");
+                continue;
+              }
+              ext = /^data:audio\/([^;,]+);/i.exec(str);
+              if (!ext) {
+                ext = /\.([^.]+)$/.exec(str.split("?", 1)[0]);
+              }
+              if (ext) {
+                ext = ext[1].toLowerCase();
+              }
+            }
+            if (!ext) {
+              console.warn('No file extension was found. Consider using the "format" property or specify an extension.');
+            }
+            if (ext && Howler2.codecs(ext)) {
+              url = self._src[i];
+              break;
+            }
+          }
+          if (!url) {
+            self._emit("loaderror", null, "No codec support for selected audio sources.");
+            return;
+          }
+          self._src = url;
+          self._state = "loading";
+          if (window.location.protocol === "https:" && url.slice(0, 5) === "http:") {
+            self._html5 = true;
+            self._webAudio = false;
+          }
+          new Sound2(self);
+          if (self._webAudio) {
+            loadBuffer(self);
+          }
+          return self;
+        },
+        /**
+         * Play a sound or resume previous playback.
+         * @param  {String/Number} sprite   Sprite name for sprite playback or sound id to continue previous.
+         * @param  {Boolean} internal Internal Use: true prevents event firing.
+         * @return {Number}          Sound ID.
+         */
+        play: function(sprite, internal) {
+          var self = this;
+          var id = null;
+          if (typeof sprite === "number") {
+            id = sprite;
+            sprite = null;
+          } else if (typeof sprite === "string" && self._state === "loaded" && !self._sprite[sprite]) {
+            return null;
+          } else if (typeof sprite === "undefined") {
+            sprite = "__default";
+            if (!self._playLock) {
+              var num = 0;
+              for (var i = 0; i < self._sounds.length; i++) {
+                if (self._sounds[i]._paused && !self._sounds[i]._ended) {
+                  num++;
+                  id = self._sounds[i]._id;
+                }
+              }
+              if (num === 1) {
+                sprite = null;
+              } else {
+                id = null;
+              }
+            }
+          }
+          var sound = id ? self._soundById(id) : self._inactiveSound();
+          if (!sound) {
+            return null;
+          }
+          if (id && !sprite) {
+            sprite = sound._sprite || "__default";
+          }
+          if (self._state !== "loaded") {
+            sound._sprite = sprite;
+            sound._ended = false;
+            var soundId = sound._id;
+            self._queue.push({
+              event: "play",
+              action: function() {
+                self.play(soundId);
+              }
+            });
+            return soundId;
+          }
+          if (id && !sound._paused) {
+            if (!internal) {
+              self._loadQueue("play");
+            }
+            return sound._id;
+          }
+          if (self._webAudio) {
+            Howler2._autoResume();
+          }
+          var seek = Math.max(0, sound._seek > 0 ? sound._seek : self._sprite[sprite][0] / 1e3);
+          var duration = Math.max(0, (self._sprite[sprite][0] + self._sprite[sprite][1]) / 1e3 - seek);
+          var timeout = duration * 1e3 / Math.abs(sound._rate);
+          var start = self._sprite[sprite][0] / 1e3;
+          var stop = (self._sprite[sprite][0] + self._sprite[sprite][1]) / 1e3;
+          sound._sprite = sprite;
+          sound._ended = false;
+          var setParams = function() {
+            sound._paused = false;
+            sound._seek = seek;
+            sound._start = start;
+            sound._stop = stop;
+            sound._loop = !!(sound._loop || self._sprite[sprite][2]);
+          };
+          if (seek >= stop) {
+            self._ended(sound);
+            return;
+          }
+          var node = sound._node;
+          if (self._webAudio) {
+            var playWebAudio = function() {
+              self._playLock = false;
+              setParams();
+              self._refreshBuffer(sound);
+              var vol = sound._muted || self._muted ? 0 : sound._volume;
+              node.gain.setValueAtTime(vol, Howler2.ctx.currentTime);
+              sound._playStart = Howler2.ctx.currentTime;
+              if (typeof node.bufferSource.start === "undefined") {
+                sound._loop ? node.bufferSource.noteGrainOn(0, seek, 86400) : node.bufferSource.noteGrainOn(0, seek, duration);
+              } else {
+                sound._loop ? node.bufferSource.start(0, seek, 86400) : node.bufferSource.start(0, seek, duration);
+              }
+              if (timeout !== Infinity) {
+                self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
+              }
+              if (!internal) {
+                setTimeout(function() {
+                  self._emit("play", sound._id);
+                  self._loadQueue();
+                }, 0);
+              }
+            };
+            if (Howler2.state === "running" && Howler2.ctx.state !== "interrupted") {
+              playWebAudio();
+            } else {
+              self._playLock = true;
+              self.once("resume", playWebAudio);
+              self._clearTimer(sound._id);
+            }
+          } else {
+            var playHtml5 = function() {
+              node.currentTime = seek;
+              node.muted = sound._muted || self._muted || Howler2._muted || node.muted;
+              node.volume = sound._volume * Howler2.volume();
+              node.playbackRate = sound._rate;
+              try {
+                var play = node.play();
+                if (play && typeof Promise !== "undefined" && (play instanceof Promise || typeof play.then === "function")) {
+                  self._playLock = true;
+                  setParams();
+                  play.then(function() {
+                    self._playLock = false;
+                    node._unlocked = true;
+                    if (!internal) {
+                      self._emit("play", sound._id);
+                    } else {
+                      self._loadQueue();
+                    }
+                  }).catch(function() {
+                    self._playLock = false;
+                    self._emit("playerror", sound._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");
+                    sound._ended = true;
+                    sound._paused = true;
+                  });
+                } else if (!internal) {
+                  self._playLock = false;
+                  setParams();
+                  self._emit("play", sound._id);
+                }
+                node.playbackRate = sound._rate;
+                if (node.paused) {
+                  self._emit("playerror", sound._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");
+                  return;
+                }
+                if (sprite !== "__default" || sound._loop) {
+                  self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
+                } else {
+                  self._endTimers[sound._id] = function() {
+                    self._ended(sound);
+                    node.removeEventListener("ended", self._endTimers[sound._id], false);
+                  };
+                  node.addEventListener("ended", self._endTimers[sound._id], false);
+                }
+              } catch (err) {
+                self._emit("playerror", sound._id, err);
+              }
+            };
+            if (node.src === "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA") {
+              node.src = self._src;
+              node.load();
+            }
+            var loadedNoReadyState = window && window.ejecta || !node.readyState && Howler2._navigator.isCocoonJS;
+            if (node.readyState >= 3 || loadedNoReadyState) {
+              playHtml5();
+            } else {
+              self._playLock = true;
+              self._state = "loading";
+              var listener = function() {
+                self._state = "loaded";
+                playHtml5();
+                node.removeEventListener(Howler2._canPlayEvent, listener, false);
+              };
+              node.addEventListener(Howler2._canPlayEvent, listener, false);
+              self._clearTimer(sound._id);
+            }
+          }
+          return sound._id;
+        },
+        /**
+         * Pause playback and save current position.
+         * @param  {Number} id The sound ID (empty to pause all in group).
+         * @return {Howl}
+         */
+        pause: function(id) {
+          var self = this;
+          if (self._state !== "loaded" || self._playLock) {
+            self._queue.push({
+              event: "pause",
+              action: function() {
+                self.pause(id);
+              }
+            });
+            return self;
+          }
+          var ids = self._getSoundIds(id);
+          for (var i = 0; i < ids.length; i++) {
+            self._clearTimer(ids[i]);
+            var sound = self._soundById(ids[i]);
+            if (sound && !sound._paused) {
+              sound._seek = self.seek(ids[i]);
+              sound._rateSeek = 0;
+              sound._paused = true;
+              self._stopFade(ids[i]);
+              if (sound._node) {
+                if (self._webAudio) {
+                  if (!sound._node.bufferSource) {
+                    continue;
+                  }
+                  if (typeof sound._node.bufferSource.stop === "undefined") {
+                    sound._node.bufferSource.noteOff(0);
+                  } else {
+                    sound._node.bufferSource.stop(0);
+                  }
+                  self._cleanBuffer(sound._node);
+                } else if (!isNaN(sound._node.duration) || sound._node.duration === Infinity) {
+                  sound._node.pause();
+                }
+              }
+            }
+            if (!arguments[1]) {
+              self._emit("pause", sound ? sound._id : null);
+            }
+          }
+          return self;
+        },
+        /**
+         * Stop playback and reset to start.
+         * @param  {Number} id The sound ID (empty to stop all in group).
+         * @param  {Boolean} internal Internal Use: true prevents event firing.
+         * @return {Howl}
+         */
+        stop: function(id, internal) {
+          var self = this;
+          if (self._state !== "loaded" || self._playLock) {
+            self._queue.push({
+              event: "stop",
+              action: function() {
+                self.stop(id);
+              }
+            });
+            return self;
+          }
+          var ids = self._getSoundIds(id);
+          for (var i = 0; i < ids.length; i++) {
+            self._clearTimer(ids[i]);
+            var sound = self._soundById(ids[i]);
+            if (sound) {
+              sound._seek = sound._start || 0;
+              sound._rateSeek = 0;
+              sound._paused = true;
+              sound._ended = true;
+              self._stopFade(ids[i]);
+              if (sound._node) {
+                if (self._webAudio) {
+                  if (sound._node.bufferSource) {
+                    if (typeof sound._node.bufferSource.stop === "undefined") {
+                      sound._node.bufferSource.noteOff(0);
+                    } else {
+                      sound._node.bufferSource.stop(0);
+                    }
+                    self._cleanBuffer(sound._node);
+                  }
+                } else if (!isNaN(sound._node.duration) || sound._node.duration === Infinity) {
+                  sound._node.currentTime = sound._start || 0;
+                  sound._node.pause();
+                  if (sound._node.duration === Infinity) {
+                    self._clearSound(sound._node);
+                  }
+                }
+              }
+              if (!internal) {
+                self._emit("stop", sound._id);
+              }
+            }
+          }
+          return self;
+        },
+        /**
+         * Mute/unmute a single sound or all sounds in this Howl group.
+         * @param  {Boolean} muted Set to true to mute and false to unmute.
+         * @param  {Number} id    The sound ID to update (omit to mute/unmute all).
+         * @return {Howl}
+         */
+        mute: function(muted, id) {
+          var self = this;
+          if (self._state !== "loaded" || self._playLock) {
+            self._queue.push({
+              event: "mute",
+              action: function() {
+                self.mute(muted, id);
+              }
+            });
+            return self;
+          }
+          if (typeof id === "undefined") {
+            if (typeof muted === "boolean") {
+              self._muted = muted;
+            } else {
+              return self._muted;
+            }
+          }
+          var ids = self._getSoundIds(id);
+          for (var i = 0; i < ids.length; i++) {
+            var sound = self._soundById(ids[i]);
+            if (sound) {
+              sound._muted = muted;
+              if (sound._interval) {
+                self._stopFade(sound._id);
+              }
+              if (self._webAudio && sound._node) {
+                sound._node.gain.setValueAtTime(muted ? 0 : sound._volume, Howler2.ctx.currentTime);
+              } else if (sound._node) {
+                sound._node.muted = Howler2._muted ? true : muted;
+              }
+              self._emit("mute", sound._id);
+            }
+          }
+          return self;
+        },
+        /**
+         * Get/set the volume of this sound or of the Howl group. This method can optionally take 0, 1 or 2 arguments.
+         *   volume() -> Returns the group's volume value.
+         *   volume(id) -> Returns the sound id's current volume.
+         *   volume(vol) -> Sets the volume of all sounds in this Howl group.
+         *   volume(vol, id) -> Sets the volume of passed sound id.
+         * @return {Howl/Number} Returns self or current volume.
+         */
+        volume: function() {
+          var self = this;
+          var args = arguments;
+          var vol, id;
+          if (args.length === 0) {
+            return self._volume;
+          } else if (args.length === 1 || args.length === 2 && typeof args[1] === "undefined") {
+            var ids = self._getSoundIds();
+            var index = ids.indexOf(args[0]);
+            if (index >= 0) {
+              id = parseInt(args[0], 10);
+            } else {
+              vol = parseFloat(args[0]);
+            }
+          } else if (args.length >= 2) {
+            vol = parseFloat(args[0]);
+            id = parseInt(args[1], 10);
+          }
+          var sound;
+          if (typeof vol !== "undefined" && vol >= 0 && vol <= 1) {
+            if (self._state !== "loaded" || self._playLock) {
+              self._queue.push({
+                event: "volume",
+                action: function() {
+                  self.volume.apply(self, args);
+                }
+              });
+              return self;
+            }
+            if (typeof id === "undefined") {
+              self._volume = vol;
+            }
+            id = self._getSoundIds(id);
+            for (var i = 0; i < id.length; i++) {
+              sound = self._soundById(id[i]);
+              if (sound) {
+                sound._volume = vol;
+                if (!args[2]) {
+                  self._stopFade(id[i]);
+                }
+                if (self._webAudio && sound._node && !sound._muted) {
+                  sound._node.gain.setValueAtTime(vol, Howler2.ctx.currentTime);
+                } else if (sound._node && !sound._muted) {
+                  sound._node.volume = vol * Howler2.volume();
+                }
+                self._emit("volume", sound._id);
+              }
+            }
+          } else {
+            sound = id ? self._soundById(id) : self._sounds[0];
+            return sound ? sound._volume : 0;
+          }
+          return self;
+        },
+        /**
+         * Fade a currently playing sound between two volumes (if no id is passed, all sounds will fade).
+         * @param  {Number} from The value to fade from (0.0 to 1.0).
+         * @param  {Number} to   The volume to fade to (0.0 to 1.0).
+         * @param  {Number} len  Time in milliseconds to fade.
+         * @param  {Number} id   The sound id (omit to fade all sounds).
+         * @return {Howl}
+         */
+        fade: function(from, to, len, id) {
+          var self = this;
+          if (self._state !== "loaded" || self._playLock) {
+            self._queue.push({
+              event: "fade",
+              action: function() {
+                self.fade(from, to, len, id);
+              }
+            });
+            return self;
+          }
+          from = Math.min(Math.max(0, parseFloat(from)), 1);
+          to = Math.min(Math.max(0, parseFloat(to)), 1);
+          len = parseFloat(len);
+          self.volume(from, id);
+          var ids = self._getSoundIds(id);
+          for (var i = 0; i < ids.length; i++) {
+            var sound = self._soundById(ids[i]);
+            if (sound) {
+              if (!id) {
+                self._stopFade(ids[i]);
+              }
+              if (self._webAudio && !sound._muted) {
+                var currentTime = Howler2.ctx.currentTime;
+                var end = currentTime + len / 1e3;
+                sound._volume = from;
+                sound._node.gain.setValueAtTime(from, currentTime);
+                sound._node.gain.linearRampToValueAtTime(to, end);
+              }
+              self._startFadeInterval(sound, from, to, len, ids[i], typeof id === "undefined");
+            }
+          }
+          return self;
+        },
+        /**
+         * Starts the internal interval to fade a sound.
+         * @param  {Object} sound Reference to sound to fade.
+         * @param  {Number} from The value to fade from (0.0 to 1.0).
+         * @param  {Number} to   The volume to fade to (0.0 to 1.0).
+         * @param  {Number} len  Time in milliseconds to fade.
+         * @param  {Number} id   The sound id to fade.
+         * @param  {Boolean} isGroup   If true, set the volume on the group.
+         */
+        _startFadeInterval: function(sound, from, to, len, id, isGroup) {
+          var self = this;
+          var vol = from;
+          var diff = to - from;
+          var steps = Math.abs(diff / 0.01);
+          var stepLen = Math.max(4, steps > 0 ? len / steps : len);
+          var lastTick = Date.now();
+          sound._fadeTo = to;
+          sound._interval = setInterval(function() {
+            var tick = (Date.now() - lastTick) / len;
+            lastTick = Date.now();
+            vol += diff * tick;
+            vol = Math.round(vol * 100) / 100;
+            if (diff < 0) {
+              vol = Math.max(to, vol);
+            } else {
+              vol = Math.min(to, vol);
+            }
+            if (self._webAudio) {
+              sound._volume = vol;
+            } else {
+              self.volume(vol, sound._id, true);
+            }
+            if (isGroup) {
+              self._volume = vol;
+            }
+            if (to < from && vol <= to || to > from && vol >= to) {
+              clearInterval(sound._interval);
+              sound._interval = null;
+              sound._fadeTo = null;
+              self.volume(to, sound._id);
+              self._emit("fade", sound._id);
+            }
+          }, stepLen);
+        },
+        /**
+         * Internal method that stops the currently playing fade when
+         * a new fade starts, volume is changed or the sound is stopped.
+         * @param  {Number} id The sound id.
+         * @return {Howl}
+         */
+        _stopFade: function(id) {
+          var self = this;
+          var sound = self._soundById(id);
+          if (sound && sound._interval) {
+            if (self._webAudio) {
+              sound._node.gain.cancelScheduledValues(Howler2.ctx.currentTime);
+            }
+            clearInterval(sound._interval);
+            sound._interval = null;
+            self.volume(sound._fadeTo, id);
+            sound._fadeTo = null;
+            self._emit("fade", id);
+          }
+          return self;
+        },
+        /**
+         * Get/set the loop parameter on a sound. This method can optionally take 0, 1 or 2 arguments.
+         *   loop() -> Returns the group's loop value.
+         *   loop(id) -> Returns the sound id's loop value.
+         *   loop(loop) -> Sets the loop value for all sounds in this Howl group.
+         *   loop(loop, id) -> Sets the loop value of passed sound id.
+         * @return {Howl/Boolean} Returns self or current loop value.
+         */
+        loop: function() {
+          var self = this;
+          var args = arguments;
+          var loop, id, sound;
+          if (args.length === 0) {
+            return self._loop;
+          } else if (args.length === 1) {
+            if (typeof args[0] === "boolean") {
+              loop = args[0];
+              self._loop = loop;
+            } else {
+              sound = self._soundById(parseInt(args[0], 10));
+              return sound ? sound._loop : false;
+            }
+          } else if (args.length === 2) {
+            loop = args[0];
+            id = parseInt(args[1], 10);
+          }
+          var ids = self._getSoundIds(id);
+          for (var i = 0; i < ids.length; i++) {
+            sound = self._soundById(ids[i]);
+            if (sound) {
+              sound._loop = loop;
+              if (self._webAudio && sound._node && sound._node.bufferSource) {
+                sound._node.bufferSource.loop = loop;
+                if (loop) {
+                  sound._node.bufferSource.loopStart = sound._start || 0;
+                  sound._node.bufferSource.loopEnd = sound._stop;
+                  if (self.playing(ids[i])) {
+                    self.pause(ids[i], true);
+                    self.play(ids[i], true);
+                  }
+                }
+              }
+            }
+          }
+          return self;
+        },
+        /**
+         * Get/set the playback rate of a sound. This method can optionally take 0, 1 or 2 arguments.
+         *   rate() -> Returns the first sound node's current playback rate.
+         *   rate(id) -> Returns the sound id's current playback rate.
+         *   rate(rate) -> Sets the playback rate of all sounds in this Howl group.
+         *   rate(rate, id) -> Sets the playback rate of passed sound id.
+         * @return {Howl/Number} Returns self or the current playback rate.
+         */
+        rate: function() {
+          var self = this;
+          var args = arguments;
+          var rate, id;
+          if (args.length === 0) {
+            id = self._sounds[0]._id;
+          } else if (args.length === 1) {
+            var ids = self._getSoundIds();
+            var index = ids.indexOf(args[0]);
+            if (index >= 0) {
+              id = parseInt(args[0], 10);
+            } else {
+              rate = parseFloat(args[0]);
+            }
+          } else if (args.length === 2) {
+            rate = parseFloat(args[0]);
+            id = parseInt(args[1], 10);
+          }
+          var sound;
+          if (typeof rate === "number") {
+            if (self._state !== "loaded" || self._playLock) {
+              self._queue.push({
+                event: "rate",
+                action: function() {
+                  self.rate.apply(self, args);
+                }
+              });
+              return self;
+            }
+            if (typeof id === "undefined") {
+              self._rate = rate;
+            }
+            id = self._getSoundIds(id);
+            for (var i = 0; i < id.length; i++) {
+              sound = self._soundById(id[i]);
+              if (sound) {
+                if (self.playing(id[i])) {
+                  sound._rateSeek = self.seek(id[i]);
+                  sound._playStart = self._webAudio ? Howler2.ctx.currentTime : sound._playStart;
+                }
+                sound._rate = rate;
+                if (self._webAudio && sound._node && sound._node.bufferSource) {
+                  sound._node.bufferSource.playbackRate.setValueAtTime(rate, Howler2.ctx.currentTime);
+                } else if (sound._node) {
+                  sound._node.playbackRate = rate;
+                }
+                var seek = self.seek(id[i]);
+                var duration = (self._sprite[sound._sprite][0] + self._sprite[sound._sprite][1]) / 1e3 - seek;
+                var timeout = duration * 1e3 / Math.abs(sound._rate);
+                if (self._endTimers[id[i]] || !sound._paused) {
+                  self._clearTimer(id[i]);
+                  self._endTimers[id[i]] = setTimeout(self._ended.bind(self, sound), timeout);
+                }
+                self._emit("rate", sound._id);
+              }
+            }
+          } else {
+            sound = self._soundById(id);
+            return sound ? sound._rate : self._rate;
+          }
+          return self;
+        },
+        /**
+         * Get/set the seek position of a sound. This method can optionally take 0, 1 or 2 arguments.
+         *   seek() -> Returns the first sound node's current seek position.
+         *   seek(id) -> Returns the sound id's current seek position.
+         *   seek(seek) -> Sets the seek position of the first sound node.
+         *   seek(seek, id) -> Sets the seek position of passed sound id.
+         * @return {Howl/Number} Returns self or the current seek position.
+         */
+        seek: function() {
+          var self = this;
+          var args = arguments;
+          var seek, id;
+          if (args.length === 0) {
+            if (self._sounds.length) {
+              id = self._sounds[0]._id;
+            }
+          } else if (args.length === 1) {
+            var ids = self._getSoundIds();
+            var index = ids.indexOf(args[0]);
+            if (index >= 0) {
+              id = parseInt(args[0], 10);
+            } else if (self._sounds.length) {
+              id = self._sounds[0]._id;
+              seek = parseFloat(args[0]);
+            }
+          } else if (args.length === 2) {
+            seek = parseFloat(args[0]);
+            id = parseInt(args[1], 10);
+          }
+          if (typeof id === "undefined") {
+            return 0;
+          }
+          if (typeof seek === "number" && (self._state !== "loaded" || self._playLock)) {
+            self._queue.push({
+              event: "seek",
+              action: function() {
+                self.seek.apply(self, args);
+              }
+            });
+            return self;
+          }
+          var sound = self._soundById(id);
+          if (sound) {
+            if (typeof seek === "number" && seek >= 0) {
+              var playing = self.playing(id);
+              if (playing) {
+                self.pause(id, true);
+              }
+              sound._seek = seek;
+              sound._ended = false;
+              self._clearTimer(id);
+              if (!self._webAudio && sound._node && !isNaN(sound._node.duration)) {
+                sound._node.currentTime = seek;
+              }
+              var seekAndEmit = function() {
+                if (playing) {
+                  self.play(id, true);
+                }
+                self._emit("seek", id);
+              };
+              if (playing && !self._webAudio) {
+                var emitSeek = function() {
+                  if (!self._playLock) {
+                    seekAndEmit();
+                  } else {
+                    setTimeout(emitSeek, 0);
+                  }
+                };
+                setTimeout(emitSeek, 0);
+              } else {
+                seekAndEmit();
+              }
+            } else {
+              if (self._webAudio) {
+                var realTime = self.playing(id) ? Howler2.ctx.currentTime - sound._playStart : 0;
+                var rateSeek = sound._rateSeek ? sound._rateSeek - sound._seek : 0;
+                return sound._seek + (rateSeek + realTime * Math.abs(sound._rate));
+              } else {
+                return sound._node.currentTime;
+              }
+            }
+          }
+          return self;
+        },
+        /**
+         * Check if a specific sound is currently playing or not (if id is provided), or check if at least one of the sounds in the group is playing or not.
+         * @param  {Number}  id The sound id to check. If none is passed, the whole sound group is checked.
+         * @return {Boolean} True if playing and false if not.
+         */
+        playing: function(id) {
+          var self = this;
+          if (typeof id === "number") {
+            var sound = self._soundById(id);
+            return sound ? !sound._paused : false;
+          }
+          for (var i = 0; i < self._sounds.length; i++) {
+            if (!self._sounds[i]._paused) {
+              return true;
+            }
+          }
+          return false;
+        },
+        /**
+         * Get the duration of this sound. Passing a sound id will return the sprite duration.
+         * @param  {Number} id The sound id to check. If none is passed, return full source duration.
+         * @return {Number} Audio duration in seconds.
+         */
+        duration: function(id) {
+          var self = this;
+          var duration = self._duration;
+          var sound = self._soundById(id);
+          if (sound) {
+            duration = self._sprite[sound._sprite][1] / 1e3;
+          }
+          return duration;
+        },
+        /**
+         * Returns the current loaded state of this Howl.
+         * @return {String} 'unloaded', 'loading', 'loaded'
+         */
+        state: function() {
+          return this._state;
+        },
+        /**
+         * Unload and destroy the current Howl object.
+         * This will immediately stop all sound instances attached to this group.
+         */
+        unload: function() {
+          var self = this;
+          var sounds = self._sounds;
+          for (var i = 0; i < sounds.length; i++) {
+            if (!sounds[i]._paused) {
+              self.stop(sounds[i]._id);
+            }
+            if (!self._webAudio) {
+              self._clearSound(sounds[i]._node);
+              sounds[i]._node.removeEventListener("error", sounds[i]._errorFn, false);
+              sounds[i]._node.removeEventListener(Howler2._canPlayEvent, sounds[i]._loadFn, false);
+              sounds[i]._node.removeEventListener("ended", sounds[i]._endFn, false);
+              Howler2._releaseHtml5Audio(sounds[i]._node);
+            }
+            delete sounds[i]._node;
+            self._clearTimer(sounds[i]._id);
+          }
+          var index = Howler2._howls.indexOf(self);
+          if (index >= 0) {
+            Howler2._howls.splice(index, 1);
+          }
+          var remCache = true;
+          for (i = 0; i < Howler2._howls.length; i++) {
+            if (Howler2._howls[i]._src === self._src || self._src.indexOf(Howler2._howls[i]._src) >= 0) {
+              remCache = false;
+              break;
+            }
+          }
+          if (cache && remCache) {
+            delete cache[self._src];
+          }
+          Howler2.noAudio = false;
+          self._state = "unloaded";
+          self._sounds = [];
+          self = null;
+          return null;
+        },
+        /**
+         * Listen to a custom event.
+         * @param  {String}   event Event name.
+         * @param  {Function} fn    Listener to call.
+         * @param  {Number}   id    (optional) Only listen to events for this sound.
+         * @param  {Number}   once  (INTERNAL) Marks event to fire only once.
+         * @return {Howl}
+         */
+        on: function(event, fn, id, once) {
+          var self = this;
+          var events = self["_on" + event];
+          if (typeof fn === "function") {
+            events.push(once ? { id, fn, once } : { id, fn });
+          }
+          return self;
+        },
+        /**
+         * Remove a custom event. Call without parameters to remove all events.
+         * @param  {String}   event Event name.
+         * @param  {Function} fn    Listener to remove. Leave empty to remove all.
+         * @param  {Number}   id    (optional) Only remove events for this sound.
+         * @return {Howl}
+         */
+        off: function(event, fn, id) {
+          var self = this;
+          var events = self["_on" + event];
+          var i = 0;
+          if (typeof fn === "number") {
+            id = fn;
+            fn = null;
+          }
+          if (fn || id) {
+            for (i = 0; i < events.length; i++) {
+              var isId = id === events[i].id;
+              if (fn === events[i].fn && isId || !fn && isId) {
+                events.splice(i, 1);
+                break;
+              }
+            }
+          } else if (event) {
+            self["_on" + event] = [];
+          } else {
+            var keys = Object.keys(self);
+            for (i = 0; i < keys.length; i++) {
+              if (keys[i].indexOf("_on") === 0 && Array.isArray(self[keys[i]])) {
+                self[keys[i]] = [];
+              }
+            }
+          }
+          return self;
+        },
+        /**
+         * Listen to a custom event and remove it once fired.
+         * @param  {String}   event Event name.
+         * @param  {Function} fn    Listener to call.
+         * @param  {Number}   id    (optional) Only listen to events for this sound.
+         * @return {Howl}
+         */
+        once: function(event, fn, id) {
+          var self = this;
+          self.on(event, fn, id, 1);
+          return self;
+        },
+        /**
+         * Emit all events of a specific type and pass the sound id.
+         * @param  {String} event Event name.
+         * @param  {Number} id    Sound ID.
+         * @param  {Number} msg   Message to go with event.
+         * @return {Howl}
+         */
+        _emit: function(event, id, msg) {
+          var self = this;
+          var events = self["_on" + event];
+          for (var i = events.length - 1; i >= 0; i--) {
+            if (!events[i].id || events[i].id === id || event === "load") {
+              setTimeout((function(fn) {
+                fn.call(this, id, msg);
+              }).bind(self, events[i].fn), 0);
+              if (events[i].once) {
+                self.off(event, events[i].fn, events[i].id);
+              }
+            }
+          }
+          self._loadQueue(event);
+          return self;
+        },
+        /**
+         * Queue of actions initiated before the sound has loaded.
+         * These will be called in sequence, with the next only firing
+         * after the previous has finished executing (even if async like play).
+         * @return {Howl}
+         */
+        _loadQueue: function(event) {
+          var self = this;
+          if (self._queue.length > 0) {
+            var task = self._queue[0];
+            if (task.event === event) {
+              self._queue.shift();
+              self._loadQueue();
+            }
+            if (!event) {
+              task.action();
+            }
+          }
+          return self;
+        },
+        /**
+         * Fired when playback ends at the end of the duration.
+         * @param  {Sound} sound The sound object to work with.
+         * @return {Howl}
+         */
+        _ended: function(sound) {
+          var self = this;
+          var sprite = sound._sprite;
+          if (!self._webAudio && sound._node && !sound._node.paused && !sound._node.ended && sound._node.currentTime < sound._stop) {
+            setTimeout(self._ended.bind(self, sound), 100);
+            return self;
+          }
+          var loop = !!(sound._loop || self._sprite[sprite][2]);
+          self._emit("end", sound._id);
+          if (!self._webAudio && loop) {
+            self.stop(sound._id, true).play(sound._id);
+          }
+          if (self._webAudio && loop) {
+            self._emit("play", sound._id);
+            sound._seek = sound._start || 0;
+            sound._rateSeek = 0;
+            sound._playStart = Howler2.ctx.currentTime;
+            var timeout = (sound._stop - sound._start) * 1e3 / Math.abs(sound._rate);
+            self._endTimers[sound._id] = setTimeout(self._ended.bind(self, sound), timeout);
+          }
+          if (self._webAudio && !loop) {
+            sound._paused = true;
+            sound._ended = true;
+            sound._seek = sound._start || 0;
+            sound._rateSeek = 0;
+            self._clearTimer(sound._id);
+            self._cleanBuffer(sound._node);
+            Howler2._autoSuspend();
+          }
+          if (!self._webAudio && !loop) {
+            self.stop(sound._id, true);
+          }
+          return self;
+        },
+        /**
+         * Clear the end timer for a sound playback.
+         * @param  {Number} id The sound ID.
+         * @return {Howl}
+         */
+        _clearTimer: function(id) {
+          var self = this;
+          if (self._endTimers[id]) {
+            if (typeof self._endTimers[id] !== "function") {
+              clearTimeout(self._endTimers[id]);
+            } else {
+              var sound = self._soundById(id);
+              if (sound && sound._node) {
+                sound._node.removeEventListener("ended", self._endTimers[id], false);
+              }
+            }
+            delete self._endTimers[id];
+          }
+          return self;
+        },
+        /**
+         * Return the sound identified by this ID, or return null.
+         * @param  {Number} id Sound ID
+         * @return {Object}    Sound object or null.
+         */
+        _soundById: function(id) {
+          var self = this;
+          for (var i = 0; i < self._sounds.length; i++) {
+            if (id === self._sounds[i]._id) {
+              return self._sounds[i];
+            }
+          }
+          return null;
+        },
+        /**
+         * Return an inactive sound from the pool or create a new one.
+         * @return {Sound} Sound playback object.
+         */
+        _inactiveSound: function() {
+          var self = this;
+          self._drain();
+          for (var i = 0; i < self._sounds.length; i++) {
+            if (self._sounds[i]._ended) {
+              return self._sounds[i].reset();
+            }
+          }
+          return new Sound2(self);
+        },
+        /**
+         * Drain excess inactive sounds from the pool.
+         */
+        _drain: function() {
+          var self = this;
+          var limit = self._pool;
+          var cnt = 0;
+          var i = 0;
+          if (self._sounds.length < limit) {
+            return;
+          }
+          for (i = 0; i < self._sounds.length; i++) {
+            if (self._sounds[i]._ended) {
+              cnt++;
+            }
+          }
+          for (i = self._sounds.length - 1; i >= 0; i--) {
+            if (cnt <= limit) {
+              return;
+            }
+            if (self._sounds[i]._ended) {
+              if (self._webAudio && self._sounds[i]._node) {
+                self._sounds[i]._node.disconnect(0);
+              }
+              self._sounds.splice(i, 1);
+              cnt--;
+            }
+          }
+        },
+        /**
+         * Get all ID's from the sounds pool.
+         * @param  {Number} id Only return one ID if one is passed.
+         * @return {Array}    Array of IDs.
+         */
+        _getSoundIds: function(id) {
+          var self = this;
+          if (typeof id === "undefined") {
+            var ids = [];
+            for (var i = 0; i < self._sounds.length; i++) {
+              ids.push(self._sounds[i]._id);
+            }
+            return ids;
+          } else {
+            return [id];
+          }
+        },
+        /**
+         * Load the sound back into the buffer source.
+         * @param  {Sound} sound The sound object to work with.
+         * @return {Howl}
+         */
+        _refreshBuffer: function(sound) {
+          var self = this;
+          sound._node.bufferSource = Howler2.ctx.createBufferSource();
+          sound._node.bufferSource.buffer = cache[self._src];
+          if (sound._panner) {
+            sound._node.bufferSource.connect(sound._panner);
+          } else {
+            sound._node.bufferSource.connect(sound._node);
+          }
+          sound._node.bufferSource.loop = sound._loop;
+          if (sound._loop) {
+            sound._node.bufferSource.loopStart = sound._start || 0;
+            sound._node.bufferSource.loopEnd = sound._stop || 0;
+          }
+          sound._node.bufferSource.playbackRate.setValueAtTime(sound._rate, Howler2.ctx.currentTime);
+          return self;
+        },
+        /**
+         * Prevent memory leaks by cleaning up the buffer source after playback.
+         * @param  {Object} node Sound's audio node containing the buffer source.
+         * @return {Howl}
+         */
+        _cleanBuffer: function(node) {
+          var self = this;
+          var isIOS = Howler2._navigator && Howler2._navigator.vendor.indexOf("Apple") >= 0;
+          if (!node.bufferSource) {
+            return self;
+          }
+          if (Howler2._scratchBuffer && node.bufferSource) {
+            node.bufferSource.onended = null;
+            node.bufferSource.disconnect(0);
+            if (isIOS) {
+              try {
+                node.bufferSource.buffer = Howler2._scratchBuffer;
+              } catch (e) {
+              }
+            }
+          }
+          node.bufferSource = null;
+          return self;
+        },
+        /**
+         * Set the source to a 0-second silence to stop any downloading (except in IE).
+         * @param  {Object} node Audio node to clear.
+         */
+        _clearSound: function(node) {
+          var checkIE = /MSIE |Trident\//.test(Howler2._navigator && Howler2._navigator.userAgent);
+          if (!checkIE) {
+            node.src = "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA";
+          }
+        }
+      };
+      var Sound2 = function(howl) {
+        this._parent = howl;
+        this.init();
+      };
+      Sound2.prototype = {
+        /**
+         * Initialize a new Sound object.
+         * @return {Sound}
+         */
+        init: function() {
+          var self = this;
+          var parent = self._parent;
+          self._muted = parent._muted;
+          self._loop = parent._loop;
+          self._volume = parent._volume;
+          self._rate = parent._rate;
+          self._seek = 0;
+          self._paused = true;
+          self._ended = true;
+          self._sprite = "__default";
+          self._id = ++Howler2._counter;
+          parent._sounds.push(self);
+          self.create();
+          return self;
+        },
+        /**
+         * Create and setup a new sound object, whether HTML5 Audio or Web Audio.
+         * @return {Sound}
+         */
+        create: function() {
+          var self = this;
+          var parent = self._parent;
+          var volume = Howler2._muted || self._muted || self._parent._muted ? 0 : self._volume;
+          if (parent._webAudio) {
+            self._node = typeof Howler2.ctx.createGain === "undefined" ? Howler2.ctx.createGainNode() : Howler2.ctx.createGain();
+            self._node.gain.setValueAtTime(volume, Howler2.ctx.currentTime);
+            self._node.paused = true;
+            self._node.connect(Howler2.masterGain);
+          } else if (!Howler2.noAudio) {
+            self._node = Howler2._obtainHtml5Audio();
+            self._errorFn = self._errorListener.bind(self);
+            self._node.addEventListener("error", self._errorFn, false);
+            self._loadFn = self._loadListener.bind(self);
+            self._node.addEventListener(Howler2._canPlayEvent, self._loadFn, false);
+            self._endFn = self._endListener.bind(self);
+            self._node.addEventListener("ended", self._endFn, false);
+            self._node.src = parent._src;
+            self._node.preload = parent._preload === true ? "auto" : parent._preload;
+            self._node.volume = volume * Howler2.volume();
+            self._node.load();
+          }
+          return self;
+        },
+        /**
+         * Reset the parameters of this sound to the original state (for recycle).
+         * @return {Sound}
+         */
+        reset: function() {
+          var self = this;
+          var parent = self._parent;
+          self._muted = parent._muted;
+          self._loop = parent._loop;
+          self._volume = parent._volume;
+          self._rate = parent._rate;
+          self._seek = 0;
+          self._rateSeek = 0;
+          self._paused = true;
+          self._ended = true;
+          self._sprite = "__default";
+          self._id = ++Howler2._counter;
+          return self;
+        },
+        /**
+         * HTML5 Audio error listener callback.
+         */
+        _errorListener: function() {
+          var self = this;
+          self._parent._emit("loaderror", self._id, self._node.error ? self._node.error.code : 0);
+          self._node.removeEventListener("error", self._errorFn, false);
+        },
+        /**
+         * HTML5 Audio canplaythrough listener callback.
+         */
+        _loadListener: function() {
+          var self = this;
+          var parent = self._parent;
+          parent._duration = Math.ceil(self._node.duration * 10) / 10;
+          if (Object.keys(parent._sprite).length === 0) {
+            parent._sprite = { __default: [0, parent._duration * 1e3] };
+          }
+          if (parent._state !== "loaded") {
+            parent._state = "loaded";
+            parent._emit("load");
+            parent._loadQueue();
+          }
+          self._node.removeEventListener(Howler2._canPlayEvent, self._loadFn, false);
+        },
+        /**
+         * HTML5 Audio ended listener callback.
+         */
+        _endListener: function() {
+          var self = this;
+          var parent = self._parent;
+          if (parent._duration === Infinity) {
+            parent._duration = Math.ceil(self._node.duration * 10) / 10;
+            if (parent._sprite.__default[1] === Infinity) {
+              parent._sprite.__default[1] = parent._duration * 1e3;
+            }
+            parent._ended(self);
+          }
+          self._node.removeEventListener("ended", self._endFn, false);
+        }
+      };
+      var cache = {};
+      var loadBuffer = function(self) {
+        var url = self._src;
+        if (cache[url]) {
+          self._duration = cache[url].duration;
+          loadSound(self);
+          return;
+        }
+        if (/^data:[^;]+;base64,/.test(url)) {
+          var data = atob(url.split(",")[1]);
+          var dataView = new Uint8Array(data.length);
+          for (var i = 0; i < data.length; ++i) {
+            dataView[i] = data.charCodeAt(i);
+          }
+          decodeAudioData(dataView.buffer, self);
+        } else {
+          var xhr = new XMLHttpRequest();
+          xhr.open(self._xhr.method, url, true);
+          xhr.withCredentials = self._xhr.withCredentials;
+          xhr.responseType = "arraybuffer";
+          if (self._xhr.headers) {
+            Object.keys(self._xhr.headers).forEach(function(key) {
+              xhr.setRequestHeader(key, self._xhr.headers[key]);
+            });
+          }
+          xhr.onload = function() {
+            var code = (xhr.status + "")[0];
+            if (code !== "0" && code !== "2" && code !== "3") {
+              self._emit("loaderror", null, "Failed loading audio file with status: " + xhr.status + ".");
+              return;
+            }
+            decodeAudioData(xhr.response, self);
+          };
+          xhr.onerror = function() {
+            if (self._webAudio) {
+              self._html5 = true;
+              self._webAudio = false;
+              self._sounds = [];
+              delete cache[url];
+              self.load();
+            }
+          };
+          safeXhrSend(xhr);
+        }
+      };
+      var safeXhrSend = function(xhr) {
+        try {
+          xhr.send();
+        } catch (e) {
+          xhr.onerror();
+        }
+      };
+      var decodeAudioData = function(arraybuffer, self) {
+        var error = function() {
+          self._emit("loaderror", null, "Decoding audio data failed.");
+        };
+        var success = function(buffer) {
+          if (buffer && self._sounds.length > 0) {
+            cache[self._src] = buffer;
+            loadSound(self, buffer);
+          } else {
+            error();
+          }
+        };
+        if (typeof Promise !== "undefined" && Howler2.ctx.decodeAudioData.length === 1) {
+          Howler2.ctx.decodeAudioData(arraybuffer).then(success).catch(error);
+        } else {
+          Howler2.ctx.decodeAudioData(arraybuffer, success, error);
+        }
+      };
+      var loadSound = function(self, buffer) {
+        if (buffer && !self._duration) {
+          self._duration = buffer.duration;
+        }
+        if (Object.keys(self._sprite).length === 0) {
+          self._sprite = { __default: [0, self._duration * 1e3] };
+        }
+        if (self._state !== "loaded") {
+          self._state = "loaded";
+          self._emit("load");
+          self._loadQueue();
+        }
+      };
+      var setupAudioContext = function() {
+        if (!Howler2.usingWebAudio) {
+          return;
+        }
+        try {
+          if (typeof AudioContext !== "undefined") {
+            Howler2.ctx = new AudioContext();
+          } else if (typeof webkitAudioContext !== "undefined") {
+            Howler2.ctx = new webkitAudioContext();
+          } else {
+            Howler2.usingWebAudio = false;
+          }
+        } catch (e) {
+          Howler2.usingWebAudio = false;
+        }
+        if (!Howler2.ctx) {
+          Howler2.usingWebAudio = false;
+        }
+        var iOS = /iP(hone|od|ad)/.test(Howler2._navigator && Howler2._navigator.platform);
+        var appVersion = Howler2._navigator && Howler2._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);
+        var version = appVersion ? parseInt(appVersion[1], 10) : null;
+        if (iOS && version && version < 9) {
+          var safari = /safari/.test(Howler2._navigator && Howler2._navigator.userAgent.toLowerCase());
+          if (Howler2._navigator && !safari) {
+            Howler2.usingWebAudio = false;
+          }
+        }
+        if (Howler2.usingWebAudio) {
+          Howler2.masterGain = typeof Howler2.ctx.createGain === "undefined" ? Howler2.ctx.createGainNode() : Howler2.ctx.createGain();
+          Howler2.masterGain.gain.setValueAtTime(Howler2._muted ? 0 : Howler2._volume, Howler2.ctx.currentTime);
+          Howler2.masterGain.connect(Howler2.ctx.destination);
+        }
+        Howler2._setup();
+      };
+      if (typeof define === "function" && define.amd) {
+        define([], function() {
+          return {
+            Howler: Howler2,
+            Howl: Howl2
+          };
+        });
+      }
+      if (typeof exports !== "undefined") {
+        exports.Howler = Howler2;
+        exports.Howl = Howl2;
+      }
+      if (typeof global !== "undefined") {
+        global.HowlerGlobal = HowlerGlobal2;
+        global.Howler = Howler2;
+        global.Howl = Howl2;
+        global.Sound = Sound2;
+      } else if (typeof window !== "undefined") {
+        window.HowlerGlobal = HowlerGlobal2;
+        window.Howler = Howler2;
+        window.Howl = Howl2;
+        window.Sound = Sound2;
+      }
+    })();
+    (function() {
+      "use strict";
+      HowlerGlobal.prototype._pos = [0, 0, 0];
+      HowlerGlobal.prototype._orientation = [0, 0, -1, 0, 1, 0];
+      HowlerGlobal.prototype.stereo = function(pan) {
+        var self = this;
+        if (!self.ctx || !self.ctx.listener) {
+          return self;
+        }
+        for (var i = self._howls.length - 1; i >= 0; i--) {
+          self._howls[i].stereo(pan);
+        }
+        return self;
+      };
+      HowlerGlobal.prototype.pos = function(x, y, z) {
+        var self = this;
+        if (!self.ctx || !self.ctx.listener) {
+          return self;
+        }
+        y = typeof y !== "number" ? self._pos[1] : y;
+        z = typeof z !== "number" ? self._pos[2] : z;
+        if (typeof x === "number") {
+          self._pos = [x, y, z];
+          if (typeof self.ctx.listener.positionX !== "undefined") {
+            self.ctx.listener.positionX.setTargetAtTime(self._pos[0], Howler.ctx.currentTime, 0.1);
+            self.ctx.listener.positionY.setTargetAtTime(self._pos[1], Howler.ctx.currentTime, 0.1);
+            self.ctx.listener.positionZ.setTargetAtTime(self._pos[2], Howler.ctx.currentTime, 0.1);
+          } else {
+            self.ctx.listener.setPosition(self._pos[0], self._pos[1], self._pos[2]);
+          }
+        } else {
+          return self._pos;
+        }
+        return self;
+      };
+      HowlerGlobal.prototype.orientation = function(x, y, z, xUp, yUp, zUp) {
+        var self = this;
+        if (!self.ctx || !self.ctx.listener) {
+          return self;
+        }
+        var or = self._orientation;
+        y = typeof y !== "number" ? or[1] : y;
+        z = typeof z !== "number" ? or[2] : z;
+        xUp = typeof xUp !== "number" ? or[3] : xUp;
+        yUp = typeof yUp !== "number" ? or[4] : yUp;
+        zUp = typeof zUp !== "number" ? or[5] : zUp;
+        if (typeof x === "number") {
+          self._orientation = [x, y, z, xUp, yUp, zUp];
+          if (typeof self.ctx.listener.forwardX !== "undefined") {
+            self.ctx.listener.forwardX.setTargetAtTime(x, Howler.ctx.currentTime, 0.1);
+            self.ctx.listener.forwardY.setTargetAtTime(y, Howler.ctx.currentTime, 0.1);
+            self.ctx.listener.forwardZ.setTargetAtTime(z, Howler.ctx.currentTime, 0.1);
+            self.ctx.listener.upX.setTargetAtTime(xUp, Howler.ctx.currentTime, 0.1);
+            self.ctx.listener.upY.setTargetAtTime(yUp, Howler.ctx.currentTime, 0.1);
+            self.ctx.listener.upZ.setTargetAtTime(zUp, Howler.ctx.currentTime, 0.1);
+          } else {
+            self.ctx.listener.setOrientation(x, y, z, xUp, yUp, zUp);
+          }
+        } else {
+          return or;
+        }
+        return self;
+      };
+      Howl.prototype.init = /* @__PURE__ */ function(_super) {
+        return function(o) {
+          var self = this;
+          self._orientation = o.orientation || [1, 0, 0];
+          self._stereo = o.stereo || null;
+          self._pos = o.pos || null;
+          self._pannerAttr = {
+            coneInnerAngle: typeof o.coneInnerAngle !== "undefined" ? o.coneInnerAngle : 360,
+            coneOuterAngle: typeof o.coneOuterAngle !== "undefined" ? o.coneOuterAngle : 360,
+            coneOuterGain: typeof o.coneOuterGain !== "undefined" ? o.coneOuterGain : 0,
+            distanceModel: typeof o.distanceModel !== "undefined" ? o.distanceModel : "inverse",
+            maxDistance: typeof o.maxDistance !== "undefined" ? o.maxDistance : 1e4,
+            panningModel: typeof o.panningModel !== "undefined" ? o.panningModel : "HRTF",
+            refDistance: typeof o.refDistance !== "undefined" ? o.refDistance : 1,
+            rolloffFactor: typeof o.rolloffFactor !== "undefined" ? o.rolloffFactor : 1
+          };
+          self._onstereo = o.onstereo ? [{ fn: o.onstereo }] : [];
+          self._onpos = o.onpos ? [{ fn: o.onpos }] : [];
+          self._onorientation = o.onorientation ? [{ fn: o.onorientation }] : [];
+          return _super.call(this, o);
+        };
+      }(Howl.prototype.init);
+      Howl.prototype.stereo = function(pan, id) {
+        var self = this;
+        if (!self._webAudio) {
+          return self;
+        }
+        if (self._state !== "loaded") {
+          self._queue.push({
+            event: "stereo",
+            action: function() {
+              self.stereo(pan, id);
+            }
+          });
+          return self;
+        }
+        var pannerType = typeof Howler.ctx.createStereoPanner === "undefined" ? "spatial" : "stereo";
+        if (typeof id === "undefined") {
+          if (typeof pan === "number") {
+            self._stereo = pan;
+            self._pos = [pan, 0, 0];
+          } else {
+            return self._stereo;
+          }
+        }
+        var ids = self._getSoundIds(id);
+        for (var i = 0; i < ids.length; i++) {
+          var sound = self._soundById(ids[i]);
+          if (sound) {
+            if (typeof pan === "number") {
+              sound._stereo = pan;
+              sound._pos = [pan, 0, 0];
+              if (sound._node) {
+                sound._pannerAttr.panningModel = "equalpower";
+                if (!sound._panner || !sound._panner.pan) {
+                  setupPanner(sound, pannerType);
+                }
+                if (pannerType === "spatial") {
+                  if (typeof sound._panner.positionX !== "undefined") {
+                    sound._panner.positionX.setValueAtTime(pan, Howler.ctx.currentTime);
+                    sound._panner.positionY.setValueAtTime(0, Howler.ctx.currentTime);
+                    sound._panner.positionZ.setValueAtTime(0, Howler.ctx.currentTime);
+                  } else {
+                    sound._panner.setPosition(pan, 0, 0);
+                  }
+                } else {
+                  sound._panner.pan.setValueAtTime(pan, Howler.ctx.currentTime);
+                }
+              }
+              self._emit("stereo", sound._id);
+            } else {
+              return sound._stereo;
+            }
+          }
+        }
+        return self;
+      };
+      Howl.prototype.pos = function(x, y, z, id) {
+        var self = this;
+        if (!self._webAudio) {
+          return self;
+        }
+        if (self._state !== "loaded") {
+          self._queue.push({
+            event: "pos",
+            action: function() {
+              self.pos(x, y, z, id);
+            }
+          });
+          return self;
+        }
+        y = typeof y !== "number" ? 0 : y;
+        z = typeof z !== "number" ? -0.5 : z;
+        if (typeof id === "undefined") {
+          if (typeof x === "number") {
+            self._pos = [x, y, z];
+          } else {
+            return self._pos;
+          }
+        }
+        var ids = self._getSoundIds(id);
+        for (var i = 0; i < ids.length; i++) {
+          var sound = self._soundById(ids[i]);
+          if (sound) {
+            if (typeof x === "number") {
+              sound._pos = [x, y, z];
+              if (sound._node) {
+                if (!sound._panner || sound._panner.pan) {
+                  setupPanner(sound, "spatial");
+                }
+                if (typeof sound._panner.positionX !== "undefined") {
+                  sound._panner.positionX.setValueAtTime(x, Howler.ctx.currentTime);
+                  sound._panner.positionY.setValueAtTime(y, Howler.ctx.currentTime);
+                  sound._panner.positionZ.setValueAtTime(z, Howler.ctx.currentTime);
+                } else {
+                  sound._panner.setPosition(x, y, z);
+                }
+              }
+              self._emit("pos", sound._id);
+            } else {
+              return sound._pos;
+            }
+          }
+        }
+        return self;
+      };
+      Howl.prototype.orientation = function(x, y, z, id) {
+        var self = this;
+        if (!self._webAudio) {
+          return self;
+        }
+        if (self._state !== "loaded") {
+          self._queue.push({
+            event: "orientation",
+            action: function() {
+              self.orientation(x, y, z, id);
+            }
+          });
+          return self;
+        }
+        y = typeof y !== "number" ? self._orientation[1] : y;
+        z = typeof z !== "number" ? self._orientation[2] : z;
+        if (typeof id === "undefined") {
+          if (typeof x === "number") {
+            self._orientation = [x, y, z];
+          } else {
+            return self._orientation;
+          }
+        }
+        var ids = self._getSoundIds(id);
+        for (var i = 0; i < ids.length; i++) {
+          var sound = self._soundById(ids[i]);
+          if (sound) {
+            if (typeof x === "number") {
+              sound._orientation = [x, y, z];
+              if (sound._node) {
+                if (!sound._panner) {
+                  if (!sound._pos) {
+                    sound._pos = self._pos || [0, 0, -0.5];
+                  }
+                  setupPanner(sound, "spatial");
+                }
+                if (typeof sound._panner.orientationX !== "undefined") {
+                  sound._panner.orientationX.setValueAtTime(x, Howler.ctx.currentTime);
+                  sound._panner.orientationY.setValueAtTime(y, Howler.ctx.currentTime);
+                  sound._panner.orientationZ.setValueAtTime(z, Howler.ctx.currentTime);
+                } else {
+                  sound._panner.setOrientation(x, y, z);
+                }
+              }
+              self._emit("orientation", sound._id);
+            } else {
+              return sound._orientation;
+            }
+          }
+        }
+        return self;
+      };
+      Howl.prototype.pannerAttr = function() {
+        var self = this;
+        var args = arguments;
+        var o, id, sound;
+        if (!self._webAudio) {
+          return self;
+        }
+        if (args.length === 0) {
+          return self._pannerAttr;
+        } else if (args.length === 1) {
+          if (typeof args[0] === "object") {
+            o = args[0];
+            if (typeof id === "undefined") {
+              if (!o.pannerAttr) {
+                o.pannerAttr = {
+                  coneInnerAngle: o.coneInnerAngle,
+                  coneOuterAngle: o.coneOuterAngle,
+                  coneOuterGain: o.coneOuterGain,
+                  distanceModel: o.distanceModel,
+                  maxDistance: o.maxDistance,
+                  refDistance: o.refDistance,
+                  rolloffFactor: o.rolloffFactor,
+                  panningModel: o.panningModel
+                };
+              }
+              self._pannerAttr = {
+                coneInnerAngle: typeof o.pannerAttr.coneInnerAngle !== "undefined" ? o.pannerAttr.coneInnerAngle : self._coneInnerAngle,
+                coneOuterAngle: typeof o.pannerAttr.coneOuterAngle !== "undefined" ? o.pannerAttr.coneOuterAngle : self._coneOuterAngle,
+                coneOuterGain: typeof o.pannerAttr.coneOuterGain !== "undefined" ? o.pannerAttr.coneOuterGain : self._coneOuterGain,
+                distanceModel: typeof o.pannerAttr.distanceModel !== "undefined" ? o.pannerAttr.distanceModel : self._distanceModel,
+                maxDistance: typeof o.pannerAttr.maxDistance !== "undefined" ? o.pannerAttr.maxDistance : self._maxDistance,
+                refDistance: typeof o.pannerAttr.refDistance !== "undefined" ? o.pannerAttr.refDistance : self._refDistance,
+                rolloffFactor: typeof o.pannerAttr.rolloffFactor !== "undefined" ? o.pannerAttr.rolloffFactor : self._rolloffFactor,
+                panningModel: typeof o.pannerAttr.panningModel !== "undefined" ? o.pannerAttr.panningModel : self._panningModel
+              };
+            }
+          } else {
+            sound = self._soundById(parseInt(args[0], 10));
+            return sound ? sound._pannerAttr : self._pannerAttr;
+          }
+        } else if (args.length === 2) {
+          o = args[0];
+          id = parseInt(args[1], 10);
+        }
+        var ids = self._getSoundIds(id);
+        for (var i = 0; i < ids.length; i++) {
+          sound = self._soundById(ids[i]);
+          if (sound) {
+            var pa = sound._pannerAttr;
+            pa = {
+              coneInnerAngle: typeof o.coneInnerAngle !== "undefined" ? o.coneInnerAngle : pa.coneInnerAngle,
+              coneOuterAngle: typeof o.coneOuterAngle !== "undefined" ? o.coneOuterAngle : pa.coneOuterAngle,
+              coneOuterGain: typeof o.coneOuterGain !== "undefined" ? o.coneOuterGain : pa.coneOuterGain,
+              distanceModel: typeof o.distanceModel !== "undefined" ? o.distanceModel : pa.distanceModel,
+              maxDistance: typeof o.maxDistance !== "undefined" ? o.maxDistance : pa.maxDistance,
+              refDistance: typeof o.refDistance !== "undefined" ? o.refDistance : pa.refDistance,
+              rolloffFactor: typeof o.rolloffFactor !== "undefined" ? o.rolloffFactor : pa.rolloffFactor,
+              panningModel: typeof o.panningModel !== "undefined" ? o.panningModel : pa.panningModel
+            };
+            var panner = sound._panner;
+            if (!panner) {
+              if (!sound._pos) {
+                sound._pos = self._pos || [0, 0, -0.5];
+              }
+              setupPanner(sound, "spatial");
+              panner = sound._panner;
+            }
+            panner.coneInnerAngle = pa.coneInnerAngle;
+            panner.coneOuterAngle = pa.coneOuterAngle;
+            panner.coneOuterGain = pa.coneOuterGain;
+            panner.distanceModel = pa.distanceModel;
+            panner.maxDistance = pa.maxDistance;
+            panner.refDistance = pa.refDistance;
+            panner.rolloffFactor = pa.rolloffFactor;
+            panner.panningModel = pa.panningModel;
+          }
+        }
+        return self;
+      };
+      Sound.prototype.init = /* @__PURE__ */ function(_super) {
+        return function() {
+          var self = this;
+          var parent = self._parent;
+          self._orientation = parent._orientation;
+          self._stereo = parent._stereo;
+          self._pos = parent._pos;
+          self._pannerAttr = parent._pannerAttr;
+          _super.call(this);
+          if (self._stereo) {
+            parent.stereo(self._stereo);
+          } else if (self._pos) {
+            parent.pos(self._pos[0], self._pos[1], self._pos[2], self._id);
+          }
+        };
+      }(Sound.prototype.init);
+      Sound.prototype.reset = /* @__PURE__ */ function(_super) {
+        return function() {
+          var self = this;
+          var parent = self._parent;
+          self._orientation = parent._orientation;
+          self._stereo = parent._stereo;
+          self._pos = parent._pos;
+          self._pannerAttr = parent._pannerAttr;
+          if (self._stereo) {
+            parent.stereo(self._stereo);
+          } else if (self._pos) {
+            parent.pos(self._pos[0], self._pos[1], self._pos[2], self._id);
+          } else if (self._panner) {
+            self._panner.disconnect(0);
+            self._panner = void 0;
+            parent._refreshBuffer(self);
+          }
+          return _super.call(this);
+        };
+      }(Sound.prototype.reset);
+      var setupPanner = function(sound, type) {
+        type = type || "spatial";
+        if (type === "spatial") {
+          sound._panner = Howler.ctx.createPanner();
+          sound._panner.coneInnerAngle = sound._pannerAttr.coneInnerAngle;
+          sound._panner.coneOuterAngle = sound._pannerAttr.coneOuterAngle;
+          sound._panner.coneOuterGain = sound._pannerAttr.coneOuterGain;
+          sound._panner.distanceModel = sound._pannerAttr.distanceModel;
+          sound._panner.maxDistance = sound._pannerAttr.maxDistance;
+          sound._panner.refDistance = sound._pannerAttr.refDistance;
+          sound._panner.rolloffFactor = sound._pannerAttr.rolloffFactor;
+          sound._panner.panningModel = sound._pannerAttr.panningModel;
+          if (typeof sound._panner.positionX !== "undefined") {
+            sound._panner.positionX.setValueAtTime(sound._pos[0], Howler.ctx.currentTime);
+            sound._panner.positionY.setValueAtTime(sound._pos[1], Howler.ctx.currentTime);
+            sound._panner.positionZ.setValueAtTime(sound._pos[2], Howler.ctx.currentTime);
+          } else {
+            sound._panner.setPosition(sound._pos[0], sound._pos[1], sound._pos[2]);
+          }
+          if (typeof sound._panner.orientationX !== "undefined") {
+            sound._panner.orientationX.setValueAtTime(sound._orientation[0], Howler.ctx.currentTime);
+            sound._panner.orientationY.setValueAtTime(sound._orientation[1], Howler.ctx.currentTime);
+            sound._panner.orientationZ.setValueAtTime(sound._orientation[2], Howler.ctx.currentTime);
+          } else {
+            sound._panner.setOrientation(sound._orientation[0], sound._orientation[1], sound._orientation[2]);
+          }
+        } else {
+          sound._panner = Howler.ctx.createStereoPanner();
+          sound._panner.pan.setValueAtTime(sound._stereo, Howler.ctx.currentTime);
+        }
+        sound._panner.connect(sound._node);
+        if (!sound._paused) {
+          sound._parent.pause(sound._id, true).play(sound._id, true);
+        }
+      };
+    })();
+  }
+});
+export default require_howler();
+/*! Bundled license information:
+
+howler/dist/howler.js:
+  (*!
+   *  howler.js v2.2.4
+   *  howlerjs.com
+   *
+   *  (c) 2013-2020, James Simpson of GoldFire Studios
+   *  goldfirestudios.com
+   *
+   *  MIT License
+   *)
+  (*!
+   *  Spatial Plugin - Adds support for stereo and 3D audio where Web Audio is supported.
+   *  
+   *  howler.js v2.2.4
+   *  howlerjs.com
+   *
+   *  (c) 2013-2020, James Simpson of GoldFire Studios
+   *  goldfirestudios.com
+   *
+   *  MIT License
+   *)
+*/
+//# sourceMappingURL=howler.js.map

File diff suppressed because it is too large
+ 3 - 0
unpackage/dist/cache/.vite/deps/howler.js.map


+ 3 - 6
unpackage/dist/cache/.vite/deps/pinyin.js

@@ -1,9 +1,6 @@
-var __defProp = Object.defineProperty;
-var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
-var __publicField = (obj, key, value) => {
-  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
-  return value;
-};
+import {
+  __publicField
+} from "./chunk-TYRVL62N.js";
 
 // E:/书嗨项目/shuhi-app-fornt/node_modules/pinyin/esm/data/dict-zi.js
 var dict = {};

File diff suppressed because it is too large
+ 0 - 0
unpackage/dist/cache/.vite/deps/pinyin.js.map


File diff suppressed because it is too large
+ 2495 - 213
unpackage/dist/dev/app-plus/app-service.js


+ 2 - 2
unpackage/dist/dev/app-plus/app.css

@@ -167,7 +167,7 @@
 }
 .fixed-bottom {
 	padding: 1.25rem 0;
-	padding-bottom: env(safe-area-inset-bottom);
+	padding-bottom: 0;
 	position: fixed;
 	width: 100%;
 	bottom: 0;
@@ -1735,6 +1735,6 @@ uni-view {
 }
 /*每个页面公共css */
 body {
-  background: #F5F6FA;
+  background: #f5f6fa;
   height: 100%;
 }

+ 33 - 0
unpackage/dist/dev/app-plus/manifest.json

@@ -20,6 +20,7 @@
     "Speech": {},
     "Barcode": {},
     "Bluetooth": {},
+    "Webview-x5": {},
     "UniNView": {
       "description": "UniNView原生渲染"
     }
@@ -44,6 +45,38 @@
     "nvueStyleCompiler": "uni-app",
     "compilerVersion": 3,
     "distribute": {
+      "icons": {
+        "android": {
+          "hdpi": "unpackage/res/icons/72x72.png",
+          "xhdpi": "unpackage/res/icons/96x96.png",
+          "xxhdpi": "unpackage/res/icons/144x144.png",
+          "xxxhdpi": "unpackage/res/icons/192x192.png"
+        },
+        "ios": {
+          "appstore": "unpackage/res/icons/1024x1024.png",
+          "ipad": {
+            "app": "unpackage/res/icons/76x76.png",
+            "app@2x": "unpackage/res/icons/152x152.png",
+            "notification": "unpackage/res/icons/20x20.png",
+            "notification@2x": "unpackage/res/icons/40x40.png",
+            "proapp@2x": "unpackage/res/icons/167x167.png",
+            "settings": "unpackage/res/icons/29x29.png",
+            "settings@2x": "unpackage/res/icons/58x58.png",
+            "spotlight": "unpackage/res/icons/40x40.png",
+            "spotlight@2x": "unpackage/res/icons/80x80.png"
+          },
+          "iphone": {
+            "app@2x": "unpackage/res/icons/120x120.png",
+            "app@3x": "unpackage/res/icons/180x180.png",
+            "notification@2x": "unpackage/res/icons/40x40.png",
+            "notification@3x": "unpackage/res/icons/60x60.png",
+            "settings@2x": "unpackage/res/icons/58x58.png",
+            "settings@3x": "unpackage/res/icons/87x87.png",
+            "spotlight@2x": "unpackage/res/icons/80x80.png",
+            "spotlight@3x": "unpackage/res/icons/120x120.png"
+          }
+        }
+      },
       "google": {
         "permissions": [
           "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",

+ 1 - 1
unpackage/dist/dev/app-plus/pages/index/detail/batch-audit.css

@@ -967,5 +967,5 @@ uni-view[data-v-f667648f], uni-scroll-view[data-v-f667648f], uni-swiper-item[dat
   font-size: 0.875rem;
 }
 .quality-circle.selected[data-v-bc156c69] {
-  background-color: #4CAF50;
+  background-color: #4caf50;
 }

BIN
unpackage/dist/dev/app-plus/static/bap.mp3


+ 1 - 1
unpackage/dist/dev/app-plus/static/css/mystyle.css

@@ -180,7 +180,7 @@
 
 .fixed-bottom {
 	padding: 40rpx 0rpx;
-	padding-bottom: env(safe-area-inset-bottom);
+	padding-bottom: 0;
 	position: fixed;
 	width: 100%;
 	bottom: 0;

BIN
unpackage/res/icons/1024x1024.png


BIN
unpackage/res/icons/120x120.png


BIN
unpackage/res/icons/144x144.png


BIN
unpackage/res/icons/152x152.png


BIN
unpackage/res/icons/167x167.png


BIN
unpackage/res/icons/180x180.png


BIN
unpackage/res/icons/192x192.png


BIN
unpackage/res/icons/20x20.png


BIN
unpackage/res/icons/29x29.png


BIN
unpackage/res/icons/40x40.png


BIN
unpackage/res/icons/58x58.png


BIN
unpackage/res/icons/60x60.png


BIN
unpackage/res/icons/72x72.png


BIN
unpackage/res/icons/76x76.png


BIN
unpackage/res/icons/80x80.png


BIN
unpackage/res/icons/87x87.png


BIN
unpackage/res/icons/96x96.png


+ 16 - 4
utils/VolumeTTS.js

@@ -20,7 +20,7 @@ class VolumeTTS {
     init() {
         this.TTSModule = uni.requireNativePlugin('nrb-tts-plugin')
         this.TTSModule && this.TTSModule.init({
-            "lang": "ZH",
+            "lang": "zh",
             "country": "CN"
         }, res => {
             if (res.success == 0) {
@@ -29,7 +29,22 @@ class VolumeTTS {
         })
     }
 
+    //加一个text的预处理,将text中的数字替换成 零一二三四五六七八九十
+    preprocessText(text) {
+        // 将text中的数字替换成 零一二三四五六七八九十
+        const digitMap = {
+            '0': '零', '1': '一', '2': '二', '3': '三', '4': '四',
+            '5': '五', '6': '六', '7': '七', '8': '八', '9': '九'
+        };
+        
+        return text.replace(/\d+/g, match => {
+            // 逐字符替换所有数字,包括10
+            return match.split('').map(digit => digitMap[digit] || digit).join('');
+        });
+    }
+
     speak(text) {
+        text = this.preprocessText(text)
         // #ifdef H5
         // H5端使用Web Speech API
         if ('speechSynthesis' in window) {
@@ -42,8 +57,6 @@ class VolumeTTS {
         }
         // #endif
 
-        console.log(this.platform, 'dsad');
-
         // #ifdef APP-PLUS
         let opts = this.platform == 'ios' ? {
             "rate": this.ttsParams.speed,
@@ -54,7 +67,6 @@ class VolumeTTS {
             "speechRate": this.ttsParams.speed,
             "queueMode": 1,
         }
-		console.log(this.TTSModule,'this.TTSModule')
         this.TTSModule.speak(text, opts, (e) => {
             console.log(e, '读取成功')
         })

Some files were not shown because too many files changed in this diff