Introduction
Imagine you’re watching a captivating keynote session from your favorite conference, and you’re welcomed with a personalized stream just for you. This tutorial demonstrates how to create dynamic video streams by integrating data from custom databases and external APIs. We’ll use a practical example: a recording of a Config 2023 keynote session. By using VideoDB, we’ll show how companies like Figma can personalize the viewing experience for their audience, delivering a richer and more engaging experience. We’ll showcase how to:- Fetch data from a random user API to represent a hypothetical viewer.
- Integrate this data into a custom VideoDB timeline.
- Create a personalized stream that dynamically displays relevant information alongside the keynote video.
Setup
Installing packages
API Keys
Before proceeding, ensure access to VideoDB Get your API key from VideoDB Console. ( Free for first 50 uploads, No credit card required)Steps
Step 1: Connect to VideoDB
Begin by establishing a connection to VideoDB using your API key:🗳️ Step 2: Upload Base Video
Upload and play the video to ensure it’s correctly loaded. We’ll be using this video for the purpose of this tutorial.Step 3: Fetch Data from a Random User API
This code fetches a random user’s data (name and picture) from the “randomuser.me” API. You can adapt this to retrieve data from any relevant API (e.g., product data, news articles) for your use case.Step 4: Upload the image to VideoDB
- First we download the image to local storage
- Then we use the local path to upload it to VideoDB
Step 5: Create VideoDB Assets
We create VideoDB assets for the base video, the user’s name (text), and their picture (image) using the new Editor SDK. TheFont and Background objects allow us to customize the appearance of text elements.
↔️ Step 6: Create the VideoDB Timeline
Using theTrack and Clip pattern, we arrange and layer assets to create a dynamic video stream. The main video goes on one track, while overlays (name, message, image) go on separate tracks with their start times.
▶️ Step 7: Generate and Play the Personalized Stream
Thegenerate_stream() method creates a streamable URL for your personalized video stream. You can then use play_stream() to preview it in your browser.
Conclusion
This tutorial showcased how to create personalized video streams using VideoDB. By integrating data from external APIs and custom databases, you can enhance your video content, personalize user experiences, and unlock new possibilities for engagement. Explore various data sources, experiment with different integrations, and customize your video streams to suit your specific needs.Explore Full Notebook
Open the complete implementation in Google Colab with all code examples.