[ 
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):
{{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 
is lazily, only if/when the AudioPlayer is used for recording audio (i.e. in 
method {{startRecording(String)}}).

  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
11-14 13:57:14.138: E/AudioPlayer(29175): FAILED renaming 
/storage/emulated/0/tmprecording.3gp to 
/android_asset/www/audio/beep-notification.mp3}}


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 
is lazily, only if/when the AudioPlayer is used for recording audio (i.e. in 
method {{startRecording(String)}}).


> 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):
> {{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 is lazily, only if/when the AudioPlayer is used for recording 
> audio (i.e. in method {{startRecording(String)}}).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to