From 8a13222aa00ae27900b882d1f5c632fc345e00fa Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Thu, 2 Nov 2017 21:16:46 -0700 Subject: [PATCH] Various fixes for elementSource --- js/media/README.md | 2 +- js/media/elementSource.js | 7 ++++--- js/media/index.js | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/js/media/README.md b/js/media/README.md index cacefcb7..ec1a3c7a 100644 --- a/js/media/README.md +++ b/js/media/README.md @@ -109,4 +109,4 @@ Options: * Pause a track. Resume it with pause. * Play a track. Part way through press play again. Asserrt that the track starts over. * While a track is loading: Press play. Nothing should happen. -* Load a large file while another file is loading. Assert that the first file stops playing while we wait. \ No newline at end of file +* Load a large file while another file is playing. Assert that the first file stops playing while we wait. \ No newline at end of file diff --git a/js/media/elementSource.js b/js/media/elementSource.js index 2fc72856..9fee4f00 100644 --- a/js/media/elementSource.js +++ b/js/media/elementSource.js @@ -21,6 +21,7 @@ export default class ElementSource extends Emitter { }); this._audio.addEventListener("durationchange", () => { + this.trigger("loaded"); this._setStalled(false); }); @@ -34,7 +35,7 @@ export default class ElementSource extends Emitter { }); this._source = this._context.createMediaElementSource(this._audio); - this._loop = true; + this._audio.loop = false; this._source.connect(destination); } @@ -110,11 +111,11 @@ export default class ElementSource extends Emitter { } getLoop() { - return this._loop; + return this._audio.loop; } setLoop(shouldLoop) { - this._loop = shouldLoop; + this._audio.loop = shouldLoop; } _setStatus(status) { diff --git a/js/media/index.js b/js/media/index.js index 15052623..7810a987 100644 --- a/js/media/index.js +++ b/js/media/index.js @@ -1,7 +1,7 @@ /* Emulate the native