<video>
element of HTML5 and Flash Player. It delivers a unified video playback experience across platforms. You can also use it together with Tencent Cloud VOD to enable hotlink protection and playback of encrypted HLS videos.Audio/Video Protocol | Scenario | URL Format | PC Browser | Mobile Browser |
MP3 | Audio | http://xxx.vod.myqcloud.com/xxx.mp3 | Supported | Supported |
MP4 | VOD playback | http://xxx.vod.myqcloud.com/xxx.mp4 | Supported | Supported |
HLS (M3U8) | Live playback | http://xxx.liveplay.myqcloud.com/xxx.m3u8 | Supported | Supported |
| VOD playback | http://xxx.vod.myqcloud.com/xxx.m3u8 | Supported | Supported |
FLV | Live playback | http://xxx.liveplay.myqcloud.com/xxx.flv | Supported | Partially supported |
| VOD playback | http://xxx.vod.myqcloud.com/xxx.flv | Supported | Partially supported |
WebRTC | Live playback | webrtc://xxx.liveplay.myqcloud.com/live/xxx | Supported | Supported |
Feature\\Browser | Chrome | Firefox | Edge | QQ Browser | Safari for macOS | Safari for iOS | WeChat | Chrome for Android | Internet Explorer 11 |
Player dimension configuration | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Resuming playback | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Playback speed change | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Preview thumbnails | ✓ | ✓ | ✓ | ✓ | - | - | - | - | ✓ |
Changing `fileID` for playback | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Flipping videos | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Progress bar marking | ✓ | ✓ | ✓ | ✓ | ✓ | - | - | - | ✓ |
HLS adaptive bitrate | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Referer hotlink protection | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | - | ✓ |
Definition change notifications | ✓ | ✓ | ✓ | ✓ | - | - | - | ✓ | ✓ |
Playing HLS videos encrypted using standard schemes | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Playing HLS videos encrypted using private protocols | ✓ | ✓ | ✓ | - | - | - | Android: ✓ iOS: -
| ✓ | ✓ |
Video statistics | ✓ | ✓ | ✓ | ✓ | - | - | - | - | - |
Video data monitoring | ✓ | ✓ | ✓ | ✓ | - | - | - | - | - |
Custom UI messages | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Custom UI | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
On-screen comments | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Watermark | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Playlist | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Frame sync under poor network conditions | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
hls.js
in order to play HLS files.Referer
field in the HTTP request header. HTTP requests initiated by some Android browsers do not carry the Referer
field.index.html
file in your project and import the player style file and script file to the HTML page:<link href="https://web.sdk.qcloud.com/player/tcplayer/release/v4.9.0/tcplayer.min.css" rel="stylesheet"/><script src="https://web.sdk.qcloud.com/player/tcplayer/release/v4.9.0/tcplayer.v4.9.0.min.js"></script>
aaa.xxx.ccc
. Follow the steps below to import the style and script files:<link href="aaa.xxx.ccc/tcplayer.min.css" rel="stylesheet"/><!--If you want to play back HLS videos through HTML5 in a browser such as Chrome and Firefox, you need to import `hls.min.x.xx.m.js` before importing `tcplayer.vx.x.x.min.js`.--><script src="aaa.xxx.ccc/libs/hls.min.x.xx.m.js"></script><!--Player script file--><script src="aaa.xxx.ccc/tcplayer.vx.x.x.min.js"></script>
index.html
(the container ID, width, and height can be customized).<video id="player-container-id" width="414" height="270" preload="auto" playsinline webkit-playsinline></video>
<video>
element.player-container-id
is the ID of the player container. You can set your own container ID.preload
attribute in the sample specifies whether to load the video after the page is loaded, which is usually set to auto
for faster start of the playback. Other options include meta
(only loads the metadata after the page is loaded) and none
(does not load the video after the page is loaded). Due to system restrictions, videos will not be automatically loaded on mobile devices.playsinline
and webkit-playsinline
attributes are used to implement inline playback in a standard mobile browser without the browser hijacking the playback. You can use these two attributes based on your actual conditions.x5-playsinline
is set, the X5 UI player will be used in the TBS kernel.FileID
. For the specific process, see Stage 1. Play back a video with Player.var player = TCPlayer('player-container-id', {sources: [{src: 'path/to/video',}],language: 'en',}); // player-container-id is the player container ID, which must be the same as that in HTML// player.src(url); // Play URL
index.html
page initialization code and pass in the fileID
(which can be viewed in Media Assets) and appID
(which can be viewed in Account Information > Basic Information).var player = TCPlayer('player-container-id', { // player-container-id is the player container ID, which must be the same as that in HTMLfileID: '3701925921299637010', // Pass in the file ID of the video to be played, which is requiredappID: '1500005696' // Pass in the appID of your VOD account, which is requiredpsign:'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MTUwMDAwNTY5NiwiZmlsZUlkIjoiMzcwMTkyNTkyMTI5OTYzNzAxMCIsImN1cnJlbnRUaW1lU3RhbXAiOjE2MjY4NjAxNzYsImV4cGlyZVRpbWVTdGFtcCI6MjYyNjg1OTE3OSwicGNmZyI6InByaXZhdGUiLCJ1cmxBY2Nlc3NJbmZvIjp7InQiOiI5YzkyYjBhYiJ9LCJkcm1MaWNlbnNlSW5mbyI6eyJleHBpcmVUaW1lU3RhbXAiOjI2MjY4NTkxNzksInN0cmljdE1vZGUiOjJ9fQ.Bo5K5ThInc4n8AlzIZQ-CP9a49M2mEr9-zQLH9ocQgI',language: 'en',// For more information on the signature and how to generate it, see https://www.tencentcloud.com/document/product/266/38099});
Was this page helpful?