Quantcast
Channel: Bugs Latest Topics
Viewing all articles
Browse latest Browse all 760

Babylon.Sound stop and play mabe set .isPlaying = false

$
0
0
                    else {
                        this._soundSource = BABYLON.Engine.audioEngine.audioContext.createBufferSource();
                        this._soundSource.buffer = this._audioBuffer;
                        this._soundSource.connect(this._inputAudioNode);
                        this._soundSource.loop = this.loop;
                        this._soundSource.playbackRate.value = this._playbackRate;
                        this._soundSource.onended = function () { _this._onended(); };//called later... step 2,
                        this._soundSource.start(startTime, this.isPaused ? this._startOffset % this._soundSource.buffer.duration : 0);
                    }
                    this._startTime = startTime;
                    this.isPlaying = true; //called first. step 1,
                    this.isPaused = false;
                }
                catch (ex) {
                    BABYLON.Tools.Error("Error while trying to play audio: " + this.name + ", " + ex.message);
                }
            }
        };
        Sound.prototype._onended = function () {
            this.isPlaying = false; //called later... step 2.
            if (this.onended) {
                this.onended();
            }
        };

look at the comment. 

when code is:

sound.stop();

sound.play();

the sound.isPlaying sometimes will be set as false.

 


Viewing all articles
Browse latest Browse all 760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>