test(asr): [PKG-ASR-05] cover CORS and independent audio combinations

This commit is contained in:
Harvey Zhao committed 2026-09-13 16:07:01 +08:00
1 parent 2cede66933
commit 5ab7da6e1f
12 files changed
+6360 -4

No files matched your search

+14 -2
View File
@@ -112,6 +112,15 @@ From the repository root:
- `yarn test:browser test/browser/asr-fallback.spec.js`: native capture/Worklet
audio with an external media owner, silent ASR output even while muted, stop,
fresh tracks after restart/source change and independent context cleanup.
- `yarn test:browser test/browser/asr-cors.spec.js`: CORS-authorized media,
opaque direct/redirected media, native zero-output or absent-chunk observations,
and restoration after switching to a same-origin source. Default routing keeps
the [Web Audio CORS restriction](https://www.w3.org/TR/webaudio-1.0/#MediaElementAudioSourceNode-security);
this test does not claim that unsupported cross-origin playback is repaired.
- `yarn test:browser test/browser/asr-audio-track.spec.js`: separate audio-track
ownership, pause/update/stop/destroy and main-video-only PCM. Both plugin orders
are exercised in distinct cases. `ARTPLAYER_AUDIO_ARTIFACT` selects a real
audio-track distribution alongside `ARTPLAYER_ASR_ARTIFACT`.
- `yarn typecheck`: includes the package strict/noUncheckedIndexedAccess project.
- `yarn test:asr-types-package`: packs and installs core/ASR outside the workspace,
checks frozen 2.0/2.1 consumers and candidate declarations in strict compiler
@@ -127,6 +136,9 @@ From the repository root:
Windows Playwright WebKit 26.6 lacks AudioContext and AudioWorkletNode. Its native
ASR cases remain explicit skips and do not establish Safari/device compatibility.
Real fallback track replacement, native volume/mute, CORS, unsupported media and
physical devices remain PKG-ASR-05 acceptance work. Do not use the demo's external
Native direct/fallback routing, volume/mute, CORS and audio-track combinations
have scoped browser evidence. Unsupported media, external-owner integration,
Safari and physical devices remain PKG-ASR-05 acceptance work. CORS restrictions
and main-video-only capture are explicit integration boundaries, not a claim
that every media source can be recognized. Do not use the demo's external
recognizer service as a prerequisite for local audio verification.
+15
View File
@@ -37,6 +37,21 @@ The root declaration retains its historical NodeNext ESM namespace shape; use
`/runtime` for a directly callable default import in that mode. This is an opt-in
type entry, and does not require changes to existing JavaScript consumers.
## Media access and separate audio
Cross-origin media needs both `moreVideoAttr: { crossOrigin: 'anonymous' }` on
ArtPlayer and an appropriate `Access-Control-Allow-Origin` response from the media
server. Set the attribute before loading the source. Without CORS access, the
default Web Audio route becomes silent even when the video timeline advances;
Chromium supplies zero PCM and Firefox may supply no chunks. A same-origin URL
that redirects to an unapproved origin has the same restriction. ASR does not
change request credentials or bypass browser media security.
ASR captures `art.video`. When used with `artplayer-plugin-audio-track`, the
independent `audio` element is not mixed into recognition. Muting the main video
silences its default ASR input even if a consumer separately unmutes that audio
element. Both plugins keep their existing volume and playback APIs.
## Maintenance
See [ARCHITECTURE.md](ARCHITECTURE.md) for the current audio flow, public behavior,