When creating a KTV Robot via CreateKTVRobotRequest, you can provide an array of SyncRobotCommand objects to initialize the robot with specific instructions. These commands are executed in the order provided.
Supported Command values include:
Play: Start playback.Pause: Pause playback.SwitchPrevious: Play the previous song.SwitchNext: Play the next song.SetPlayMode: Change the playback mode.Seek: Adjust playback position.SetPlaylist: Change the playlist.SetAudioParam: Change audio parameters.SendMessage: Send a custom message.SetDestroyMode: Set the room destruction mode.SetRealVolume: Set the actual volume (replaces the deprecated SetVolume).
Each command requires its corresponding input object (e.g., PlayCommandInput for Play, SeekCommandInput for Seek).
// Example of initializing a robot with commands
const request: CreateKTVRobotRequest = {
RTCSystem: 'TRTC',
JoinRoomInput: { /* ... */ },
SyncRobotCommands: [
{
Command: 'SetRealVolume',
SetRealVolumeCommandInput: { RealVolume: 70 }
},
{
Command: 'Play',
PlayCommandInput: { Index: 0 }
}
]
};