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

Player malfunctions after the device goes into sleep mode - Safari (macOS) #971

Closed
1 task done
mxAlexG opened this issue Sep 1, 2022 · 4 comments
Closed
1 task done
Assignees
Labels
area-player Related to the audio playback engine. platform-javascript Related to the JavaScript version of alphaTab state-needs-investigation type-bug 🕷️

Comments

@mxAlexG
Copy link

mxAlexG commented Sep 1, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Summary:
After turning on the device from sleep mode, playback doesn't resume when api.play() or api.playPause() are called.

Detailed:
While using Safari and viewing the same example player on the website's main page or other ones, if you put your device in sleep mode and it lasts for more than few seconds in this state (~10 seconds) . Then, if you turn it back on, you will lose the ability to resume playback (whether you're using api.play() or api.playPause() makes no difference). The cursor will move slightly to the adjacent note to its right then reverts back to its initial position (highlighting the note indefinitely as well).

I tested this with Chrome and Firefox on a Windows device, an actual Android device and an emulator. All function properly with zero issues when going through this procedure. Unfortunately, I can't provide a video capture example.

Expected Behavior

When the device goes into sleep mode and is turned back on, the player should restore or maintain its state and function as if there was no interruption to the process irrespective of the duration.

Steps To Reproduce

  1. Load any web page that has a displayed instance of alphaTab with a loaded score
  2. When the page finishes loading, put the device in sleep mode or equivalent
  3. Wait for an average of 10 seconds
  4. Turn the device on
  5. If the player has UI controls for playback, click on the resume button
  6. If no UI Controls exist, invoke the function api.play() or api.playPause()
  7. The behavior occurs described in "Current Behavior"

Link to jsFiddle, CodePen, Project

No response

Found in Version

1.2

Platform

Web

Environment

- **macOS- BigSur**:
- **Safari 14**:

Anything else?

No response

@mxAlexG mxAlexG added the state-needs-triage Bug not triaged yet. label Sep 1, 2022
@mxAlexG mxAlexG changed the title Player malfunctions after the device goes into sleep mode - Safari (MacOS) Player malfunctions after the device goes into sleep mode - Safari (macOS) Sep 1, 2022
@Danielku15 Danielku15 added type-bug 🕷️ area-player Related to the audio playback engine. platform-javascript Related to the JavaScript version of alphaTab state-needs-investigation and removed state-needs-triage Bug not triaged yet. labels Sep 9, 2022
@Danielku15
Copy link
Member

Seems like an issue on iOS side with no good workaround because it is a bug in WebKit. Internally they move the AudioContext to a suspended mode without reactivating it correctly. Due to the corrupt state reactivating and resuming the context seems not working correctly.

Some references I found around this issue.
https://bugs.webkit.org/show_bug.cgi?id=237878
https://bugs.webkit.org/show_bug.cgi?id=231105
playcanvas/engine#3977
goldfire/howler.js#1525

Will need to check if I can add some workaround for Safari. Like this one: https://developer.apple.com/forums/thread/658375

@Danielku15
Copy link
Member

@mxAlexG As I do not have any Apple Devices for development and testing testing any bugfix is really tricky on my side. Cloud Testing Platforms like BrowserStack prevent devices to go in sleep mode because they need the devices active for allowing access to it.

I incorporated some AudioContext suspend/resume handling changes of playcanvas/engine into alphaTab and uploaded a testbuild here:

https://demo.alphatab.net/crm/ios/playground/control.html#

On all operating systems and browsers I tested I could still play the sound and also on the one iPad I could use for testing I could not see any problems. Therefore I would need to rely on your feedback for a fix.

@Danielku15
Copy link
Member

Ping @mxAlexG

I plan to soon release 1.2.3 (its in testing/bugfixing phase) and if this fix would work, I would ship it in 1.2.3 too.

@Danielku15 Danielku15 moved this to In Progress in Version 1.3 Feb 25, 2023
@Danielku15
Copy link
Member

Closed due to inactivity. Feel free to reopen the issue when it becomes relevant again.

@Danielku15 Danielku15 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 25, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in Version 1.3 Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-player Related to the audio playback engine. platform-javascript Related to the JavaScript version of alphaTab state-needs-investigation type-bug 🕷️
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants