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

fix safari can not resume the webaudio #17640

Open
wants to merge 5 commits into
base: v3.8.5
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pal/audio/web/player-web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ export class AudioContextAgent {
resolve();
return;
}
context.resume().catch((e) => { debug.warn('runContext error', e); });
// only state is suspended can involve resume function
if (context.state === 'suspended') {
context.resume().catch((e) => { debug.warn('runContext error', e); });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the logic change, will low-end devices be able to play normally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have test ios 15.7 ios 14.8 and ios 17.5.1, three version of iphone.

}
if (context.state === 'running') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'if' condition needs to be changed to 'else if'.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'if' condition needs to be changed to 'else if'.

resolve();
return;
Expand Down
Loading