Set Playback State Details
You can pick and choose which elements of the playback state you want to control in the call, and add only those parameters to the request you wish to change or control. Depending on the parameters you have in the request, and the current state of Bottango’s playback, some of the requested changes may happen in a sequence in order to fully resolve the request.
Changing Selected Animation
Section titled “Changing Selected Animation”The selected animation index and selected animation name parameter fill the same purpose. If both are in the request, only the index will be used. If you use name, and multiple animations in the project have the same name, the call will return an error.
If you call to change the selected animation while playing, Bottango will stop playing and then switch. This can be overridden by including isPlaying to True in the request.
If you’re not sure what animation has which index, use the /Animations/ call above to get an ordered list of all animations in the project.
Changing Playhead Time
Section titled “Changing Playhead Time”If you change the playhead time while Bottango is currently playing, Bottango will stop playing and then jog to the requested time. This can be overridden by including isPlaying to True in the request, in which case Bottango will jog to the requested time, and then begin playing again.
If you include this parameter in a request that also changes the selected animation, Bottango will use the requested time as the starting time of the requested animation, instead of the default behavior which is the current time.
Starting / Stopping Play
Section titled “Starting / Stopping Play”On its own, this parameter acts the same as pressing start or stop. When combined with changing the selected animation and/or the playhead time, setting this parameter to true will override the default behavior of stopping an existing playback on switching time/animation, and instead make the switch then resume playing.
Starting / Stopping Recording
Section titled “Starting / Stopping Recording”This follows the same behavior as starting / stopping play, but will result in a recording session beginning instead of a play session if set to true. If you set the value of isRecording, any value on isPlaying will be ignored.
/PlaybackState/int selectedAnimationIndexstring selectedAnimationNamebool isPlayingbool isRecordingint playbackTimeInMSnoneExample
Section titled “Example”import requestsimport json
port = 59224baseUrl = 'http://localhost:{}/'.format(port)
requestUrl = baseUrl + 'PlaybackState/'try: requestParams = {}
# change selected animation requestParams['selectedAnimationIndex'] = 0 # optional, if you want to change selected animation. Otherwise keeps existing animation #requestParams['selectedAnimationName'] = 'myAnim' # optional, same as index, you can use either. Only index will be used if both are present. # if you switch animation while playing, Bottango will stop unless requested with isPlaying # returns an error if you try and select an animation with the same name as another animation.
# change the current playhead time in Milliseconds requestParams['playbackTimeInMS'] = 2000 # optional # if you change time while playing, Bottango will stop unless requested with isPlaying # if starting play in the same request, will jog to requested time then start # if switching to new animation in the same request, will use this time for the jog instead of the current time
# change the desired playback state requestParams['isPlaying'] = True # optional, if you want to change whether playing selected animation or not. # Also include as True if you want to maintain playing after changing time or clip # otherwise changing time and or clip stops playing.
# change the desired recording input state # requestParams['isRecording'] = False # optional, if you want to change whether recording live controller input into selected animation or not. # Also include as True if you want to begin recording after changing time or clip # isPlaying will be ignored if isRecroding is set
response = requests.put(requestUrl, json=requestParams) response.raise_for_status()
except requests.exceptions.RequestException as e: raise SystemExit(e)