|
@@ -343,6 +343,10 @@
|
|
public play(time?: number) {
|
|
public play(time?: number) {
|
|
if (this._isReadyToPlay && this._scene.audioEnabled) {
|
|
if (this._isReadyToPlay && this._scene.audioEnabled) {
|
|
try {
|
|
try {
|
|
|
|
+ if (this._startOffset < 0) {
|
|
|
|
+ time = -this._startOffset;
|
|
|
|
+ this._startOffset = 0;
|
|
|
|
+ }
|
|
var startTime = time ? Engine.audioEngine.audioContext.currentTime + time : Engine.audioEngine.audioContext.currentTime;
|
|
var startTime = time ? Engine.audioEngine.audioContext.currentTime + time : Engine.audioEngine.audioContext.currentTime;
|
|
if (!this._soundSource || !this._streamingSource) {
|
|
if (!this._soundSource || !this._streamingSource) {
|
|
if (this.spatialSound) {
|
|
if (this.spatialSound) {
|
|
@@ -381,7 +385,7 @@
|
|
this._soundSource.start(startTime);
|
|
this._soundSource.start(startTime);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- this._soundSource.start(0, this.isPaused ? this._startOffset % this._soundSource.buffer.duration : 0);
|
|
|
|
|
|
+ this._soundSource.start(startTime, this.isPaused ? this._startOffset % this._soundSource.buffer.duration : 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this._startTime = startTime;
|
|
this._startTime = startTime;
|
|
@@ -597,4 +601,4 @@
|
|
return newSound;
|
|
return newSound;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|