Skip to content

Commit 60c0410

Browse files
trevorknightjwcullen
authored andcommitted
Update web demo to use iamf_tools and OBR and support MP4s
With this CL, the web demo hosted on GitHub Pages, supports drag-and-drop of MP4s and will decode using iamf_tools and OBR. PiperOrigin-RevId: 894237669
1 parent 0bc219c commit 60c0410

9 files changed

Lines changed: 617 additions & 121 deletions

File tree

gh_pages/web_demo/app_bundle.js

Lines changed: 402 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
388 KB
Binary file not shown.
230 KB
Binary file not shown.
27.5 MB
Binary file not shown.
108 KB
Binary file not shown.

gh_pages/web_demo/decoder/wasm/wrapper.js

Lines changed: 0 additions & 21 deletions
This file was deleted.
1.36 MB
Binary file not shown.

gh_pages/web_demo/decoder_worker_bundle.js

Lines changed: 152 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gh_pages/web_demo/index.html

Lines changed: 63 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ <h2>What is IAMF?</h2>
3131
<h2>About this demo</h2>
3232
<p>
3333
This is a demo of the
34-
<a href="https://github.com/AOMediaCodec/libiamf" target="_blank">libiamf decoder</a>
34+
<a href="https://github.com/AOMediaCodec/iamf-tools" target="_blank"
35+
>iamf_tools decoder</a
36+
>
3537
compiled into WebAssembly and decoding IAMF in the browser.
3638
</p>
3739
<p>
@@ -46,10 +48,6 @@ <h2>About this demo</h2>
4648
>
4749
set to <code>HEADPHONES_RENDERING_MODE_BINAURAL</code>.
4850
</p>
49-
<p>
50-
Our team keeps on improving the binaural rendering quality and will update the demo as
51-
work progresses.
52-
</p>
5351
<p>Things to listen for:</p>
5452
<ul>
5553
<li>
@@ -81,6 +79,7 @@ <h2>About this demo</h2>
8179
in immersion, directionality, and fullness.
8280
</li>
8381
</ul>
82+
<p>Note: This demo does not support IAMF files using AAC encoded audio.</p>
8483

