const {
activate,
getState,
cleanup,
onCleanup,
playbackActions,
subscribe,
use,
} = createPlayback({
id: "playback",
})
// Start playback when the DOM element is available
activate()
// Get current playback state
const currentState = getState()
// Control playback (e.g., mute audio)
playbackActions.setMuted(true)
// Listen for state changes
const unsubscribe = subscribe(({ state, updatedProperties }) => {
console.log("State updated:", state)
})
// Register a cleanup callback
onCleanup(() => {
console.log("cleanup is called")
})
// Destroy the playback instance
cleanup()
// Extend functionality with a plugin
use(plugin)