onRhythmPlayerStateChanged

Callback for changes in virtual metronome state.

public void onRhythmPlayerStateChanged(int state, int reason)

This callback reports the current state of the virtual metronome, indicating the state of the local audio stream and helping you troubleshoot audio issues.

Trigger Timing

This callback is triggered when the state of the virtual metronome changes.

Parameters

state
The current state of the virtual metronome:
  • RHYTHM_PLAYER_STATE_IDLE (810): The virtual metronome is not enabled or has been disabled.
  • RHYTHM_PLAYER_STATE_OPENING (811): Opening the rhythm file.
  • RHYTHM_PLAYER_STATE_DECODING (812): Decoding the rhythm file.
  • RHYTHM_PLAYER_STATE_PLAYING (813): The rhythm file is playing.
  • RHYTHM_PLAYER_STATE_FAILED (814): Failed to start the virtual metronome. You can use the returned error code to troubleshoot or try restarting the virtual metronome.
reason
Error codes and messages for the virtual metronome:
  • RHYTHM_PLAYER_REASON_OK (0): The rhythm file is playing normally.
  • RHYTHM_PLAYER_REASON_FAILED (1): General error, unspecified reason.
  • RHYTHM_PLAYER_REASON_CAN_NOT_OPEN (801): Error occurred while opening the rhythm file.
  • RHYTHM_PLAYER_REASON_CAN_NOT_PLAY (802): Error occurred while playing the rhythm file.
  • RHYTHM_PLAYER_REASON_FILE_OVER_DURATION_LIMIT (803): The duration of the rhythm audio file exceeds the limit. The maximum is 1.2 seconds.