Interactive 3D avatar with voice conversation capabilities powered by Hollo AI
// Coming soon: Send game events that the AI can respond to with voice
// Example: Player chat message triggers AI response
sendAvatarEvent('PLAYER_CHAT', {
playerId: 'player1',
playerName: 'Alice',
message: 'Hello, how do I play this card?'
});
// The AI will:
// 1. Receive the chat message
// 2. Process it with context awareness
// 3. Respond with synthesized voice
// 4. Trigger appropriate avatar animations
// Example: Game state change triggers AI commentary
sendAvatarEvent('CARD_PLAYED', {
playerId: 'player1',
cardId: 'ace_spades',
isWinningMove: true
});
// AI responds: "Excellent play! The Ace of Spades..."
// Avatar plays 'excited' animation<!-- HTML: Embed the voice-enabled avatar -->
<iframe
id="voiceAvatar"
src="https://pc-debug.pstack.ai/embed-voice"
width="100%"
height="700"
style="border: none;"
allow="microphone"
></iframe>
<!-- IMPORTANT: The 'allow="microphone"' attribute is required -->
<script>
// Listen for status updates from the embed
window.addEventListener('message', (event) => {
if (event.data?.type === 'VOICE_STATUS') {
console.log('Voice status:', event.data.status);
// status can be: 'connecting', 'connected', 'disconnected'
}
if (event.data?.type === 'AI_RESPONSE') {
console.log('AI said:', event.data.text);
// You can use this to sync game state with AI responses
}
});
</script>