APMediaPlayer crash when returning back to object

edited November 2013 in Android Mode

Hey all,

I have been using the APMediaPlayer class to control misc. audio in my Android app and its been working great. I have a simple switch case that allows me to cycle through some audio tracks. When I return to the original state, it crashes with a java.lang.illegalstateexception (yes thats a generalized statement... here is my issue that is been reported on the official wiki : https://code.google.com/p/apwidgets/issues/detail?id=8 )

Has anyone found a workaround? I know I could use the function "pause" but for my means, it won't completely null out the unused class objects which will bite me in the ass for the long haul.

cheers!

Answers

  • Answer ✓

    This is probably because Processing seems unable to detect the back button press. The library probably tries to use Processing's method of detecting (which doesn't work) and crashes. As far as I know, there is no way around this at present. APWidgets could potentially implement a solution using native methods.

  • edited November 2013

    I may have mispoken.

    to write a brief example, here is my implementation and with a comment pertaining to my error:

                    void loop(){
    
    
                    switch(StateMachine){
    
    
                    case STATE1:
    
    
                    myPlayer.start();
    
                    if(thisVal == thatVal){
    
                    myPlayer.release();
    
                    StateMachine = mainStates.STATE2;
    
                    }
    
                    break;
    
    
                    case STATE2:
    
                    secondPlayer.start();
    
                    if(thatVal == thisNow){
                    secondPlayer.release();
    
                    StateMachine = mainStates.STATE1;
    
                    //At this point, the state machine initializes first state, then crashes on the APMediaPlayer instantiation.  
    
                    }
                break;
    
                    }
    
    
    
    
                    }
    
                    super.onDestroy(); 
                      if (myPlayer != null) { 
                        myPlayer.release();
                      }
                      if (secondPlayer != null) { 
                        secondPlayer.release();
                      }
    
  • edited November 2013

    and the error message below: (sorry for so many posts... its the forum)

Sign In or Register to comment.