You can pass a properties object that configures the AvaturnHead object.
preloadBundle
parameter controls the preloading of the JavaScript bundle required for the SDK to function properly.Why is this important?When preloading is enabled (preloadBundle: true
), the SDK automatically loads and caches all necessary resources (JavaScript bundle) before they are actually needed. This reduces the delay during the first interaction with the SDK, improving performance and providing a smoother user experience.When should you use preloading?preconnect
parameter controls the preconnection of the avatar to the stream before the session has been fully initialized.Why is this important?When preconnection is enabled (preconnect: true
), the SDK preemptively connects the avatar to the stream even if the session has not been fully initialized yet. This reduces the delay in establishing a connection with the server, which is particularly useful for scenarios where the avatar needs to be ready for interaction with minimal latency.When should you use preconnection?keepAlive
parameter controls whether the connection to the stream will be maintained if there is no interaction with the avatar for five minutes.Why is this important?When the keepAlive
flag is set to true
, the SDK keeps the stream connection active even if there has been no interaction with the avatar for five minutes. This is useful in scenarios where you need the stream to remain active despite temporary inactivity.If keepAlive
is set to false
, the SDK will automatically disconnect the stream after five minutes of inactivity, helping to conserve resources.When should you use keepAlive?