# How to play a Zoom Video SDK cloud recording When using the Zoom Video SDK cloud recording capabilities, developers may find themselves needing to provide playback of such recordings to application users. The Zoom Video SDK makes controlling every aspect of session cloud recording easy. Follow along this guide to see how to utilize Amazon CloudFront to enable cloud recording playback across the internet. ## Prerequisites 1. A Zoom [Video SDK Account](/docs/video-sdk/get-credentials/) with Cloud Recording Storage Plan 1. A [simple Video SDK web app](/blog/build-a-video-conferencing-app-with-the-zoom-video-sdk/) with an Express server 1. An AWS account or similar ## Cloud Recording with the Zoom Video SDK Zoom Video SDK sessions offer cloud recording in the two following ways: - [In-session SDK functions](https://marketplacefront.zoom.us/sdk/custom/web/modules/RecordingClient.html) to enable session hosts to start, pause, resume, and stop recordings within the client. - [Cloud recording APIs](/docs/api/video-sdk/#tag/cloud-recording) to enable developers to initiate and manage cloud recording functions via API. For the purpose of this walkthrough, we will be using **In-session SDK functions**. ### Initialize the [cloud recording client](https://marketplacefront.zoom.us/sdk/custom/web/modules/RecordingClient.html) After a Video SDK session is started, initialize the [cloud recording client](https://marketplacefront.zoom.us/sdk/custom/web/modules/RecordingClient.html) by calling the [`getRecordingClient`](https://marketplacefront.zoom.us/sdk/custom/web/modules/VideoClient.html#getRecordingClient) function on the [video client](https://marketplacefront.zoom.us/sdk/custom/web/modules/VideoClient.html). ```js const cloudRecording = client.getRecordingClient(); ``` ### Controlling the Video SDK cloud recording Start the cloud recording in-client by calling the [`startCloudRecording`](https://marketplacefront.zoom.us/sdk/custom/web/modules/RecordingClient.html#startCloudRecording) function on the `cloudRecording` client. ```js cloudRecording.startCloudRecording(); ``` Stop the cloud recording in-client by calling the [`stopCloudRecording`](https://marketplacefront.zoom.us/sdk/custom/web/modules/RecordingClient.html#startCloudRecording) function on the `cloudRecording` client. ```js cloudRecording.stopCloudRecording(); ``` ### Configure Zoom [Video SDK webhooks](/docs/api/video-sdk/events/) The Video SDK comes with a robust set of webhooks that developers can utilize to create dynamic relationships between multiple applications. These webhooks act as POST requests to our server, which are called when certain events occur within a Video SDK account. In our case, we will subscribe to the [`session.recording_completed`](/docs/api/video-sdk/events/#tag/session/POSTsession.recording_completed) webhook, which is triggered once a recorded session has ended. After the recording is briefly processed, the webhook request will be sent, along with a [request body](/docs/api/video-sdk/events/#tag/session/POSTsession.recording_completed) consisting of the relevant `download_files` array and `download_token`. ```js app.post('/webhooks, (req, res) => { ... switch (req.body.event) { ... case 'session.recording_completed': // download and upload logic goes here break ... } ... }) ``` Learn more about utilizing Zoom Video SDK Webhooks [here](/docs/api/webhooks/). ### Downloading Video SDK cloud recordings You can download the cloud recording to your server using a GET request with the `download_token` as the Bearer token in the Authorization header of your HTTP request. ```js fetch(download_url, { headers: { Authorization: "Bearer download_token", "Content-Type": "application/json", }, }); ``` ## Distribute cloud recordings with Amazon CloudFront A content delivery network (CDN) is a geographically distributed group of servers that allows for the quick transfer of web assets, such as HTML/JavaScript files, stylesheets, images, and videos. For this walkthrough, we will use Amazon CloudFront (CDN) in conjunction with an Amazon S3 (cloud object storage service) to store and deliver our video chat application's cloud recordings across the globe. To learn more about content delivery networks and AWS CloudFront, click [here](https://aws.amazon.com/what-is/cdn/). ### Create an Amazon CloudFront distribution You can create an Amazon CloudFront distribution in under a few minutes. Doing so will allow us to make objects in our cloud object storage service available for streaming across the internet. Follow [this tutorial](https://aws.amazon.com/getting-started/hands-on/deliver-content-faster/) for a guide to creating an S3 bucket and CloudFront distribution. Make sure to save your **distribution domain name** for use later in this walkthrough. ![](/img/blog/willezrine/playback/aws-cloudfront-dist-domain.png) ### Upload to Amazon S3 Now that we have our CloudFront distribution set up to deliver content in a S3 bucket, we must set up our server to programmatically upload the cloud recording files to the S3 bucket as they are completed. Once a `session.recording_completed` webhook request has been made to our server, we can download the cloud recording files and upload them to an AWS S3 bucket. We can do this easily by using the [`PutObject`](https://docs.aws.amazon.com/AmazonS3/latest/userguide/example_s3_PutObject_section.html) command of the [AWS S3 SDK](https://www.npmjs.com/package/@aws-sdk/client-s3). The `Key`, or **video file name**, will be used later on to identify the object in the S3 bucket. ```js import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3"; const client = new S3Client({}); export const main = async () => { const command = new PutObjectCommand({ Bucket: "test-bucket", Key: "cloud-recording.mp4", Body: "{FILE}", }); try { const response = await client.send(command); console.log(response); } catch (err) { console.error(err); } }; ``` ## Embedding the video Now that our cloud recording is able to be delivered across the internet, we are able to embed the video in a web app. We can do this by simply rendering a `