tcplayer.js 4.7.0 → 4.8.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/console/vod-player-v3.html +125 -0
- package/dist/console/vod-player.html +124 -0
- package/dist/examples/vod/7447398155146701990.jpg +0 -0
- package/dist/examples/vod/7447398155146701990.vtt +301 -0
- package/dist/examples/vod/tcplayer-av1.html +123 -0
- package/dist/examples/vod/tcplayer-vod-all.html +107 -0
- package/dist/examples/vod/tcplayer-vod-audio-tracks.html +66 -0
- package/dist/examples/vod/tcplayer-vod-base-flash.html +64 -0
- package/dist/examples/vod/tcplayer-vod-base-native-control.html +68 -0
- package/dist/examples/vod/tcplayer-vod-base-v4-dash.html +84 -0
- package/dist/examples/vod/tcplayer-vod-base-v4-quality-api.html +90 -0
- package/dist/examples/vod/tcplayer-vod-base-v4.html +78 -0
- package/dist/examples/vod/tcplayer-vod-base.html +76 -0
- package/dist/examples/vod/tcplayer-vod-change-file-statistic.html +79 -0
- package/dist/examples/vod/tcplayer-vod-change-file.html +76 -0
- package/dist/examples/vod/tcplayer-vod-continue-play-by-fileid.html +70 -0
- package/dist/examples/vod/tcplayer-vod-continue-play-by-url.html +72 -0
- package/dist/examples/vod/tcplayer-vod-costom-host.html +66 -0
- package/dist/examples/vod/tcplayer-vod-custom-enter-full-viewport.html +88 -0
- package/dist/examples/vod/tcplayer-vod-custom-ui.html +98 -0
- package/dist/examples/vod/tcplayer-vod-definition.html +71 -0
- package/dist/examples/vod/tcplayer-vod-drm-fairplay.html +165 -0
- package/dist/examples/vod/tcplayer-vod-drm-token-auto.html +101 -0
- package/dist/examples/vod/tcplayer-vod-drm-token.html +156 -0
- package/dist/examples/vod/tcplayer-vod-drm-widevine.html +165 -0
- package/dist/examples/vod/tcplayer-vod-drm.html +164 -0
- package/dist/examples/vod/tcplayer-vod-dynamic-watermark.html +85 -0
- package/dist/examples/vod/tcplayer-vod-enter-full-viewport.html +87 -0
- package/dist/examples/vod/tcplayer-vod-event.html +93 -0
- package/dist/examples/vod/tcplayer-vod-ghost-watermark.html +48 -0
- package/dist/examples/vod/tcplayer-vod-hls-decrypt-key-tool.html +215 -0
- package/dist/examples/vod/tcplayer-vod-hls-decrypt-key.html +76 -0
- package/dist/examples/vod/tcplayer-vod-hls-encrypt-private.html +97 -0
- package/dist/examples/vod/tcplayer-vod-hls-encrypt.html +61 -0
- package/dist/examples/vod/tcplayer-vod-hls-masterplaylist.html +65 -0
- package/dist/examples/vod/tcplayer-vod-hls-token.html +67 -0
- package/dist/examples/vod/tcplayer-vod-image-patch.html +66 -0
- package/dist/examples/vod/tcplayer-vod-key.html +87 -0
- package/dist/examples/vod/tcplayer-vod-level-switch-tips.html +85 -0
- package/dist/examples/vod/tcplayer-vod-logo.html +72 -0
- package/dist/examples/vod/tcplayer-vod-mirror.html +66 -0
- package/dist/examples/vod/tcplayer-vod-mutil.html +68 -0
- package/dist/examples/vod/tcplayer-vod-no-control.html +62 -0
- package/dist/examples/vod/tcplayer-vod-no-progress.html +64 -0
- package/dist/examples/vod/tcplayer-vod-playlist.html +76 -0
- package/dist/examples/vod/tcplayer-vod-preload.html +74 -0
- package/dist/examples/vod/tcplayer-vod-progress-marker.html +64 -0
- package/dist/examples/vod/tcplayer-vod-refer.html +84 -0
- package/dist/examples/vod/tcplayer-vod-size-adaptive.html +70 -0
- package/dist/examples/vod/tcplayer-vod-size-full-viewport.html +68 -0
- package/dist/examples/vod/tcplayer-vod-size.html +70 -0
- package/dist/examples/vod/tcplayer-vod-vtt-thumbnail-src.html +71 -0
- package/dist/examples/vod/tcplayer-vod-vtt-thumbnail.html +65 -0
- package/dist/examples/vod/tcplayer-vod-x5-playsinline.html +65 -0
- package/dist/examples/vod/tcplayer-vod-x5.html +66 -0
- package/dist/examples/vod/typlayer-vod-dynamic-init.html +129 -0
- package/dist/examples/vod/video.html +15 -0
- package/dist/examples/webrtc/tcplayer-src-dynamic.html +92 -0
- package/dist/examples/webrtc/tcplayer-src-meeting.html +193 -0
- package/dist/examples/webrtc/tcplayer-src-webrtc-abr.html +236 -0
- package/dist/examples/webrtc/tcplayer-src-webrtc-autoplay.html +124 -0
- package/dist/examples/webrtc/tcplayer-src-webrtc-change-src.html +189 -0
- package/dist/examples/webrtc/tcplayer-src-webrtc-mutilRes.html +142 -0
- package/dist/examples/webrtc/tcplayer-src-webrtc.html +165 -0
- package/dist/libs/TXLivePlayer-1.3.0.min.js +1 -0
- package/dist/libs/dash.all.min.v3.1.3.js +0 -20
- package/dist/libs/hlsp2p.min.1.6.28.js +3 -0
- package/dist/libs/qvbp2p_common.min.1.8.29.js +1 -0
- package/dist/tcplayer.css +2529 -0
- package/dist/tcplayer.min.css +1 -1
- package/dist/tcplayer.v4.8.0.min.js +17 -0
- package/package.json +2 -4
- package/CHANGELOG.md +0 -120
- package/dist/libs/TXLivePlayer-1.2.3.min.js +0 -1
- package/dist/libs/dash.all.min.2.9.3.js +0 -32
- package/dist/libs/dash.all.min.4.4.1.js +0 -0
- package/dist/libs/flv.min.1.5.js +0 -7
- package/dist/libs/flv.min.1.6.2.js +0 -10
- package/dist/libs/hls.min.0.12.4.js +0 -2
- package/dist/libs/hls.min.0.13.2m.js +0 -4
- package/dist/libs/hls.min.1.1.5.js +0 -28831
- package/dist/tcplayer.v4.7.0.min.js +0 -17
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no">
|
|
7
|
+
<title>腾讯云视频点播示例</title>
|
|
8
|
+
<!-- 引入播放器 css 文件 -->
|
|
9
|
+
<link href="https://web.sdk.cloud.tencent.cn/player/tcplayer/release/v4.5.0/tcplayer.min.css" rel="stylesheet">
|
|
10
|
+
<script src="https://cdn.bootcdn.net/ajax/libs/vConsole/3.9.1/vconsole.min.js"></script>
|
|
11
|
+
|
|
12
|
+
<script src="https://imgcache.qq.com/open/qcloud/video/tcplayer/libs/hls.min.0.13.2m.js"></script>
|
|
13
|
+
<!-- <script src="https://cloudcache.tencent-cloud.com/open/qcloud/live/webrtc/js/TXLivePlayer-1.1.0.min.js"></script> -->
|
|
14
|
+
<script src="https://wliap-1306264703.cos.ap-nanjing.myqcloud.com/TXLivePlayer-1.2.0.min.js "></script>
|
|
15
|
+
<!-- 引入播放器 js 文件 -->
|
|
16
|
+
<script src="https://web.sdk.cloud.tencent.cn/player/tcplayer/release/v4.5.0/tcplayer.v4.5.0.min.js"></script>
|
|
17
|
+
<!-- 示例 CSS 样式可自行删除 -->
|
|
18
|
+
<style>
|
|
19
|
+
html,body{
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
}
|
|
23
|
+
.tcplayer {
|
|
24
|
+
margin: 0 auto;
|
|
25
|
+
}
|
|
26
|
+
@media screen and (max-width: 640px) {
|
|
27
|
+
#player-container-id {
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 270px;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/* 设置logo在高分屏的显示样式 */
|
|
33
|
+
@media only screen and (min-device-pixel-ratio: 2), only screen and (-webkit-min-device-pixel-ratio: 2) {
|
|
34
|
+
.tcp-logo-img {
|
|
35
|
+
width: 50%;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
.button-container{
|
|
39
|
+
text-align: center;
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
42
|
+
</head>
|
|
43
|
+
<body>
|
|
44
|
+
|
|
45
|
+
<!-- 设置播放器容器 -->
|
|
46
|
+
<video id="player-container-id" preload="auto" width="640" height="360" playsinline webkit-playsinline>
|
|
47
|
+
</video>
|
|
48
|
+
<div class="button-container">
|
|
49
|
+
|
|
50
|
+
</div>
|
|
51
|
+
<script>
|
|
52
|
+
if (TCPlayer.browser.IS_ANDROID || TCPlayer.browser.IS_IOS) {
|
|
53
|
+
const vConsole = new VConsole({ maxLogNumber: 1000 });
|
|
54
|
+
}
|
|
55
|
+
var events = [
|
|
56
|
+
'loadstart',
|
|
57
|
+
'suspend',
|
|
58
|
+
'abort',
|
|
59
|
+
'error',
|
|
60
|
+
'emptied',
|
|
61
|
+
'stalled',
|
|
62
|
+
'loadedmetadata',
|
|
63
|
+
'loadeddata',
|
|
64
|
+
'canplay',
|
|
65
|
+
'canplaythrough',
|
|
66
|
+
'playing',
|
|
67
|
+
'waiting',
|
|
68
|
+
'seeking',
|
|
69
|
+
'seeked',
|
|
70
|
+
'ended',
|
|
71
|
+
'durationchange',
|
|
72
|
+
'timeupdate',
|
|
73
|
+
'progress',
|
|
74
|
+
'play',
|
|
75
|
+
'pause',
|
|
76
|
+
'ratechange',
|
|
77
|
+
'resize',
|
|
78
|
+
'volumechange'
|
|
79
|
+
];
|
|
80
|
+
var player = TCPlayer('player-container-id',{
|
|
81
|
+
poster:'https://vodplayerinfo-10005041.file.myqcloud.com/3035579109/vod_paster_pause/paster_pause1469013308.jpg',
|
|
82
|
+
autoplay: true,
|
|
83
|
+
sources: [{
|
|
84
|
+
src: 'webrtc://5664.liveplay.myqcloud.com/live/5664_harchar1?txSecret=f22a813b284137ed10d3259a7b5c224b&txTime=6403f7bb'
|
|
85
|
+
},{
|
|
86
|
+
src: 'https://5664.liveplay.myqcloud.com/live/5664_harchar1.m3u8?txSecret=f22a813b284137ed10d3259a7b5c224b&txTime=6403f7bb'
|
|
87
|
+
}],
|
|
88
|
+
|
|
89
|
+
controlBar: {
|
|
90
|
+
// 隐藏进度条
|
|
91
|
+
// progressControl:false
|
|
92
|
+
},
|
|
93
|
+
hlsConfig: {
|
|
94
|
+
enableRecoverMediaError: true,
|
|
95
|
+
recoverMediaErrorMaxRetry: 5
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
player.on('ready', function() {
|
|
100
|
+
console.log('player on ready');
|
|
101
|
+
// 禁止拖拽进度条 与隐藏进度条不能同时配置。
|
|
102
|
+
// player.controlBar.progressControl.disable();
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
player.on('webrtcevent', function(event) {
|
|
106
|
+
console.log('webrtcEvent', event);
|
|
107
|
+
});
|
|
108
|
+
events.forEach(function(val, i){
|
|
109
|
+
player.on(val, function (event) {
|
|
110
|
+
if(val !='timeupdate'){
|
|
111
|
+
console.log('player event', val);
|
|
112
|
+
}
|
|
113
|
+
if(val === 'waiting'){
|
|
114
|
+
console.log('卡顿开始,设置标记')
|
|
115
|
+
}
|
|
116
|
+
if(val === 'playing'){
|
|
117
|
+
console.log('开始播放或者标记卡顿结束')
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
</script>
|
|
123
|
+
</body>
|
|
124
|
+
</html>
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
7
|
+
<meta name="viewport"
|
|
8
|
+
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no">
|
|
9
|
+
<title>腾讯视频云快直播示例</title>
|
|
10
|
+
<!-- 引入播放器 css 文件 -->
|
|
11
|
+
<link href="https://web.sdk.cloud.tencent.cn/player/tcplayer/release/v4.5.3/tcplayer.min.css" rel="stylesheet">
|
|
12
|
+
<script src="https://cdn.bootcdn.net/ajax/libs/vConsole/3.9.1/vconsole.min.js"></script>
|
|
13
|
+
|
|
14
|
+
<script src="https://imgcache.qq.com/open/qcloud/video/tcplayer/libs/hls.min.0.13.2m.js"></script>
|
|
15
|
+
<!-- <script src="https://cloudcache.tencent-cloud.com/open/qcloud/live/webrtc/js/TXLivePlayer-1.1.0.min.js"></script> -->
|
|
16
|
+
<script src="https://wliap-1306264703.cos.ap-nanjing.myqcloud.com/TXLivePlayer-1.2.0.min.js "></script>
|
|
17
|
+
<!-- 引入播放器 js 文件 -->
|
|
18
|
+
<!-- <script src="./tcplayer.v4.5.3.js"></script> -->
|
|
19
|
+
<script src="../../../dist/tcplayer.v4.5.3.js"></script>
|
|
20
|
+
<!-- <script src="https://web.sdk.cloud.tencent.cn/player/tcplayer/release/v4.5.3/tcplayer.v4.5.3.min.js"></script> -->
|
|
21
|
+
|
|
22
|
+
<!-- 示例 CSS 样式可自行删除 -->
|
|
23
|
+
<style>
|
|
24
|
+
html,
|
|
25
|
+
body {
|
|
26
|
+
margin: 0;
|
|
27
|
+
padding: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.tcplayer {
|
|
31
|
+
margin: 0 auto;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@media screen and (max-width: 640px) {
|
|
35
|
+
|
|
36
|
+
.tcplayer,
|
|
37
|
+
#player-container-id {
|
|
38
|
+
width: 100%;
|
|
39
|
+
height: 270px;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* 设置logo在高分屏的显示样式 */
|
|
44
|
+
@media only screen and (min-device-pixel-ratio: 2),
|
|
45
|
+
only screen and (-webkit-min-device-pixel-ratio: 2) {
|
|
46
|
+
.tcp-logo-img {
|
|
47
|
+
width: 50%;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.button-container {
|
|
52
|
+
text-align: center;
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
55
|
+
</head>
|
|
56
|
+
|
|
57
|
+
<body>
|
|
58
|
+
|
|
59
|
+
<!-- 设置播放器容器 -->
|
|
60
|
+
<video id="player-container-id" preload="auto" width="640" height="360" playsinline webkit-playsinline>
|
|
61
|
+
</video>
|
|
62
|
+
<!-- <video id="player-native" preload="auto" width="414" height="280" playsinline webkit-playsinline controls
|
|
63
|
+
src="https://5664.liveplay.myqcloud.com/live/5664_harchar1.m3u8?txSecret=f22a813b284137ed10d3259a7b5c224b&txTime=6403f7bb">
|
|
64
|
+
</video> -->
|
|
65
|
+
<div class="button-container">
|
|
66
|
+
<!-- <button onclick="playFlv()">flv</button> -->
|
|
67
|
+
<button onclick="playWebRTC()">WebRTC</button>
|
|
68
|
+
<button onclick="playHls()">hls</button>
|
|
69
|
+
<button onclick="playMp4()">mp4</button>
|
|
70
|
+
<button onclick="playFail()">模拟快直播-2005事件,降级播放hls</button>
|
|
71
|
+
<!-- <button onclick="fullscreen()">webkit fullscreen</button> -->
|
|
72
|
+
<!-- <button onclick="fullscreen('#player-native')">fullscreen</button> -->
|
|
73
|
+
</div>
|
|
74
|
+
<!-- <video class="tcplayer" id="player1" preload="auto" width="640" height="360" playsinline webkit-playsinline>
|
|
75
|
+
</video> -->
|
|
76
|
+
<!-- <video class="tcplayer" id="player2" preload="auto" width="640" height="360" playsinline webkit-playsinline>
|
|
77
|
+
</video> -->
|
|
78
|
+
<script>
|
|
79
|
+
if (TCPlayer.browser.IS_ANDROID || TCPlayer.browser.IS_IOS) {
|
|
80
|
+
const vConsole = new VConsole({ maxLogNumber: 1000 });
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
var player = TCPlayer('player-container-id', {
|
|
84
|
+
autoplay: false,
|
|
85
|
+
// 封面图
|
|
86
|
+
// poster:'https://1256993030.vod2.myqcloud.com/20f8b585vodgzp1256993030/0/player/5285890781393938051.png',
|
|
87
|
+
sources: [/* {
|
|
88
|
+
// 快直播地址
|
|
89
|
+
src: 'webrtc://5664.liveplay.myqcloud.com/live/5664_harchar1?txSecret=f22a813b284137ed10d3259a7b5c224b&txTime=6403f7bb'
|
|
90
|
+
},{
|
|
91
|
+
// HLS直播地址
|
|
92
|
+
src: 'https://5664.liveplay.myqcloud.com/live/5664_harchar1.m3u8?txSecret=f22a813b284137ed10d3259a7b5c224b&txTime=6403f7bb'
|
|
93
|
+
}, */{
|
|
94
|
+
// src: 'https://1256993030.vod2.myqcloud.com/d520582dvodtransgzp1256993030/7732bd367447398157015849771/v.f40.mp4'
|
|
95
|
+
src: 'https://5664.liveplay.myqcloud.com/live/5664_harchar1.m3u8?txSecret=f22a813b284137ed10d3259a7b5c224b&txTime=6403f7bb'
|
|
96
|
+
}],
|
|
97
|
+
// 可配置参数说明 https://cloud.tencent.com/document/product/881/30820#options-.E5.8F.82.E6.95.B0.E5.88.97.E8.A1.A8
|
|
98
|
+
controlBar: {
|
|
99
|
+
// 是否显示进度条
|
|
100
|
+
// progressControl:false
|
|
101
|
+
},
|
|
102
|
+
//
|
|
103
|
+
// nativeControlsForTouch:true,
|
|
104
|
+
webrtcConfig: {
|
|
105
|
+
// 参考 快直播 config 说明
|
|
106
|
+
},
|
|
107
|
+
hlsConfig: {
|
|
108
|
+
// 参考 hls.js config 说明 https://github.com/video-dev/hls.js/blob/f3c6b2712e63ee6ed32957e4035254856d24605e/docs/API.md#fine-tuning
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
player.on('ready', function () {
|
|
113
|
+
console.log('player on ready');
|
|
114
|
+
// 禁止拖拽进度条 与隐藏进度条不能同时配置。
|
|
115
|
+
// player.controlBar.progressControl.disable();
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
player.on('webrtcevent', function (event) {
|
|
119
|
+
console.log('webrtcEvent', event);
|
|
120
|
+
});
|
|
121
|
+
player.on('webrtcfallback', function (event) {
|
|
122
|
+
console.log('webrtcfallback', event);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// 播放器事件
|
|
126
|
+
var events = [
|
|
127
|
+
'loadstart',
|
|
128
|
+
'suspend',
|
|
129
|
+
'abort',
|
|
130
|
+
'error',
|
|
131
|
+
'emptied',
|
|
132
|
+
'stalled',
|
|
133
|
+
'loadedmetadata',
|
|
134
|
+
'loadeddata',
|
|
135
|
+
'canplay',
|
|
136
|
+
'canplaythrough',
|
|
137
|
+
'playing',
|
|
138
|
+
'waiting',
|
|
139
|
+
'seeking',
|
|
140
|
+
'seeked',
|
|
141
|
+
'ended',
|
|
142
|
+
'durationchange',
|
|
143
|
+
'timeupdate',
|
|
144
|
+
'progress',
|
|
145
|
+
'play',
|
|
146
|
+
'pause',
|
|
147
|
+
'ratechange',
|
|
148
|
+
'resize',
|
|
149
|
+
'volumechange'
|
|
150
|
+
];
|
|
151
|
+
events.forEach(function (val, i) {
|
|
152
|
+
player.on(val, function (event) {
|
|
153
|
+
if (val != 'timeupdate') {
|
|
154
|
+
console.log('player event', val);
|
|
155
|
+
}
|
|
156
|
+
if (val === 'waiting') {
|
|
157
|
+
console.log('waiting事件,可以标记为卡顿开始');
|
|
158
|
+
}
|
|
159
|
+
if (val === 'playing') {
|
|
160
|
+
console.log('开始播放或恢复播放,可以标记为卡顿结束');
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
function playFail() {
|
|
166
|
+
if (player.src().indexOf('webrtc://') === 0) {
|
|
167
|
+
player.tech(true).webrtcProvider && player.tech(true).webrtcProvider.onPlayEvent(-2005);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function fullscreen(elementID) {
|
|
171
|
+
if (elementID) {
|
|
172
|
+
document.querySelector(elementID).webkitEnterFullScreen();
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
document.querySelector('video').webkitEnterFullScreen();
|
|
176
|
+
}
|
|
177
|
+
function playHls() {
|
|
178
|
+
player.src('https://1256993030.vod2.myqcloud.com/d520582dvodtransgzp1256993030/7732bd367447398157015849771/adp.10.m3u8');
|
|
179
|
+
}
|
|
180
|
+
function playMp4() {
|
|
181
|
+
player.src('https://1256993030.vod2.myqcloud.com/d520582dvodtransgzp1256993030/7732bd367447398157015849771/v.f40.mp4');
|
|
182
|
+
}
|
|
183
|
+
function playWebRTC() {
|
|
184
|
+
player.src('webrtc://5664.liveplay.myqcloud.com/live/5664_harchar1?txSecret=f22a813b284137ed10d3259a7b5c224b&txTime=6403f7bb');
|
|
185
|
+
}
|
|
186
|
+
</script>
|
|
187
|
+
</body>
|
|
188
|
+
|
|
189
|
+
</html>
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no">
|
|
7
|
+
<title>腾讯视频云快直播示例</title>
|
|
8
|
+
<!-- 引入播放器 css 文件 -->
|
|
9
|
+
<link href="https://web.sdk.cloud.tencent.cn/player/tcplayer/release/v4.5.0/tcplayer.min.css" rel="stylesheet">
|
|
10
|
+
<script src="https://cdn.bootcdn.net/ajax/libs/vConsole/3.9.1/vconsole.min.js"></script>
|
|
11
|
+
|
|
12
|
+
<script src="https://imgcache.qq.com/open/qcloud/video/tcplayer/libs/hls.min.0.13.2m.js"></script>
|
|
13
|
+
<!-- <script src="https://cloudcache.tencent-cloud.com/open/qcloud/live/webrtc/js/TXLivePlayer-1.1.0.min.js"></script> -->
|
|
14
|
+
<script src="https://wliap-1306264703.cos.ap-nanjing.myqcloud.com/TXLivePlayer-1.2.0.min.js "></script>
|
|
15
|
+
<!-- 引入播放器 js 文件 -->
|
|
16
|
+
<script src="https://web.sdk.cloud.tencent.cn/player/tcplayer/release/v4.5.0/tcplayer.v4.5.0.min.js"></script>
|
|
17
|
+
<!-- 示例 CSS 样式可自行删除 -->
|
|
18
|
+
<style>
|
|
19
|
+
html,body{
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
}
|
|
23
|
+
.tcplayer {
|
|
24
|
+
margin: 0 auto;
|
|
25
|
+
}
|
|
26
|
+
@media screen and (max-width: 640px) {
|
|
27
|
+
#player-container-id {
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 270px;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/* 设置logo在高分屏的显示样式 */
|
|
33
|
+
@media only screen and (min-device-pixel-ratio: 2), only screen and (-webkit-min-device-pixel-ratio: 2) {
|
|
34
|
+
.tcp-logo-img {
|
|
35
|
+
width: 50%;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
.button-container{
|
|
39
|
+
text-align: center;
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
42
|
+
</head>
|
|
43
|
+
<body>
|
|
44
|
+
|
|
45
|
+
<!-- 设置播放器容器 -->
|
|
46
|
+
<video id="player-container-id" preload="auto" width="640" height="360" playsinline webkit-playsinline>
|
|
47
|
+
</video>
|
|
48
|
+
<div class="button-container">
|
|
49
|
+
|
|
50
|
+
</div>
|
|
51
|
+
<script>
|
|
52
|
+
if (TCPlayer.browser.IS_ANDROID || TCPlayer.browser.IS_IOS) {
|
|
53
|
+
const vConsole = new VConsole({ maxLogNumber: 1000 });
|
|
54
|
+
}
|
|
55
|
+
var events = [
|
|
56
|
+
'loadstart',
|
|
57
|
+
'suspend',
|
|
58
|
+
'abort',
|
|
59
|
+
'error',
|
|
60
|
+
'emptied',
|
|
61
|
+
'stalled',
|
|
62
|
+
'loadedmetadata',
|
|
63
|
+
'loadeddata',
|
|
64
|
+
'canplay',
|
|
65
|
+
'canplaythrough',
|
|
66
|
+
'playing',
|
|
67
|
+
'waiting',
|
|
68
|
+
'seeking',
|
|
69
|
+
'seeked',
|
|
70
|
+
'ended',
|
|
71
|
+
'durationchange',
|
|
72
|
+
'timeupdate',
|
|
73
|
+
'progress',
|
|
74
|
+
'play',
|
|
75
|
+
'pause',
|
|
76
|
+
'ratechange',
|
|
77
|
+
'resize',
|
|
78
|
+
'volumechange'
|
|
79
|
+
];
|
|
80
|
+
var player = TCPlayer('player-container-id',{
|
|
81
|
+
poster:'https://vodplayerinfo-10005041.file.myqcloud.com/3035579109/vod_paster_pause/paster_pause1469013308.jpg',
|
|
82
|
+
// autoplay: true,
|
|
83
|
+
multiResolution:{
|
|
84
|
+
sources:{
|
|
85
|
+
'SD':[
|
|
86
|
+
{
|
|
87
|
+
src: 'webrtc://5664.liveplay.myqcloud.com/live/5664_harchar1?txSecret=f22a813b284137ed10d3259a7b5c224b&txTime=6403f7bb',
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
'HD':[
|
|
91
|
+
{
|
|
92
|
+
src: 'webrtc://5664.liveplay.myqcloud.com/live/5664_harchar1?txSecret=f22a813b284137ed10d3259a7b5c224b&txTime=6403f7bb',
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
'FHD':[
|
|
96
|
+
{
|
|
97
|
+
src: 'webrtc://5664.liveplay.myqcloud.com/live/5664_harchar1?txSecret=f22a813b284137ed10d3259a7b5c224b&txTime=6403f7bb',
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
// labels:{
|
|
102
|
+
// 'SD':'标清','HD':'高清','FHD':'超清'
|
|
103
|
+
// },
|
|
104
|
+
showOrder:['SD','HD','FHD'],
|
|
105
|
+
defaultRes: 'SD'
|
|
106
|
+
},
|
|
107
|
+
controlBar: {
|
|
108
|
+
// 隐藏进度条
|
|
109
|
+
// progressControl:false
|
|
110
|
+
},
|
|
111
|
+
hlsConfig: {
|
|
112
|
+
enableRecoverMediaError: true,
|
|
113
|
+
recoverMediaErrorMaxRetry: 5
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
player.on('ready', function() {
|
|
118
|
+
console.log('player on ready');
|
|
119
|
+
// 禁止拖拽进度条 与隐藏进度条不能同时配置。
|
|
120
|
+
// player.controlBar.progressControl.disable();
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
player.on('webrtcevent', function(event) {
|
|
124
|
+
console.log('webrtcEvent', event);
|
|
125
|
+
});
|
|
126
|
+
events.forEach(function(val, i){
|
|
127
|
+
player.on(val, function (event) {
|
|
128
|
+
if(val !='timeupdate'){
|
|
129
|
+
console.log('player event', val);
|
|
130
|
+
}
|
|
131
|
+
if(val === 'waiting'){
|
|
132
|
+
console.log('waiting事件,可以标记为卡顿开始');
|
|
133
|
+
}
|
|
134
|
+
if(val === 'playing'){
|
|
135
|
+
console.log('开始播放或恢复播放,可以标记为卡顿结束');
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
</script>
|
|
141
|
+
</body>
|
|
142
|
+
</html>
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no">
|
|
7
|
+
<title>腾讯视频云快直播示例</title>
|
|
8
|
+
<!-- 引入播放器 css 文件 -->
|
|
9
|
+
<link href="https://web.sdk.cloud.tencent.cn/player/tcplayer/release/v4.5.0/tcplayer.min.css" rel="stylesheet">
|
|
10
|
+
<script src="https://cdn.bootcdn.net/ajax/libs/vConsole/3.9.1/vconsole.min.js"></script>
|
|
11
|
+
|
|
12
|
+
<script src="https://imgcache.qq.com/open/qcloud/video/tcplayer/libs/hls.min.0.13.2m.js"></script>
|
|
13
|
+
<!-- <script src="https://cloudcache.tencent-cloud.com/open/qcloud/live/webrtc/js/TXLivePlayer-1.1.0.min.js"></script> -->
|
|
14
|
+
<!-- <script src="https://wliap-1306264703.cos.ap-nanjing.myqcloud.com/TXLivePlayer-1.2.0.min.js "></script> -->
|
|
15
|
+
<script src="https://testmig-1306264703.cos.ap-guangzhou.myqcloud.com/wm/TXLivePlayer-1.2.1.min.js"></script>
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
<!-- 引入播放器 js 文件 -->
|
|
20
|
+
<script src="https://web.sdk.qcloud.com/player/tcplayer/release/v4.5.2/tcplayer.v4.5.2.min.js"></script>
|
|
21
|
+
<!-- 示例 CSS 样式可自行删除 -->
|
|
22
|
+
<style>
|
|
23
|
+
html,body{
|
|
24
|
+
margin: 0;
|
|
25
|
+
padding: 0;
|
|
26
|
+
}
|
|
27
|
+
.tcplayer {
|
|
28
|
+
margin: 0 auto;
|
|
29
|
+
}
|
|
30
|
+
@media screen and (max-width: 640px) {
|
|
31
|
+
.tcplayer,
|
|
32
|
+
#player-container-id {
|
|
33
|
+
width: 100%;
|
|
34
|
+
height: 270px;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/* 设置logo在高分屏的显示样式 */
|
|
38
|
+
@media only screen and (min-device-pixel-ratio: 2), only screen and (-webkit-min-device-pixel-ratio: 2) {
|
|
39
|
+
.tcp-logo-img {
|
|
40
|
+
width: 50%;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
.button-container{
|
|
44
|
+
text-align: center;
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
47
|
+
</head>
|
|
48
|
+
<body>
|
|
49
|
+
|
|
50
|
+
<!-- 设置播放器容器 -->
|
|
51
|
+
<video id="player-container-id" preload="auto" width="640" height="360" playsinline webkit-playsinline>
|
|
52
|
+
</video>
|
|
53
|
+
<!-- <video id="player-native" preload="auto" width="414" height="280" playsinline webkit-playsinline controls
|
|
54
|
+
src="https://5664.liveplay.myqcloud.com/live/5664_harchar1.m3u8?txSecret=f22a813b284137ed10d3259a7b5c224b&txTime=6403f7bb">
|
|
55
|
+
</video> -->
|
|
56
|
+
<div class="button-container">
|
|
57
|
+
<!-- <button onclick="playFlv()">flv</button> -->
|
|
58
|
+
<!-- <button onclick="playHls()">hls</button> -->
|
|
59
|
+
<!-- <button onclick="playFail()">模拟快直播-2005事件,降级播放hls</button> -->
|
|
60
|
+
<!-- <button onclick="fullscreen()">webkit fullscreen</button> -->
|
|
61
|
+
<!-- <button onclick="fullscreen('#player-native')">fullscreen</button> -->
|
|
62
|
+
</div>
|
|
63
|
+
<!-- <video class="tcplayer" id="player1" preload="auto" width="640" height="360" playsinline webkit-playsinline>
|
|
64
|
+
</video> -->
|
|
65
|
+
<!-- <video class="tcplayer" id="player2" preload="auto" width="640" height="360" playsinline webkit-playsinline>
|
|
66
|
+
</video> -->
|
|
67
|
+
<script>
|
|
68
|
+
if (TCPlayer.browser.IS_ANDROID || TCPlayer.browser.IS_IOS) {
|
|
69
|
+
const vConsole = new VConsole({ maxLogNumber: 1000 });
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
var player = TCPlayer('player-container-id',{
|
|
73
|
+
// 封面图
|
|
74
|
+
// poster:'https://1256993030.vod2.myqcloud.com/20f8b585vodgzp1256993030/0/player/5285890781393938051.png',
|
|
75
|
+
sources: [{
|
|
76
|
+
// 快直播地址
|
|
77
|
+
src: 'webrtc://5664.liveplay.myqcloud.com/live/5664_harchar1?txSecret=f22a813b284137ed10d3259a7b5c224b&txTime=6403f7bb'
|
|
78
|
+
},{
|
|
79
|
+
// HLS直播地址
|
|
80
|
+
src: 'https://5664.liveplay.myqcloud.com/live/5664_harchar1.m3u8?txSecret=f22a813b284137ed10d3259a7b5c224b&txTime=6403f7bb'
|
|
81
|
+
}],
|
|
82
|
+
// 可配置参数说明 https://cloud.tencent.com/document/product/881/30820#options-.E5.8F.82.E6.95.B0.E5.88.97.E8.A1.A8
|
|
83
|
+
controlBar: {
|
|
84
|
+
// 是否显示进度条
|
|
85
|
+
// progressControl:false
|
|
86
|
+
},
|
|
87
|
+
//
|
|
88
|
+
// nativeControlsForTouch:true,
|
|
89
|
+
webrtcConfig: {
|
|
90
|
+
// 参考 快直播 config 说明
|
|
91
|
+
},
|
|
92
|
+
hlsConfig: {
|
|
93
|
+
// 参考 hls.js config 说明 https://github.com/video-dev/hls.js/blob/f3c6b2712e63ee6ed32957e4035254856d24605e/docs/API.md#fine-tuning
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
player.on('ready', function() {
|
|
99
|
+
console.log('player on ready');
|
|
100
|
+
// 禁止拖拽进度条 与隐藏进度条不能同时配置。
|
|
101
|
+
// player.controlBar.progressControl.disable();
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
player.on('webrtcevent', function(event) {
|
|
105
|
+
console.log('webrtcEvent', event);
|
|
106
|
+
});
|
|
107
|
+
player.on('webrtcfallback', function(event) {
|
|
108
|
+
console.log('webrtcfallback', event);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// 播放器事件
|
|
112
|
+
var events = [
|
|
113
|
+
'loadstart',
|
|
114
|
+
'suspend',
|
|
115
|
+
'abort',
|
|
116
|
+
'error',
|
|
117
|
+
'emptied',
|
|
118
|
+
'stalled',
|
|
119
|
+
'loadedmetadata',
|
|
120
|
+
'loadeddata',
|
|
121
|
+
'canplay',
|
|
122
|
+
'canplaythrough',
|
|
123
|
+
'playing',
|
|
124
|
+
'waiting',
|
|
125
|
+
'seeking',
|
|
126
|
+
'seeked',
|
|
127
|
+
'ended',
|
|
128
|
+
'durationchange',
|
|
129
|
+
'timeupdate',
|
|
130
|
+
'progress',
|
|
131
|
+
'play',
|
|
132
|
+
'pause',
|
|
133
|
+
'ratechange',
|
|
134
|
+
'resize',
|
|
135
|
+
'volumechange'
|
|
136
|
+
];
|
|
137
|
+
events.forEach(function(val, i){
|
|
138
|
+
player.on(val, function (event) {
|
|
139
|
+
if(val !='timeupdate'){
|
|
140
|
+
console.log('player event', val);
|
|
141
|
+
}
|
|
142
|
+
if(val === 'waiting'){
|
|
143
|
+
console.log('waiting事件,可以标记为卡顿开始');
|
|
144
|
+
}
|
|
145
|
+
if(val === 'playing'){
|
|
146
|
+
console.log('开始播放或恢复播放,可以标记为卡顿结束');
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
function playFail() {
|
|
152
|
+
if (player.src().indexOf('webrtc://')===0) {
|
|
153
|
+
player.tech(true).webrtcProvider && player.tech(true).webrtcProvider.onPlayEvent(-2005);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function fullscreen(elementID) {
|
|
157
|
+
if (elementID){
|
|
158
|
+
document.querySelector(elementID).webkitEnterFullScreen();
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
document.querySelector('video').webkitEnterFullScreen();
|
|
162
|
+
}
|
|
163
|
+
</script>
|
|
164
|
+
</body>
|
|
165
|
+
</html>
|