In a world that craves dynamic interactions and immersive experiences, the realm of technology keeps pushing the boundaries of what’s possible. Imagine a platform that combines the magic of real-time audio transmission with animated VR avatars.
At WebRTC.ventures, we’re pioneers in harnessing the power of WebRTC to create extraordinary connections. In this blog post, we learn how to transmit audio via WebRTC and receive animated video talking portraits — otherwise known as “avatars”.
At the heart of this unique and engaging experience is a symphony of technologies orchestrated to redefine how we can communicate and interact online.
The backbone of the backend WebRTC functionality is powered by the aiortc library. This enables seamless server side real-time communication to relay streams between users over the web. The primary focus is to integrate the audio stream with an animated VRM avatar, thereby enhancing the interactive experience.
There are three important components to this mix:
We use the WebRTC API to listen for new audio track received. When received, we will need to pass it to a custom VRMAvatar.js
that does the animation.
import VRMAvatar from "./VRMAvatar.js";
// Instantiate the VRMAvatar class
const myVRM = new VRMAvatar('./models/VRM1_Constraint_Twist_Sample.vrm');
// Call the animate function to display avatar and start the animation with audio stream
myVRM.animate();
myVRM.initializeVoiceToAvatar(audioStream); // passing audio (type MediaStream)
There are three steps here:
VRMAvatar
class is the key to bringing VR avatars to life. animate
function, and behold as your chosen VRM avatar springs to life! The animation loop begins, and the avatar is live.initializeVoiceToAvatar
function links audio streams with avatar mouth movementsView the demo project on Github and watch the demo below.
The potential of this project spans realms:
We’re not just WebRTC experts – we’re architects of experiences that bridge technology and humanity. If you need help building new extraordinary experiences or need to improve your WebRTC application, reach out to us.
At WebRTC.ventures, we don’t just build applications, we build better connections!