Bug 228971

Summary: decodeAudioData should support .mov files recorded by iPhone
Product: WebKit Reporter: Rob <rallsopp06>
Component: Web AudioAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: cdumez, jer.noble, rallsopp06, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 14   
Hardware: iPhone / iPad   
OS: iOS 14   

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