You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Simon MacDonald (JIRA)" <ji...@apache.org> on 2012/08/20 18:15:37 UTC
[jira] [Resolved] (CB-1264) Media.stop() puts media into an
unplayable state.
[ https://issues.apache.org/jira/browse/CB-1264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Simon MacDonald resolved CB-1264.
---------------------------------
Resolution: Fixed
If you look at the state diagram for the Android MediaPlayer:
https://developer.android.com/reference/android/media/MediaPlayer.html#StateDiagram
you will see when you call stop() on the player it goes into the stop state which is a final state. There is no way out of it.
I've made a change so that when you call media.stop() from the JS side that it is interpreted as a pause and rewind to the beginning of the file so that the next time you press play it will start from the beginning.
> Media.stop() puts media into an unplayable state.
> -------------------------------------------------
>
> Key: CB-1264
> URL: https://issues.apache.org/jira/browse/CB-1264
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.6.1, 1.7.0, 1.8.0, 1.8.1, 1.9.0, 2.0.0
> Reporter: Simon MacDonald
> Assignee: Simon MacDonald
> Fix For: 2.1.0
>
>
> 1. Record something – recording will stop after 10 seconds, or just hit the ‘stop record’ button
> 2. Play it back – should play back fine
> 3. Play it again, but hit ‘stop’ half way through
> 4. Now try and play again – you will get the ‘state’ errors below – it appears that using ‘media.stop’ is ‘breaking’ the internal state of the media, but letting the media stop of it’s own accord is just fine.
> After calling ‘.stop()’ ,and then trying to call ‘.play()’ again, Logcat spits out a bunch of errors such as:
>
> >>>>>>>>>>>>
> 08-20 12:20:32.381: E/MediaPlayer(13077): Attempt to perform seekTo in wrong state: mPlayer=0x190f478, mCurrentState=64
> 08-20 12:20:32.381: E/MediaPlayer(13077): error (-38, 0)
> 08-20 12:20:32.381: E/MediaPlayer(13077): Error (-38,0)
> 08-20 12:20:32.381: E/MediaPlayer(13077): mOnErrorListener is null. Failed to send MEDIA_ERROR message.
> 08-20 12:20:32.381: E/MediaPlayer(13077): pause called in state 0
> 08-20 12:20:32.381: E/MediaPlayer(13077): error (-38, 0)
> 08-20 12:20:32.381: E/MediaPlayer(13077): Error (-38,0)
> 08-20 12:20:32.381: E/MediaPlayer(13077): mOnErrorListener is null. Failed to send MEDIA_ERROR message.
> 08-20 12:20:32.381: E/MediaPlayer(13077): start called in state 0
> 08-20 12:20:32.381: E/MediaPlayer(13077): error (-38, 0)
> 08-20 12:20:32.381: E/MediaPlayer(13077): Error (-38,0)
> 08-20 12:20:32.381: E/MediaPlayer(13077): mOnErrorListener is null. Failed to send MEDIA_ERROR message.
> <<<<<<<<<<<<<<
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira