Skip to content

Commit

Permalink
Merge pull request #310 from akashic-games/enable-audio-stop-over-dur…
Browse files Browse the repository at this point in the history
…ation

skip super.stop when loop
  • Loading branch information
ShinobuTakahashi authored Jun 6, 2024
2 parents 807597c + 8358595 commit f4d523e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

## 2.10.1
* `HTMLAudioPlayer` でループ再生時に停止できなくなる不具合を修正

## 2.10.0
* @akashic/pdi-types@1.14.0 に更新
* `RendererCandidate` をサポート
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@akashic/pdi-browser",
"version": "2.10.0",
"version": "2.10.1",
"description": "An akashic-pdi implementation for Web browsers",
"main": "index.js",
"typings": "lib/full/index.d.ts",
Expand Down
8 changes: 6 additions & 2 deletions src/plugin/HTMLAudioPlugin/HTMLAudioPlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class HTMLAudioPlayer extends AudioPlayer {
private _isStopRequested: boolean = false;
private _onPlayEventHandler: () => void;
private _dummyDurationWaitTimer: any;
private _assetLoop: boolean = false;

constructor(system: pdi.AudioSystem, manager: AudioManager) {
super(system);
Expand All @@ -38,6 +39,7 @@ export class HTMLAudioPlayer extends AudioPlayer {
this.stop();
}
const audio = asset.cloneElement();
this._assetLoop = asset.loop;

if (audio) {
if (!asset.offset) {
Expand Down Expand Up @@ -119,8 +121,10 @@ export class HTMLAudioPlayer extends AudioPlayer {
}

private _onAudioEnded(): void {
this._clearEndedEventHandler();
super.stop();
if (!this._assetLoop) {
this._clearEndedEventHandler();
super.stop();
}
}

private _clearEndedEventHandler(): void {
Expand Down

0 comments on commit f4d523e

Please sign in to comment.