destroySDK()
Performs a clean teardown of the SDK, removing all field observers, ending the active session, and hiding the panel.
Description
Call this function when you are done using the SDK for the current session. It sends session-end
analytics events, removes all field observers, and hides the panel node. Returns true if the
teardown succeeded, or false if an error occurred during cleanup.
After calling destroySDK(), the isReady field is
set to false. To restart the SDK without recreating the node, use
restartSDK().
Usage
result = m.lib.callFunc("destroySDK")
Returns
boolean — true if the SDK was destroyed successfully; false if an error occurred during
teardown.
When to Use
Use this function when:
- The user exits the event or video
- Your application is shutting down
- You need to completely reset the SDK state before a new session
- Navigating away from the video player
Example
' Clean up SDK when exiting an event
sub onExitEvent()
if m.lib <> invalid
success = m.lib.callFunc("destroySDK")
if not success
print "SDK teardown encountered an error"
end if
m.lib = invalid
end if
end sub
Notes
- Always call this function before removing the SDK node to prevent memory leaks.
destroySDK()hides the panel (visible = false). If you intend to reuse the node, callrestartSDK()instead, which re-initializes the SDK after teardown.onPlayerTimeCodeUpdated()is a no-op while the SDK is destroyed (isReady = false).