setPlayMode

Sets the playback mode of the music track.

int setPlayMode(MusicPlayMode mode);

If you do not call this method to set the playback mode, the default is vocal accompaniment. If the music resource does not contain vocal accompaniment, the original vocal will be played.

Note: You can obtain detailed information about the music resource through the onMusicCollectionResult callback, and use the list parameter in this callback to check the supported playback modes for the copyrighted music.

Scenario

In entertainment scenarios such as online karaoke or talent shows, if you need to play copyrighted music provided by the Agora Content Center, you can call this method to set the playback mode.

Timing

You must call this method after calling the createMusicPlayer method.

Parameters

mode
Playback mode. See MusicPlayMode.

Return Values

  • 0: Success.
  • < 0: Failure.
    • -2: Invalid parameter. Please reset the parameter.