WKWebView
.
All data input from ios app will be sent to the webview and takes effect after handling.
Therefore, please turn on Outgoing Connections (Client)
, otherwise webview will not work.
AvatarViewModel()
. It contain various data for creating the AvatarView
.
AvatarView
in body with the stateObject to create the canvas.
Full example
Emotions
viewModel.availableEmotion
viewModel.currentEmotion
Lip-sync
audioSource
or rawBase64Audio
from the stateObject.If your audio source is an url, you should pass the string to the webview with audioSource
.If your audio source is in data format, you should encode it with base64 format using base64EncodedString()
and pass the data to the webview with rawBase64Audio
.The audio will be played and lip-sync will start automatically once the value is changed.If you send another audio to webview while previous audio is playing, webview will automatically store the new audio and play it after previous audio end.Field | Type | Description |
---|---|---|
avatarId | String | The id of the avatar you created. You can create you own avatar at here! |
x | Float | The position of the avatar on the x axis. |
y | Float | The position of the avatar on the y axis. |
scale | Float | The scale of the avatar. Default is set to ‘1’. |
rotation | Float | Set the value between 0 and 1 to rotate the avatar. |
currentEmotion | String | The emotion avatar is currently showing. Changing this value to make the avatar express emotion. Emotions the avatar can express is stored at availableEmotion . |
availableEmotion | String[] | An array of string containing all available emotion the avatar can express. Pass one of those string to currentEmotion will change the emotion. |
audioSource | String | The source of the audio, usually an Url. The audio will be played automatically once the value is changed. |
rawBase64Audio | String | The source of the audio which is encoded with Base64 format. Usually used with base64EncodedString() to encode the audio data. |