Fabrizio created CB-7062:
----------------------------
Summary: Media file: renameTo method can not move between
different mount point
Key: CB-7062
URL: https://issues.apache.org/jira/browse/CB-7062
Project: Apache Cordova
Issue Type: Bug
Components: Plugin Media
Affects Versions: 3.5.0
Environment: Android
Reporter: Fabrizio
I am using the Media plugin to record audio. I would like to store the audio
tracks in the data/data/{PackageName}/files folder.
Based on
https://github.com/apache/cordova-plugin-media/blob/master/src/android/AudioPlayer.java#L182
the plugin is using renameTo
renameTo on Android works only if both paths are on the same mount point. (
http://developer.android.com/reference/java/io/File.html#renameTo%28java.io.File%29
)
On my Android 4.2.2 I get an error:
E/AudioPlayer( 8514): FAILED renaming /storage/emulated/0/tmprecording.3gp to
/data/data/com.example.hello/files/audiofile.mp3
Android can not move the file from /storage to /data
The silly part is that moveFile method does not return false if the files can't
be moved therefore the Success callback is still called.
I fixed it commenting out
https://github.com/apache/cordova-plugin-media/blob/master/src/android/AudioPlayer.java#L99
and L100, L103. I am not sure which kind of implications that might cause on
other devices.
--
This message was sent by Atlassian JIRA
(v6.2#6252)