You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Lenny Turetsky (JIRA)" <ji...@apache.org> on 2013/03/02 06:29:13 UTC

[jira] [Created] (CB-2601) Android: Media.stopRecord fails to save file when a full file path is specified

Lenny Turetsky created CB-2601:
----------------------------------

             Summary: Android: Media.stopRecord fails to save file when a full file path is specified
                 Key: CB-2601
                 URL: https://issues.apache.org/jira/browse/CB-2601
             Project: Apache Cordova
          Issue Type: Bug
          Components: Android
            Reporter: Lenny Turetsky
            Assignee: Joe Bowser


The following JS code always results in a file with size 0, because the Java code at org.apache.cordova.AudioPlayer.moveFile(String) attempts to move the file to /mnt/sdcard/mnt/sdcard/anything.amr (note that /mnt/sdcard is duplicated).

var recordToFile = 'anything.amr';
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function gotFS(fileSystem) {
		console.error("file system root: " + fileSystem.root.fullPath);
		var recordFilePath = fileSystem.root.fullPath + '/' + recordToFile;
		console.log('creating ' + recordFilePath);
		fileSystem.root.getFile(recordToFile, {create: true, exclusive: false}, function gotFile(fileEntry) {
				console.log("creating media from " + JSON.stringify(fileEntry));
				console.log("file exists? " + fileEntry.file());
				listener = new Media(fileEntry.fullPath, function mediaStopped() {
					console.error("media done");
					showFileInfo(fileEntry);
				}, logToConsoleFunc("new Media"));

			function recorder(fileEntry) {
				showFileInfo(fileEntry);

				console.log("startRecord " + JSON.stringify(listener));
				listener.startRecord();

				setTimeout(function stopRecorder() {
					console.log("stopRecord " + JSON.stringify(listener));
					listener.stopRecord();
				}, RECORD_TIME_MS);
			}
			recorder(fileEntry);

			setTimeout(function() { showFileInfo(fileEntry); }, 2 * RECORD_TIME_MS);
		}, logToConsoleFunc("getFile"));
	}, logToConsoleFunc("requestFileSystem"));
});

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira