Cocos AIR audio, video and WebView
Stop once you can answer the task. Do not read another same-topic reference for the same question.
Scope: AudioService, AudioSource and DOM-backed video/WebView playback.
Environment: use package imports in apps; source paths require an AIR checkout. See context.
Quick Start
For complete setup and teardown, read Quick Start.
Siblings: direct dependencies; reuse loaded skills.
Triggers
- Play BGM or SFX with channel controls
- Seek raw audio or inspect PCM data
- Show a real video inside the scene rectangle
- Embed a page through an iframe overlay
- Prove playback using advancing time
- Unlock media or clean up DOM resources
Exact API and symptom mappings: triggers.
Contracts
Start playback inside a real user gesture and verify advancing currentTime. Explicitly release audio channels and DOM media resources; source API availability does not prove autoplay or platform playback.
Read references/contracts.md only when the task needs exact option rules, limits, error behavior or source annotations. Prefer the topic references below for a narrower question.
Common Mistakes
- [HIGH] A playing flag alone is not playback proof.
- [HIGH] Set WebView URL before mounting on an active node.
- [MEDIUM] Audio unlock needs a real user gesture.
- [MEDIUM] Set transparent-canvas mode before app creation.
Read relevant wrong/right examples before implementation.
Reference map
- BGM or SFX silent? - Channels and gesture unlock
- Video playback or layout? - DOM geometry and events
- Embed a web page? - Mount order and iframe lifecycle