Skip to content

Audio record ios 11 no data #324

Open
@iamrototo

Description

Since iOS 11 and the support of getusermedia, I would like to use the record feature for safari on iPad but is not working at all.

I checked this issue (#275). I have adapted my code to use StereoAudioRecorder. I get no error in the console but just that I record nothing (the data is 44 Bytes and is just empty) despite it works on chrome (PC).

Here is my dumb test index. I try to record the voice of the user for 1 second and then I stop and get the data. To easily debug I push in the html the base64 and I have a quick audio html5 to be able to play the sound.

<!DOCTYPE html>
<html>
<head>
<script  src="https://webrtcexperiment-webrtc.netdna-ssl.com/RecordRTC.js"></script>
<script  src="https://cdn.webrtc-experiment.com/gumadapter.js"></script>
</head>

<body>
<audio id="toto" controls></audio>
<div id="result" style="max-width:500px;     word-wrap: break-word; "></div>

<script>

function successCallback(audioStream) {
    // RecordRTC usage goes here
	
	var recordRTC = RecordRTC(audioStream, {recorderType: StereoAudioRecorder});
	recordRTC.startRecording();
	
	setTimeout(
		function() {recordRTC.stopRecording(function(audioURL) {
			var recordedBlob = recordRTC.getBlob();
			recordRTC.getDataURL(function(dataURL) { 
			    var audio = document.querySelector('audio');
                audio.src = dataURL;
			    document.getElementById("result").innerHTML = dataURL;
			});
		});}, 1000);
}

function errorCallback(error) {
    // maybe another application is using the device
}

var mediaConstraints = { audio: true };

navigator.mediaDevices.getUserMedia(mediaConstraints).then(successCallback).catch(errorCallback);

</script>
</body>
</html>

Thanks for your help.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions