-
Type:
Bug
-
Status: Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 3.5.0
-
Fix Version/s: None
-
Component/s: cordova-plugin-media
-
Labels:None
-
Environment:
Android
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.