You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Joe Bowser (JIRA)" <ji...@apache.org> on 2013/03/07 22:11:11 UTC

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

     [ https://issues.apache.org/jira/browse/CB-2601?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joe Bowser resolved CB-2601.
----------------------------

    Resolution: Fixed

Dude, this example is creepy!  The office was wondering who was shushing!
                
> 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
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> 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