帮助中心 帮助中心

HLS online video player based on Tencent cloud playback sdk development

Introduction

With the rapid development of Internet video streaming technology, HLS (HTTP Live Streaming), as an HTTP-based streaming protocol, has been widely used. Tencent Cloudcast, as a video playback and management service provided by Tencent Cloud, supports HLS video playback with high availability and stability. In this article, we will introduce how to play HLS video based on Tencent Cloudcast, and explain each step in detail from building the cloud service to achieving video playback.

What is HLS

HLS (HTTP Live Streaming) is a streaming media network transmission protocol proposed by Apple Inc. HLS uses the HTTP protocol to split audio and video content into small segments for easy playback under different network conditions. Its main features include:

Compatibility: HLS is able to play smoothly on various devices (e.g. mobile phones, computers, TVs, etc.).

Adaptive bit rate: According to the user's network bandwidth, automatically select the appropriate bit rate for playback to enhance the user experience.

Strong real-time performance: Suitable for live broadcasting scenarios.

Introduction to Tencent Cloud Broadcasting Platform

Tencent Video Cloud is a video cloud service launched by Tencent Cloud, providing video uploading, transcoding, storage, distribution and playback functions. It supports a variety of video formats and protocols, including HLS, HTTP, RTMP, and so on.

Main Features

Video upload and management: supports batch video upload and provides a convenient management console.

Transcoding and Storage: Automatically transcode videos into formats suitable for playback on different devices, and provide secure storage solutions.

CDN Acceleration: Utilise global CDN nodes to enhance video playback speed and stability.

Player SDK: Provides rich player SDKs for easy integration into various devices and platforms.

Build Cloud Services

1. Register for a Tencent Cloud account

First, visit the Tencent Cloud website and register for a Tencent Cloud account. After registering, log in and enter the console.

2. Creating a Cloud Broadcast Service

In the Tencent Cloud console, find the Cloud VOD service. 点击 创建服务 按钮,选择相关的配置并按照指引完成服务创建。

Testing and Validation

After completing the above steps, open your HTML file. The HLS video should load and play successfully in your browser. If the video does not play, check the following:

Make sure the .m3u8 file and .ts file are linked to the correct address.

Check your browser's developer tools for load errors or CORS issues.