Skip to main content

Guide

Importing the SDK:
import (
	avatarsdkgo "github.com/spatialwalk/avatar-sdk-go"
)
Initialization:
	session := avatarsdkgo.NewAvatarSession(
		avatarsdkgo.WithAPIKey(...),
		avatarsdkgo.WithConsoleEndpointURL(...),
		avatarsdkgo.WithIngressEndpointURL(...),
		avatarsdkgo.WithAvatarID(...),
		avatarsdkgo.WithExpireAt(...),
		avatarsdkgo.WithTransportFrames(func(data []byte, last bool) {
			// transport frame, and end indicator
		}),
		avatarsdkgo.WithOnError(func(err error) {
			// handle session error
		}),
		avatarsdkgo.WithOnClose(func() {
			// handle session close
		}),
	)

	if err := session.Init(ctx); err != nil {
		// handle init error
	}

	connectionID, err := session.Start(ctx)
	if err != nil {
		// handle start error
	}
	defer func() {
		if closeErr := session.Close(); closeErr != nil {
			// handle close error
		}
	}()
Sending audio data:
	requestID, err := session.SendAudio(audioData, true)
	if err != nil {
		// handle send audio error
	}

Github Repository

The Golang SDK is available on GitHub: https://github.com/spatialwalk/avatar-sdk-go . If you encounter any issues or have questions, please feel free to open an issue in the repository.