Bug 228971 - decodeAudioData should support .mov files recorded by iPhone
Summary: decodeAudioData should support .mov files recorded by iPhone
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Audio (show other bugs)
Version: Safari 14
Hardware: iPhone / iPad iOS 14
: P2 Normal
Assignee: Nobody
Keywords: InRadar
Depends on:
Reported: 2021-08-10 14:36 PDT by Rob
Modified: 2021-08-17 14:37 PDT (History)
4 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Rob 2021-08-10 14:36:46 PDT
In Safari for iOS, the decodeAudioData method of the WebAudio api is unable to extract an audio buffer from .mov videos recorded with iPhone, despite the fact that the <video ...> element can play these videos and their audio correctly.

Running the following example from Safari in an iPhone X, the 'it failed... err:' alert is always shown when attempting to load a .mov file recorded with the phone:

<!DOCTYPE html>
<html lang="en">
	<meta charset="UTF-8">
	<title>decodeAudioData test</title>]
<input type="file" accept="video/*" id="video-test-input">
	const fileSelector = document.getElementById('video-test-input')
	fileSelector.addEventListener('change', e => {
		const [file] = e.target.files

		const reader = new FileReader()

		reader.addEventListener('load', () => {
			new AudioContext({sampleRate: 44100})
					.decodeAudioData(reader.result, function(buffer) {
						alert('it worked! duration: ' + buffer.duration)
					}, function (err) {
						alert('it failed... err: ' + err)

		reader.addEventListener('error', () => alert('file read failed... err: ' + reader.error))


mp4 videos work fine with this example, but it limits the utility of this feature a lot when the videos natively recorded by the device can't be used.
Comment 1 Radar WebKit Bug Importer 2021-08-17 14:37:26 PDT