Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复当音频切后台时间过长,再恢复前台时会报错的问题 #117

Merged
merged 1 commit into from Nov 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/layaAir/laya/media/h5audio/AudioSoundChannel.ts
Expand Up @@ -143,12 +143,19 @@ export class AudioSoundChannel extends SoundChannel {
* @override
*/
resume(): void {
if (!this._audio)
var audio = this._audio;
if (!audio)
return;
this.isStopped = false;
if (audio.readyState == 0) { //当音频放到后台一定时间后,会被卸载,音频会断开连接,并将readyState重置为0
audio.src = this.url;
audio.addEventListener("canplay", this._resumePlay as any);
audio.load();
}
ILaya.SoundManager.addChannel(this);
if ("play" in this._audio)
this._audio.play();
if ("play" in audio) {
audio.play();
}
}

/**
Expand Down