How to integrate Tencent VOD with Mlytics Stream?

Mlytics Stream ensures that your video streaming will have zero downtime and will scale during demand spikes. This is possible due to Mlytics Stream's mid-stream CDN switching and P2P video delivery.

If you are using Tencent Video on Demand (VoD), it is possible to improve the availability and scalability of your HLS videos by integrating them into Mlytics Stream.

The diagram and instructions below will show you how you can do this.

Step 1: Obtain the m3u8 URL from Tencent VOD

You need to ensure that your videos are transcoded to HLS format. Check this article to learn more about video transcoding and Tencent VOD.

Log in to your Tencent VoD account, then navigate to ‘ Video/Audio Management’. 

On this page and under the ‘ Uploaded’ tab, select your target video and then click ‘Quick view’. 

Under the ‘ Video URL’ section, you can copy the m3u8 URL of your target HLS video by clicking the ‘Copy URL’ (e.g. http://1307357694.vod2.myqcloud.com/51529ed6vodtranshk1307357694/29a96172387702307772331755/v.f100210.m3u8). 

You will need this m3u8 URL in Mlytics Stream.

Step 2: Create CDN hostnames in Mlytics Stream

The first step in creating CDN hostname is to create a CNAME record. To create a CNAME record, navigate to ‘ DNS’ > ‘DNS Records’, and click ‘Add record’.

In this section, set the Type to CNAME, then, input the Record name following this recommended format: CDN_name.example.com (e.g. cloudfront.orangemlytics.xyz).

The “CDN_name” will be based on the available CDNs that you currently have. You will see later why this naming system is recommended.

For the Value, copy the domain name component of the video URL of your target HLS video from Tencent VOD (e.g. 1307357694.vod2.myqcloud.com).

After you set up the CNAME record, the second step is to assign a single CDN for this record/domain. To assign a CDN, navigate to ‘ Multi CDN’ > ‘CDN Management’.

It is recommended to assign only 1 CDN to 1 subdomain. And that subdomain is preferably named to its corresponding CDN (e.g. assign the CDN Cloudfront to the subdomain cloudfront.orangemlytics.xyz). Following this system will make it easier for you to track which subdomain is associated with a CDN.

After this step, you now successfully created 1 CDN hostname.

It is recommended to create at least 2 CDN hostnames in order to activate the Mid-stream CDN switching.

You can follow this article for more details on how to create a CDN hostname.

Step 3: Create Stream Source in Mlytics Stream

To create a stream source, navigate to ‘ Stream’, and click ‘Create stream source’.

On this page, first set the Stream source name (e.g. ss name)

Next, set the CDN configuration.

In this section, you can add several CDNs by inputting the CDN hostnames that you created together with their corresponding CDN names and Scores.

You may also enable P2P video delivery and/or Domain allowlist.

Finally, click the ‘ Create stream source’ button.

You can follow this article for more details on how to create a Stream source.

Step 4: Paste the m3u8 URL to the Mlytics Stream SDK 

After creating a stream source, Mlytics Stream will generate code snippets, and direct you to the ‘ Install & Test’ page. 

On this page, paste the copied m3u8 URL on the ‘ Playlist URL’ field (from Tencent VOD), and then click the ‘Insert’ button. 

This process will insert the m3u8 URL of your target HLS video into the code snippets of the Mlytics Stream SDK.

You may check the preview of your video by pasting the m3u8 URL into the ‘ Playlist URL’ field in the preview section, and then by clicking the ‘Preview’ button.

Step 5: Copy the SDK code snippets into your HTML

The final step is to copy these SDK code snippets into your HTML code, to implement the Stream functionalities into your web app.

You can follow this article for more details on how to use the code snippets.