On-demand playback scrubbing with Amazon IVS and Zoom Video SDK
When processing a local video stream, your application may produce an alert that requires attention to be brought to the Video SDK session, specifically with the ability to scrub the video footage, or, in other words, go back in time and toggle between the video on demand (VOD) and live footage.
Though Zoom Video SDK does not currently have an API to natively play past footage from a video session, in this blog post we'll explore how your application can stream video via RTMP to Amazon Interactive Video Service (IVS), enabling you to play back the video footage with the ability to switch between VOD and live.
Disclaimer: The demo project referenced in this blog post, produced by Amazon Web Services (AWS), will consume AWS resources, which will cost money.
Getting started
As the remainder of this blog post will reference Amazon's IVR DVR Web Demo, visit their GitHub repository and clone it to your machine, ensuring that all required prerequisites are downloaded and installed:
- AWS CLI - Used to create the necessary AWS CloudFormation stack
- Node.js - Used to create AWS Lambda instances, as well as run the pre-built Web UI
Spinning up an AWS stack
Following the instructions on the GitHub repository, run the following command in the cdk directory to spin up an AWS stack that will:
- Create an IVS channel that can be used with Zoom Video SDK
- Set up and pre-configure Auto-Record to S3
- Create Lambda resources to process/modify VOD content
- Create a CloudFormation distribution stack to serve content to your Web UI
$ make app
Once the stack has fully deployed, the CLI will output some content to your terminal window, which will look similar to the following:
DVRdemoStack.distributionDomainName = d1evkv4hrbjivg.cloudfront.net
DVRdemoStack.ingestServer = rtmps://a1f1502424b1.global-contribute.live-video.net:443/app/
DVRdemoStack.playbackUrl = https://a1f1502424b1.us-east-1.playback.live-video.net/api/video/v1/us-east-1.211125612349.channel.KW6VS9cKT1E3.m3u8
DVRdemoStack.streamKey = sk_us-east-1_lfo7MaPSIILK_XWNBM6dG6LJdxUW1dgtq9VZMAHmyO3
In the output, there are two main pieces of information that we will need for use with Video SDK: ingestServer and streamKey.
Starting a livestream with Video SDK
To begin streaming content to IVS, fetch the LiveStreamClient namespace from the Video SDK, invoking the startLiveStream() function with the following IVS-to-Video SDK mappings:
- IVS
ingestServeroutput tostreamUrlVideo SDK argument - IVS
streamKeyoutput tostreamKeyVideo SDK argument
For the final function argument, broadcastUrl, this can be the publicly available broadcast URL used to view the live stream, or, if you don't wish to provide a URL, "https://zoom.us" can be used instead.
const liveStreamClient = zoomClient.getLiveStreamClient();
await liveStreamClient.startLiveStream(
"rtmps://a1f1502424b1.global-contribute.live-video.net:443/app/",
"sk_us-east-1_lfo7MaPSIILK_XWNBM6dG6LJdxUW1dgtq9VZMAHmyO3",
"https://zoom.us",
);
Viewing the live stream
Once the live stream has started via Zoom’s Video SDK, pointing to the IVS instance that was output in the Getting started section above, you can now view the live stream and scrub between VOD and live footage using the pre-built Web UI from Amazon’s GitHub repository.
Conclusion
As demonstrated in this post, if you're looking for the ability to switch between VOD and live content, enabling your customers to review past footage on-demand, with just a few lines of code, this can be accomplished quickly and easily using a combination of Amazon IVS and Zoom's Video SDK.