[
https://issues.apache.org/jira/browse/CB-8020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Aaron Ruß updated CB-8020:
--------------------------
Description:
On Android, if a Media object is only used for playing a sound, i.e. not for
recording, then, on releasing the media object, an error is logged to the
LogCat console, complaining about a failed attempt to rename the temporary file
(that is used for recording audio).
Example LogCat output (after releasing the Media object):
{panel}
11-14 13:57:14.138: V/MediaPlayer(29175): destructor
11-14 13:57:14.138: V/MediaPlayer(29175): disconnect
11-14 13:57:14.138: D/AudioPlayer(29175): renaming
/storage/emulated/0/tmprecording.3gp to
/android_asset/www/audio/beep-notification.mp3
{color:red}11-14 13:57:14.138: E/AudioPlayer(29175): FAILED renaming
/storage/emulated/0/tmprecording.3gp to
/android_asset/www/audio/beep-notification.mp3{color}
{panel}
Solution:
in the AudioPlayer class, do not create the MediaRecorder (for audio recording)
on object creation (i.e. in the AudioPlayer's constructor), but instead create
it lazily, only if/when the AudioPlayer is used for recording audio (i.e. in
method {{startRecording(String)}}).
Example solution see:
https://github.com/mmig/cordova-plugin-media/commit/66ac88689cb092179cdc3eda3bd64b1d8616077e
NOTE:
I did run the unit tests from plugin {{org.apache.cordova.media.tests}}
successfully with the changes as linked above to the GitHub repository
(on a Samsung Note 10 device with Android 4.4.2)
was:
On Android, if a Media object is only used for playing a sound, i.e. not for
recording, then, on releasing the media object, an error is logged to the
LogCat console, complaining about a failed attempt to rename the temporary file
(that is used for recording audio).
Example LogCat output (after releasing the Media object):
11-14 13:57:14.138: V/MediaPlayer(29175): destructor
11-14 13:57:14.138: V/MediaPlayer(29175): disconnect
11-14 13:57:14.138: D/AudioPlayer(29175): renaming
/storage/emulated/0/tmprecording.3gp to
/android_asset/www/audio/beep-notification.mp3
{color:red}11-14 13:57:14.138: E/AudioPlayer(29175): FAILED renaming
/storage/emulated/0/tmprecording.3gp to
/android_asset/www/audio/beep-notification.mp3{color}
Solution:
in the AudioPlayer class, do not create the MediaRecorder (for audio recording)
on object creation (i.e. in the AudioPlayer's constructor), but instead create
it lazily, only if/when the AudioPlayer is used for recording audio (i.e. in
method {{startRecording(String)}}).
Example solution see:
https://github.com/mmig/cordova-plugin-media/commit/66ac88689cb092179cdc3eda3bd64b1d8616077e
NOTE:
I did run the unit tests from plugin {{org.apache.cordova.media.tests}}
successfully with the changes as linked above to the GitHub repository
(on a Samsung Note 10 device with Android 4.4.2)
> avoid error message in console for failed renaming of recording-file (if
> Media object was only used for playing)
> ----------------------------------------------------------------------------------------------------------------
>
> Key: CB-8020
> URL: https://issues.apache.org/jira/browse/CB-8020
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android, Plugin Media
> Reporter: Aaron Ruß
> Priority: Minor
> Original Estimate: 10m
> Remaining Estimate: 10m
>
> On Android, if a Media object is only used for playing a sound, i.e. not for
> recording, then, on releasing the media object, an error is logged to the
> LogCat console, complaining about a failed attempt to rename the temporary
> file (that is used for recording audio).
> Example LogCat output (after releasing the Media object):
> {panel}
> 11-14 13:57:14.138: V/MediaPlayer(29175): destructor
> 11-14 13:57:14.138: V/MediaPlayer(29175): disconnect
> 11-14 13:57:14.138: D/AudioPlayer(29175): renaming
> /storage/emulated/0/tmprecording.3gp to
> /android_asset/www/audio/beep-notification.mp3
> {color:red}11-14 13:57:14.138: E/AudioPlayer(29175): FAILED renaming
> /storage/emulated/0/tmprecording.3gp to
> /android_asset/www/audio/beep-notification.mp3{color}
> {panel}
> Solution:
> in the AudioPlayer class, do not create the MediaRecorder (for audio
> recording) on object creation (i.e. in the AudioPlayer's constructor), but
> instead create it lazily, only if/when the AudioPlayer is used for recording
> audio (i.e. in method {{startRecording(String)}}).
> Example solution see:
> https://github.com/mmig/cordova-plugin-media/commit/66ac88689cb092179cdc3eda3bd64b1d8616077e
> NOTE:
> I did run the unit tests from plugin {{org.apache.cordova.media.tests}}
> successfully with the changes as linked above to the GitHub repository
> (on a Samsung Note 10 device with Android 4.4.2)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]