Skip to content
This repository was archived by the owner on Sep 21, 2026. It is now read-only.

docs: audio playback position reports in audioEventsSystem - #609

Closed
LautaroPetaccio wants to merge 3 commits into
mainfrom
docs/audio-playback-position-reports
Closed

LautaroPetaccio wants to merge 3 commits into
mainfrom
docs/audio-playback-position-reports

Conversation

@LautaroPetaccio

@LautaroPetaccio LautaroPetaccio commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

What

Documents the audio playback position reports that renderers write into the AudioEvent component while an AudioSource clip plays, and the audioEventsSystem functions that expose them.

Changes in content/creator/sdk7/3d-essentials/sounds.md:

  • New Audio events section. The page did not cover audioEventsSystem at all, so it now documents the pre-existing API first (registerAudioEventsEntity, getAudioState, hasAudioEventsEntity, removeAudioEventsEntity, MediaState), including that timestamp is a per-entity counter and not a time.
  • New Playback position reports subsection: the three optional AudioEvent fields (tickNumber, currentOffset, clipLength), the registerAudioPlaybackEntity / removeAudioPlaybackEntity / getAudioPlayback functions with short examples, why the reports are needed (renderer start delay, currentTime being a write-only seek), that state-change callbacks do not fire for position-only reports, graceful handling when no position has been reported, and typical uses.
  • New Sync gameplay to the sound subsection. A report has to be compared against the scene clock at the tick it was sampled in, not at the moment the callback runs. The SDK keeps that per-tick history, which is why registerAudioPlaybackEntity hands over { report, sceneTime, offset } already resolved; getSceneTimeAtTick is mentioned for scenes handling raw reports or video. Subtracting offset from scene time gives the moment the audible clip started, which is the value worth keeping.
  • A note that currentOffset is the decoder's read position: the sound card and its buffers add a few tens of milliseconds that no property reports, roughly constant per device, so a scene needing better than tick accuracy should measure it once and subtract it.
  • The existing currentTime bullet now says it is a seek command the renderer never writes back to, and links to the new section.

The contributor reference pages (content/contributor/runtime/components.md, content/contributor/explorer-renderer/components/components.md) were checked and left untouched: neither lists AudioEvent or its fields today.

Caveat

This describes a feature that is not released yet. It needs an SDK release that includes the change and an explorer that implements the reports; the Unity explorer (DCL 2.0 desktop client) is the first. The page flags this with a note, and explains that on explorers without support the new fields stay undefined and getAudioPlayback() returns undefined. This PR should stay in draft until the SDK change ships.

Related

Verification

Built locally with Hugo 0.108.0 (same version as CI); all ref shortcodes resolve and the new headings render.

Related pull requests

Add an Audio events section to the SDK7 sounds page. It documents the
existing audioEventsSystem API (registerAudioEventsEntity, getAudioState,
MediaState) and the new playback position reports: the optional
tickNumber, currentOffset and clipLength fields of AudioEvent, the
registerAudioPlaybackEntity, removeAudioPlaybackEntity and
getAudioPlayback functions, and the tickNumber correlation pattern for
syncing gameplay to the sound that is actually heard.

Flag that the feature needs an SDK release that includes it and an
explorer that implements the reports, and note on the currentTime
property that it is a write-only seek command.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Deploying documentation with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8b9882e
Status: ✅  Deploy successful!
Preview URL: https://d49a298f.new-docs-6m4.pages.dev
Branch Preview URL: https://docs-audio-playback-position.new-docs-6m4.pages.dev

View logs

The renderer has no fixed reporting interval; it writes whenever the playhead
moves. Drop the twice-a-second claim and describe delivery as it is: once per
frame with the newest report.

Replace the hand-written per-tick clock history with
registerAudioPlaybackSampleEntity, which the SDK now provides, and mention
getSceneTimeAtTick for scenes that want the raw reports. The old example asked
every scene to rebuild the part that is easiest to get wrong.

Add the caveat that current_offset is the decoder's position, so output latency
sits on top of it and no property reports it.
The SDK collapsed the raw-report callback and the resolved one into a single
registerAudioPlaybackEntity that hands over the resolved reading. Update both
examples and drop the raw variant, which no longer exists.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants