onPreLoadEvent

Callback for music resource preload events.

void onPreLoadEvent(String requestId, long songCode, int percent, String lyricUrl, int state, int reason)

After calling the preload method to preload a music resource, the SDK triggers this callback.

Trigger Timing

This callback is triggered after calling the preload method.

Parameters

requestId
Request ID, used to uniquely identify the request.
songCode
ID of the music resource, used to identify a music resource.
percent
Current loading progress of the music resource, ranging from [0, 100].
lyricUrl
Download URL of the lyrics.
state
Current loading state of the music resource:
  • 0: Load completed.
  • 1: Load failed.
  • 2: Loading.
reason
Request status code from Music Content Center:
  • MUSIC_CONTENT_CENTER_STATE_REASON_OK (0): Request successful.
  • MUSIC_CONTENT_CENTER_STATE_REASON_ERROR (1): General error, no specific attribution.
  • MUSIC_CONTENT_CENTER_STATE_REASON_GATEWAY (2): Gateway error. Possible reasons include:
    • The current temporary token has expired. Please regenerate the token.
    • The provided token is invalid. Please ensure you are using a valid token.
    • Network error. Please check your network connection.
  • MUSIC_CONTENT_CENTER_STATE_REASON_PERMISSION_AND_RESOURCE (3): Permission error or music resource not found. Please ensure that Music Content Center access permission is enabled for your project. Contact technical support if needed.
  • MUSIC_CONTENT_CENTER_STATE_REASON_INTERNAL_DATA_PARSE (4): Internal data parsing error. Please contact technical support.
  • MUSIC_CONTENT_CENTER_STATE_REASON_MUSIC_LOADING (5): Error occurred while loading music resource. Please contact technical support.
  • MUSIC_CONTENT_CENTER_STATE_REASON_MUSIC_DECRYPTION (6): Error occurred while decrypting music resource. Please contact technical support.
  • MUSIC_CONTENT_CENTER_STATE_REASON_HTTP_INTERNAL (7): Internal HTTP error. Please try again later.