diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-03-19 14:57:57 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-03-19 14:57:57 -0700 |
commit | 003042c91b1bca85bc7244bc6168e68caef86e08 (patch) | |
tree | c18defd26455df9ce2eccae26db5216ec1c8798a | |
parent | 8754ddc7e358b04aefbb453f3d07fd597474a1bf (diff) | |
parent | 7c71bf1d0ab8feb685a256de74abcae8c6a56f68 (diff) |
Merge pull request #975 from ehsan/openal
Only pause/resume in progress sources if the buffer being played back is...
-rw-r--r-- | src/library_openal.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/library_openal.js b/src/library_openal.js index 6bd0f6b0..271ae5ae 100644 --- a/src/library_openal.js +++ b/src/library_openal.js @@ -385,14 +385,18 @@ var LibraryOpenAL = { return; } var offset = 0; - if ("src" in AL.currentContext.src[source - 1]) { - // If the source is already playing, we need to resume from beginning. - // We do that by stopping the current source and replaying it. - _alSourceStop(source); - } else if (AL.currentContext.src[source - 1].paused) { - // So now we have to resume playback, remember the offset here. - offset = AL.currentContext.src[source - 1].pausedTime - - AL.currentContext.src[source - 1].playTime; + if ("src" in AL.currentContext.src[source - 1] && + AL.currentContext.src[source - 1]["src"].buffer == + AL.currentContext.src[source - 1].buffer) { + if (AL.currentContext.src[source - 1].paused) { + // So now we have to resume playback, remember the offset here. + offset = AL.currentContext.src[source - 1].pausedTime - + AL.currentContext.src[source - 1].playTime; + } else { + // If the source is already playing, we need to resume from beginning. + // We do that by stopping the current source and replaying it. + _alSourceStop(source); + } } var src = AL.currentContext.ctx.createBufferSource(); src.loop = AL.currentContext.src[source - 1].loop; |