8584
<p>Questions or feedback: <a target="_blank" href="https://github.com/AOMediaCodec/iamf-tools/issues/new?title=[Web%20demo]%20%28Put%20a%20short%20title%20here%29&body=Please%20describe%20in%20detail:%0A-%20What%20did%20you%20do?%0A-%20What%20happened?%0A-%20What%20did%20you%20expect?">Please file an issue on GitHub</a>.</p>
8685
</div>
@@ -98,43 +97,86 @@ <h2>Settings</h2>
9897
<option value="Animated demo (3rd-order ambisonics + stereo)">
9998
Animated demo (3rd-order ambisonics + stereo)
10099
</option>
100+
<option value="7.1.4 Speaker callout (FLAC)">7.1.4 Speaker callout (FLAC)</option>
101+
<option value="7.1.4 Speaker callout (Opus)">7.1.4 Speaker callout (Opus)</option>
102+
<option value="7.1.4 Speaker callout (PCM 16-bit 48kHz)">
103+
7.1.4 Speaker callout (PCM 16-bit 48kHz)
104+
</option>
101105
</select>
102106
</div>
103107
<label for="fileDrop">Or drag and drop an audio IAMF file</label><br />
104108
<div id="fileDrop">Drag and drop here</div>
105109
<p>
106-
Note: Only standalone .iamf files are supported and very large files (> 1GB) may exhaust
107-
the browser sandbox's memory.
110+
Note: MP4 files or standalone .iamf files are supported. Very large files (> 1GB) may
111+
exhaust the browser sandbox's memory.
108112
</p>
109113
<br />
110114
<div>
111115
<input type="checkbox" id="advancedSettingsCheckbox" name="advancedSettingsCheckbox" />
112116
<label for="advancedSettingsCheckbox">Advanced settings</label>
113117
<div id="advancedSettings" hidden="true">
114118
<h2>Advanced settings</h2>
119+
<h3>These settings are for debugging and testing purposes.</h3>
115120
<p>
116-
These settings are for debugging and testing purposes. Changing some settings may have
117-
unintended consequences, for example, setting a higher output sample rate than used in
118-
the input file will result in upsampling.
121+
Controls the loudspeaker decoding layout. Depending on OS and browser, many layouts
122+
may not be able to be played, but all can be downloaded as a wave file by checking the
123+
"Show audio files" box below.
119124
</p>
120125
<div class="dropdown">
121-
<select id="outputSampleRate" name="outputSampleRate">
122-
<option value="16000">16000</option>
123-
<option value="24000">24000</option>
124-
<option value="48000" selected="selected">48000</option>
126+
<select id="outputLayout" name="outputLayout">
127+
<option value="0" selected>
128+
"Stereo" — ITU-R B.S. 2051-3 sound system A (0+2+0)
129+
</option>
130+
<option value="1">"5.1" — ITU-R B.S. 2051-3 sound system B (0+5+0)</option>
131+
<option value="2">"5.1.2" — ITU-R B.S. 2051-3 sound system C (2+5+0)</option>
132+
<option value="3">"5.1.4" — ITU-R B.S. 2051-3 sound system D (4+5+0)</option>
133+
<option value="4">ITU-R B.S. 2051-3 sound system E (4+5+1)</option>
134+
<option value="5">ITU-R B.S. 2051-3 sound system F (3+7+0)</option>
135+
<option value="6">ITU-R B.S. 2051-3 sound system G (4+9+0)</option>
136+
<option value="7">ITU-R B.S. 2051-3 sound system H (9+10+3)</option>
137+
<option value="8">"7.1" — ITU-R B.S. 2051-3 sound system I (0+7+0)</option>
138+
<option value="9">"7.1.4" — ITU-R B.S. 2051-3 sound system J (4+7+0)</option>
139+
<option value="10">IAMF extension 7.1.2</option>
140+
<option value="11">IAMF extension 3.1.2</option>
141+
<option value="12">Mono</option>
142+
<option value="13">IAMF extension 9.1.6</option>
143+
<option value="14">Binaural</option>
144+
</select>
145+
<label for="outputLayout">Loudspeaker decoding output layout</label>
146+
</div>
147+
<p>
148+
Optionally, specify an ID to decode a specific Mix Presentation. If invalid or blank,
149+
the decoder will use default behaviour. Mix Presentations can be seen in the browser
150+
console log messages.
151+
</p>
152+
<div class="dropdown">
153+
<input
154+
type="number"
155+
id="mixPresentationId"
156+
name="mixPresentationId"
157+
min="0"
158+
placeholder="Unspecified"
159+
/>
160+
<label for="mixPresentationId">Mix Presentation ID</label>
161+
</div>
162+
<p>Controls the order of the audio channels in the output.</p>
163+
<div class="dropdown">
164+
<select id="channelOrdering" name="channelOrdering">
165+
<option value="0" selected>IAMF Ordering (ITU/IAMF)</option>
166+
<option value="1">Ordering for Android (AudioFormat.java)</option>
125167
</select>
126-
<label for="outputSampleRate">Output sample rate</label>
168+
<label for="channelOrdering">Output audio channel ordering</label>
127169
</div>
128170
<p>
129-
By checking this box, you can access the stereo and binaural audio elements directly
130-
to, most usefully, download audio.
171+
By checking this box, you can access the loudspeaker and binaural audio elements to
172+
download audio.
131173
</p>
132174
<input
133175
type="checkbox"
134176
id="showAudioElementsCheckbox"
135177
name="showAudioElementsCheckbox"
136178
/>
137-
<label for="showAudioElementsCheckbox">Show audio elements</label>
179+
<label for="showAudioElementsCheckbox">Show audio files</label>
138180
</div>
139181
</div>
140182
</div>
@@ -154,8 +196,8 @@ <h2>Audio Playback</h2>
154196
<canvas id="timelineCanvas" width="932" , height="120"></canvas>
155197
<div class="flexBox">
156198
<div class="audioDiv">
157-
<button id="stereoButton">Stereo</button>
158-
<audio id="stereoPlayback"></audio>
199+
<button id="loudspeakerButton">Stereo</button>
200+
<audio id="loudspeakerPlayback"></audio>
159201
</div>
160202
<button id="playPauseButton" disabled="true"></button>
161203
<div class="audioDiv">
@@ -165,9 +207,8 @@ <h2>Audio Playback</h2>
165207
</div>
166208
</div>
167209
<div class="card" id="logBox"></div>
168-
<div class="fineprint" id="fineprint"><p>Built 2025-07-16 10:47:44 PDT - Renderers: <a href="https://resonance-audio.github.io/resonance-audio/">Resonance Audio</a> and <a href="https://github.com/ebu/bear">BEAR</a></p></div>
210+
<div class="fineprint" id="fineprint"><p>Built 2026-04-03 19:56:22 UTC - Binaural Renderer: <a href="https://www.github.com/google/obr">OBR</a></p></div>
169211
</div>
170-
<script src="./decoder/wasm/wrapper.js"></script>
171212
<script src="./app_bundle.js"></script>
172213
</body>
173214
</html>

0 commit comments

Comments
 (0)