Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Commit

Permalink
Fix bug where starting the same environmental audio twice created an …
Browse files Browse the repository at this point in the history
…un-stoppable instance

Summary: Fixes #509

Reviewed By: mikearmstrong001

Differential Revision: D8274426

fbshipit-source-id: 8303efa47c859ef6bbbf980cf3d09da4029eff6a
  • Loading branch information
andrewimm authored and facebook-github-bot committed Jun 11, 2018
1 parent 685022a commit 390b4c8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions React360/js/Compositor/Audio/AudioInstance.js
Expand Up @@ -21,6 +21,7 @@ export default class AudioInstance {
_node: ?AudioNode;
_position: ?Vec3;
_source: string;
_stopped: boolean;
_transition: number;
_volume: number;

Expand All @@ -30,6 +31,7 @@ export default class AudioInstance {
this._loop = !!options.loop;
this._muted = !!options.muted;
this._position = options.position;
this._stopped = false;
this._transition = 0;
this._volume = options.volume !== undefined ? options.volume : 1.0;

Expand Down Expand Up @@ -71,6 +73,7 @@ export default class AudioInstance {
}

stop() {
this._stopped = true;
if (this._node) {
this._node.stop();
}
Expand Down Expand Up @@ -98,6 +101,9 @@ export default class AudioInstance {
}

setNode(node: AudioNode) {
if (this._stopped) {
return;
}
this._node = node;
if (this._autoPlay) {
this.play();
Expand Down

0 comments on commit 390b4c8

Please sign in to comment.