setPlayMode
Sets the playback mode for the music resource.
virtual int setPlayMode(MusicPlayMode mode) = 0;
You can call this method to enable original, accompaniment, or guide vocal mode. If you do not call this method, accompaniment is played by default; if the music resource does not contain accompaniment, the original version is played.
Note: You can get detailed information about the music resource through the onMusicCollectionResult callback and determine the supported playback modes from the
result parameter.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
This method must be called after createMusicPlayer.
Parameters
- mode
- Playback mode. See MusicPlayMode.
Return Values
- 0: Success.
- < 0: Failure.
- -2: Invalid parameter. Please reset the parameter.