Play recorded files online
Introduction
The Agora server automatically uploads the recorded files in TS format to the cloud storage that you set up, and generates an M3U8 file as a playlist pointing to all the recorded TS files. You can get the URL of the M3U8 file and play it online.
If Agora Cloud Recording generates WebM files instead of TS files, you cannot play the M3U8 file online.
Implementation
Before you start, ensure that all the recorded files are uploaded (the uploadingStatus
in the response of stop
is "uploaded"
).
We use Amazon S3 as an example to show you how to play the recorded files online.
-
Log in the Amazon S3 console.
-
Go to the Overview page of the bucket that you use for cloud recording.
-
Set the metadata of the files as follows:
- Select the M3U8 file.
- Click Actions.
- Select Change metadata.
- Set the Value of the Content-Type Key as application/x-mpegURL (you need to type in this value). 5.Select all the TS files and set Content-Type as video/MP2T.
-
Configure the bucket policy so that it can be accessed publicly:
- On the Permissions tab, click Bucket Policy.
- Paste the following code and change
<YourBucketName>
to the name of your bucket.
- Click Save.
-
Select the M3U8 file to view the URL.
-
Navigate to the URL on a web browser to start playing the recorded files.
See How to Serve HLS Video from an S3 Bucket for more information.
Considerations
- The M3U8 file can be played directly on Safari. For other web browsers, you might need to install an HLS playback extension.
- You can also play the M3U8 file on players supporting HLS, such as the VLC media player.
- If the
uploadingStatus
in the response ofstop
is"backuped"
, it indicates that some of the recorded files are uploaded to Agora's backup cloud storage. You should wait until these files are uploaded automatically to your cloud storage before playing the M3U8 file. - If you do not need to play the recorded files online, we suggest that you make your bucket private to improve security.