tcplayer.js 5.0.2-beta.1 → 5.1.0
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/examples/vod/tcplayer-vod-pdt-seek.html +8 -4
- package/dist/examples/vod/tcplayer-vod-trial.html +150 -0
- package/dist/examples/webrtc/tcplayer-src-webrtc-abr-new.html +18 -32
- package/dist/libs/TXLivePlayer-1.3.4.min.js +1 -1
- package/dist/libs/TXLivePlayer-1.3.5.min.js +1 -0
- package/dist/tcplayer.v5.1.0.min.js +19 -0
- package/package.json +3 -4
- package/dist/examples/vod/tcplayer-hls-live-5.0.0.html +0 -112
- package/dist/examples/vod/youling.html +0 -210
- package/dist/tcplayer.v5.0.1.min.js +0 -19
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
<link href="https://web.sdk.qcloud.com/player/tcplayer/release/v4.6.0/tcplayer.min.css" rel="stylesheet"/>
|
|
9
9
|
|
|
10
10
|
<!--播放器脚本文件-->
|
|
11
|
-
<script src="https://vincentlli-1306264703.cos.ap-nanjing.myqcloud.com/tcplayer/hls.min.1.1.7.js"></script>
|
|
12
|
-
|
|
11
|
+
<!-- <script src="https://vincentlli-1306264703.cos.ap-nanjing.myqcloud.com/tcplayer/hls.min.1.1.7.js"></script> -->
|
|
12
|
+
<script src="http://10.21.39.55:8080/libs/hls.min.1.1.7.js"></script>
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
<script src="https://vincentlli-1306264703.cos.ap-nanjing.myqcloud.com/tcplayer/tcplayer.v4.8.0.min.js"></script>
|
|
16
|
-
|
|
15
|
+
<!-- <script src="https://vincentlli-1306264703.cos.ap-nanjing.myqcloud.com/tcplayer/tcplayer.v4.8.0.min.js"></script> -->
|
|
16
|
+
<script src="http://10.21.39.55:8080/dist/tcplayer.v4.8.0.js"></script>
|
|
17
17
|
<style>
|
|
18
18
|
html,body{
|
|
19
19
|
margin: 0;
|
|
@@ -55,6 +55,10 @@
|
|
|
55
55
|
// 是否开启显示pdt时间
|
|
56
56
|
// PDTDisplay: false,
|
|
57
57
|
},
|
|
58
|
+
|
|
59
|
+
plugins: {
|
|
60
|
+
// PDT: true,
|
|
61
|
+
}
|
|
58
62
|
//其他参数请在开发文档中查看
|
|
59
63
|
});
|
|
60
64
|
|
|
@@ -0,0 +1,150 @@
|
|
|
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"
|
|
7
|
+
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no">
|
|
8
|
+
<title>Tcplayer Demo</title>
|
|
9
|
+
<link href="https://web.sdk.qcloud.com/player/tcplayer/release/v4.9.0/tcplayer.min.css" rel="stylesheet">
|
|
10
|
+
<script src="https://web.sdk.qcloud.com/player/tcplayer/release/v4.9.0/tcplayer.v4.9.0.min.js"></script>
|
|
11
|
+
<style>
|
|
12
|
+
html, body {
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 0;
|
|
15
|
+
}
|
|
16
|
+
.tcplayer {
|
|
17
|
+
margin: 0 auto;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
#player-container-id {
|
|
21
|
+
width: 640px;
|
|
22
|
+
height: 360px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.tip-node {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
position: absolute;
|
|
29
|
+
bottom: 5em;
|
|
30
|
+
left: 1em;
|
|
31
|
+
background: rgba(0, 0, 0, 0.4);
|
|
32
|
+
border-radius: 4px;
|
|
33
|
+
padding: 5px 10px;
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.tip-icon-close {
|
|
38
|
+
width: 14px;
|
|
39
|
+
height: 14px;
|
|
40
|
+
display: inline-block;
|
|
41
|
+
margin-left: 10px;
|
|
42
|
+
background-image: url(https://tcplayer-1306264703.cos.ap-nanjing.myqcloud.com/picture/icon-close.png);
|
|
43
|
+
background-size: cover;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.page-node {
|
|
48
|
+
position: absolute;
|
|
49
|
+
width: 100%;
|
|
50
|
+
height: 100%;
|
|
51
|
+
background: #000;
|
|
52
|
+
z-index: 999;
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: center;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.page-content {
|
|
59
|
+
text-align: center;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.page-content a{
|
|
63
|
+
display: flex;
|
|
64
|
+
width: 120px;
|
|
65
|
+
height: 28px;
|
|
66
|
+
border-radius: 14px;
|
|
67
|
+
color: #663d00;
|
|
68
|
+
background-image: linear-gradient(90deg,#ffdf89 0,#f2ca5b 100%);
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
text-decoration: none;
|
|
72
|
+
margin: 0 auto;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.page-content #replay-btn::before {
|
|
76
|
+
content: '';
|
|
77
|
+
width: 12px;
|
|
78
|
+
height: 12px;
|
|
79
|
+
display: inline-block;
|
|
80
|
+
vertical-align: middle;
|
|
81
|
+
margin-right: 5px;
|
|
82
|
+
background: url(https://tcplayer-1306264703.cos.ap-nanjing.myqcloud.com/picture/icon-replay.png);
|
|
83
|
+
background-size: contain;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.page-content #replay-btn {
|
|
87
|
+
margin: 10px auto 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@media screen and (max-width: 480px) {
|
|
91
|
+
#player-container-id {
|
|
92
|
+
width: 100%;
|
|
93
|
+
height: 240px;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
</style>
|
|
99
|
+
</head>
|
|
100
|
+
<body>
|
|
101
|
+
|
|
102
|
+
<video id="player-container-id" preload="auto" playsinline webkit-playsinline>
|
|
103
|
+
</video>
|
|
104
|
+
|
|
105
|
+
<script>
|
|
106
|
+
var player = TCPlayer("player-container-id", {
|
|
107
|
+
fileID: "3701925924406245944",
|
|
108
|
+
appID: "1500006438",
|
|
109
|
+
psign: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MTUwMDAwNjQzOCwiZmlsZUlkIjoiMzcwMTkyNTkyNDQwNjI0NTk0NCIsImN1cnJlbnRUaW1lU3RhbXAiOjE2MzE3ODEyMzYsImV4cGlyZVRpbWVTdGFtcCI6MTkxNTg2NDQxNCwicGNmZyI6ImJhc2ljRHJtUHJlc2V0IiwidXJsQWNjZXNzSW5mbyI6eyJleHBlciI6MzAsInQiOiIxOTE1ODY0NDE0In19.F9gD5SidAoQPH4rDz4dr9-Z6DpoojOkHX_23kZPJ72A",
|
|
110
|
+
autoplay: false,
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
player.one("playing", function() {
|
|
114
|
+
var tipNode = document.createElement("div");
|
|
115
|
+
tipNode.innerHTML = "可试看30秒,开通 VIP 观看完整视频";
|
|
116
|
+
tipNode.className = "tip-node";
|
|
117
|
+
|
|
118
|
+
var tipIconClose = document.createElement("i");
|
|
119
|
+
tipIconClose.className = "tip-icon-close";
|
|
120
|
+
tipIconClose.onclick = function() {
|
|
121
|
+
tipNode.remove();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
tipNode.appendChild(tipIconClose);
|
|
125
|
+
player.el_.appendChild(tipNode);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
player.on("ended", function() {
|
|
130
|
+
var pageNode = document.createElement("div");
|
|
131
|
+
pageNode.className = "page-node";
|
|
132
|
+
|
|
133
|
+
pageNode.innerHTML = `<div class="page-content">
|
|
134
|
+
<p>试看结束,VIP会员可观看完整视频</p>
|
|
135
|
+
<a href="https://cloud.tencent.com/document/product/881/30818" target="_blank">开通VIP会员</a>
|
|
136
|
+
<button id="replay-btn">重新试看</button>
|
|
137
|
+
</div>
|
|
138
|
+
`;
|
|
139
|
+
|
|
140
|
+
player.el_.appendChild(pageNode);
|
|
141
|
+
|
|
142
|
+
document.querySelector('#replay-btn').onclick = function() {
|
|
143
|
+
player.play();
|
|
144
|
+
pageNode.remove();
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
</script>
|
|
149
|
+
</body>
|
|
150
|
+
</html>
|
|
@@ -9,9 +9,7 @@
|
|
|
9
9
|
<link href="https://web.sdk.qcloud.com/player/tcplayer/release/v4.8.0/tcplayer.min.css" rel="stylesheet"/>
|
|
10
10
|
<script src="https://cdn.bootcdn.net/ajax/libs/vConsole/3.9.1/vconsole.min.js"></script>
|
|
11
11
|
<!-- 引入播放器 js 文件 -->
|
|
12
|
-
|
|
13
|
-
<!-- <script src="http://localhost:8080/dist/tcplayer.v4.8.0.js"></script> -->
|
|
14
|
-
<script src="http://localhost:8080/dist/tcplayer.v5.0.1.js"></script>
|
|
12
|
+
<script src="https://web.sdk.qcloud.com/player/tcplayer/release/v4.8.0/tcplayer.v4.8.0.min.js"></script>
|
|
15
13
|
<!-- 示例 CSS 样式可自行删除 -->
|
|
16
14
|
<style>
|
|
17
15
|
html,body{
|
|
@@ -58,11 +56,6 @@
|
|
|
58
56
|
autoplay: true,
|
|
59
57
|
language: 'en',
|
|
60
58
|
// sources: 'webrtc://global-lebtest-play.myqcloud.com/live/lebtest?txSecret=f22a813b284137ed10d3259a7b5c224b&txTime=69f1eb8c&tabr_bitrates=d1080p,d540p,d360p&tabr_start_bitrate=d540p&tabr_control=auto',
|
|
61
|
-
// sources: 'webrtc://play-t-live.eastbuy.com/live/1067328319987733?txSecret=86cc5042a609979ae0d3cf76f415bc66&txTime=663E447F&tabr_bitrates=efhd,ehd,esd,eld&tabr_start_bitrate=eld&tabr_control=auto',
|
|
62
|
-
sources: 'webrtc://global-lebtest-play.myqcloud.com/live/lebtest?txSecret=f22a813b284137ed10d3259a7b5c224b&txTime=69f1eb8c',
|
|
63
|
-
// sources: 'webrtc://global-lebtest-play.myqcloud.com/live/lebtest?txSecret=f22a813b284137ed10d3259a7b5c224b&txTime=69f1eb8c&tabr_bitrates=d1080p,d540p,d360p&tabr_start_bitrate=d360p&tabr_control=auto',
|
|
64
|
-
// sources: 'webrtc://5664.liveplay.myqcloud.com/live/5664_harchar1?txSecret=f22a813b284137ed10d3259a7b5c224b&txTime=6403f7bb',
|
|
65
|
-
// sources: 'webrtc://arrontest.play.elementtest.org/live/shiftTest',
|
|
66
59
|
// sources: [
|
|
67
60
|
// {
|
|
68
61
|
// src: 'webrtc://global-lebtest-play.myqcloud.com/live/lebtest?txSecret=f22a813b284137ed10d3259a7b5c224b&txTime=69f1eb8c&tabr_bitrates=d1080p,d540p,d360p&tabr_start_bitrate=d1080p'
|
|
@@ -71,7 +64,6 @@
|
|
|
71
64
|
|
|
72
65
|
licenseUrl: 'https://license.vod2.myqcloud.com/license/v2/1306264703_1/v_cube.license',
|
|
73
66
|
|
|
74
|
-
|
|
75
67
|
webrtcConfig: {
|
|
76
68
|
// receiveSEI: true,
|
|
77
69
|
connectRetryCount: 0,
|
|
@@ -79,24 +71,23 @@
|
|
|
79
71
|
enableAbr: false,
|
|
80
72
|
// 模板名对应的label名
|
|
81
73
|
abrLabels: {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
74
|
+
d1080p: 'FHD1',
|
|
75
|
+
d540p: 'HD2',
|
|
76
|
+
d360p: 'SD3',
|
|
77
|
+
auto: 'AUTO4',
|
|
86
78
|
},
|
|
87
79
|
// 参考 快直播 config 说明
|
|
88
80
|
},
|
|
89
81
|
});
|
|
90
82
|
|
|
91
|
-
// player.src([{src: 'webrtc://global-lebtest-play.myqcloud.com/live/lebtest?txSecret=f22a813b284137ed10d3259a7b5c224b&txTime=69f1eb8c&tabr_bitrates=d1080p,d540p,d360p&tabr_start_bitrate=d1080p'}])
|
|
92
83
|
|
|
93
84
|
player.on('webrtcfallback', function(event) {
|
|
94
85
|
|
|
95
86
|
});
|
|
96
87
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
88
|
+
player.on('webrtcevent', function(event) {
|
|
89
|
+
console.log('webrtcEvent', event);
|
|
90
|
+
});
|
|
100
91
|
|
|
101
92
|
player.on('webrtcsei', function(event) {
|
|
102
93
|
console.log('event', event);
|
|
@@ -105,23 +96,18 @@
|
|
|
105
96
|
console.log('webrtcfallback', event);
|
|
106
97
|
});
|
|
107
98
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
// player.on('debug', function(event, data) {
|
|
113
|
-
// console.log('debug', event, data);
|
|
114
|
-
// });
|
|
115
|
-
// player.on('webrtcstats', function(data) {
|
|
99
|
+
player.on('debug', function(event, data) {
|
|
100
|
+
console.log('debug', event, data);
|
|
101
|
+
});
|
|
102
|
+
player.on('webrtcstats', function(data) {
|
|
116
103
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
104
|
+
try {
|
|
105
|
+
document.getElementById('rate').innerHTML = data.data.video.frameWidth + 'x' + data.data.video.frameHeight;
|
|
106
|
+
} catch (e) {
|
|
107
|
+
console.log('e', e.message);
|
|
108
|
+
}
|
|
122
109
|
|
|
123
|
-
|
|
124
|
-
// });
|
|
110
|
+
});
|
|
125
111
|
|
|
126
112
|
</script>
|
|
127
113
|
</body>
|