Conversation
A CHHapticPatternPlayer that CoreHaptics has already stopped does not start again, so replaying a preset at the same position — which reuses the parsed composer — was silent: no audio, no haptics. Stopping a player now unregisters it, and the next play rebuilds it from its pattern through the path that already existed for recreated players. Re-parsing also releases the players it replaces, instead of leaking them into the engine registry until eviction stopped ones still in use.
Member
Author
|
Closing pending a proper investigation. The A/B held up on hardware, but it was a fix arrived at by inference and then confirmed, not one derived from understanding the failure — and that is not a good enough basis for changing engine-wide player lifecycle. Reopening or replacing this once the actual mechanism is established with a debugger. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Audio Sync demo in PulsarApp plays once. When the preset reaches its end and you hit Play again, nothing happens — no sound, no haptics.
playFrom()in the demo stops before every play. On the first play that stop is a no-op (nothing has parsed yet). On a replay at the same position it is not:PresetHandle.ensureParsedreuses the parsed composer, so the sameCHHapticPatternPlayers are reused — andstopPlayer(id:)kept them in the registry after stopping them, soplayPlayercalledstart(atTime: 0)on players CoreHaptics had already stopped. That silently does nothing, and since the discrete player carries the preset's audio event, both the haptics and the audio go quiet.Seeking kept working because a new position re-parses and builds fresh players. Same-position replay is the only broken path, which is also why it slipped past
qa-demos-audio-sync.yaml— that flow taps replay, but it can only assert the JS clock, not whether anything actually played.Changes
HapticEngineWrapper— stopping a player unregisters it, so the nextplayPlayertakes the existing rebuild-from-pattern path (which also restarts the engine if it went down). The registered audio resource is untouched, so the rebuilt player still carries its audio.PatternComposer—parse()releases the players it replaces. They were leaked into the engine registry on every re-parse, so roughly ten seeks were enough for eviction to start stopping players still in use.Verified on hardware
Confirmed on a physical iPhone 13 (iOS 26.6.1) by A/B-ing two builds of PulsarApp that differ by exactly one line — the
unregisterPlayer(id)call instopPlayer(id:)— with the demo's JS untouched in both:Worth stating plainly: a stopped
CHHapticPatternPlayerdoes not start again. That is the behaviour this change works around, and it is now measured rather than assumed.Tests
playingAfterAStopBuildsAFreshPlayerin the CoreHaptics mock suite. It fails onmain(playersCreated → 1) == 2) and passes here.Pulsar-Package: 63 tests / 11 suites pass, plus the 7-test isolated mock suite.