branch-video-player-sdk 0.2.11 → 0.2.13
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/README.md +13 -13
- package/dist/index.js +58 -58
- package/dist/index.umd.cjs +1 -1
- package/dist/runtime/assets/{player-Bf_D5PLO.js → player-Dv33xIOl.js} +34 -34
- package/dist/runtime/player.html +54 -5
- package/dist/url.cjs +1 -1
- package/dist/url.d.ts +1 -0
- package/dist/url.js +39 -39
- package/package.json +30 -30
package/dist/runtime/player.html
CHANGED
|
@@ -1,7 +1,56 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
|
-
<html lang="
|
|
3
|
-
<head
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
|
6
|
+
<title>BranchVideo Player</title>
|
|
7
|
+
<style>
|
|
8
|
+
html, body, #root { width: 100%; height: 100%; margin: 0; background: #000; overflow: hidden; }
|
|
9
|
+
.bv-boot-overlay { position: fixed; inset: 0; display: flex; flex-direction: column; background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #16213e 100%); }
|
|
10
|
+
.bv-boot-cover { position: absolute; inset: 0; background-position: center; background-repeat: no-repeat; background-size: cover; }
|
|
11
|
+
.bv-boot-bottom { position: absolute; left: 0; right: 0; bottom: 4.4vw; padding: 0 10%; color: #fff; font-family: sans-serif; }
|
|
12
|
+
.bv-boot-meta { display: flex; justify-content: space-between; align-items: baseline; }
|
|
13
|
+
.bv-boot-bar { height: 8px; margin: 8px 0; border: 1px solid #CEC1B6; background: rgba(107, 94, 82, 0.4); }
|
|
14
|
+
.bv-boot-bar > i { display: block; width: 0; height: 100%; background: #EB6728; }
|
|
15
|
+
.bv-boot-desc { text-align: center; font-weight: 700; }
|
|
16
|
+
</style>
|
|
17
|
+
<script type="module" crossorigin src="./assets/player-Dv33xIOl.js"></script>
|
|
18
|
+
<link rel="stylesheet" crossorigin href="./assets/player-Bi0QW1hL.css">
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
<div id="root">
|
|
22
|
+
<div class="bv-boot-overlay" aria-label="资源下载中">
|
|
23
|
+
<div class="bv-boot-cover" data-boot-cover aria-hidden="true"></div>
|
|
24
|
+
<div class="bv-boot-bottom">
|
|
25
|
+
<div class="bv-boot-row" data-testid="loading-progress-row">
|
|
26
|
+
<div class="bv-boot-meta">
|
|
27
|
+
<div>0%</div>
|
|
28
|
+
<div>0B / 0B</div>
|
|
29
|
+
</div>
|
|
30
|
+
<div class="bv-boot-bar"><i data-boot-progress></i></div>
|
|
31
|
+
</div>
|
|
32
|
+
<div class="bv-boot-desc">资源下载中</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<script>
|
|
37
|
+
(function () {
|
|
38
|
+
var search = new URLSearchParams(location.search)
|
|
39
|
+
var hashQuery = location.hash.indexOf('?') >= 0 ? new URLSearchParams(location.hash.slice(location.hash.indexOf('?') + 1)) : null
|
|
40
|
+
var cover = search.get('cover') || (hashQuery && hashQuery.get('cover')) || ''
|
|
41
|
+
if (/^https?:\/\//i.test(cover)) {
|
|
42
|
+
var layer = document.querySelector('[data-boot-cover]')
|
|
43
|
+
if (layer) layer.style.backgroundImage = 'url("' + cover.replace(/"/g, '') + '")'
|
|
44
|
+
}
|
|
45
|
+
var bar = document.querySelector('[data-boot-progress]')
|
|
46
|
+
if (!bar) return
|
|
47
|
+
var started = Date.now()
|
|
48
|
+
var timer = setInterval(function () {
|
|
49
|
+
var progress = Math.min(15, (Date.now() - started) / 4000 * 15)
|
|
50
|
+
bar.style.width = progress + '%'
|
|
51
|
+
}, 100)
|
|
52
|
+
window.addEventListener('pagehide', function () { clearInterval(timer) })
|
|
53
|
+
})()
|
|
54
|
+
</script>
|
|
55
|
+
</body>
|
|
7
56
|
</html>
|
package/dist/url.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d="/branch-video-runtime/player.html",l=e=>/^\d+$/.test(e)&&Number(e)>0&&Number(e)<=65535,a=e=>{const r=e.split(".");return r.length===4&&r.every(t=>/^\d+$/.test(t)&&Number(t)<=255)},p=e=>{if(!/^[0-9a-f:]+$/i.test(e))return!1;const r=e.split("::");if(r.length>2)return!1;const t=r.flatMap(n=>n?n.split(":"):[]);return t.every(n=>/^[0-9a-f]{1,4}$/i.test(n))?r.length===2?t.length<8:t.length===8:!1},o=e=>{const r=e.endsWith(".")?e.slice(0,-1):e;return/^[\d.]+$/.test(r)?a(r):!!r&&!r.includes("..")&&r.split(".").every(t=>/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(t))},m=e=>{if(!e||e.includes("@"))return!1;if(e.startsWith("[")){const n=e.indexOf("]"),i=e.slice(1,n),s=e.slice(n+1);return n<=1||!p(i)?!1:!s||s.startsWith(":")&&l(s.slice(1))}const r=e.lastIndexOf(":");if(r===-1)return o(e);const t=e.slice(0,r);return o(t)&&!t.includes(":")&&l(e.slice(r+1))},u=e=>{const r=/^(https?):\/\/([^\s/?#]+)([/\?#].*)?$/i.exec(e);return!r||!m(r[2])?null:{authority:r[2],suffix:r[3]||""}},U=e=>u(e)!==null,c=(e,r)=>{if(!U(r)||e==="runtimeUrl"&&r.includes("#"))throw new TypeError(`${e} must be an absolute HTTP(S) URL`);return r},h=e=>{const r=u(e);if(!r||r.suffix&&r.suffix!=="/")throw new TypeError("parentOrigin must be an HTTP(S) origin");return e.endsWith("/")?e.slice(0,-1):e};function g(e){const r=e.runtimeUrl?c("runtimeUrl",e.runtimeUrl):d,t=c("scriptUrl",e.scriptUrl),n=e.cover===void 0?void 0:c("cover",e.cover),i=e.parentOrigin===void 0?void 0:h(e.parentOrigin),s=[`script=${encodeURIComponent(t)}`,"embedPlatform=web_player_sdk","sdkProtocol=1"];n&&s.push(`cover=${encodeURIComponent(n)}`),i&&s.push(`parentOrigin=${encodeURIComponent(i)}`),e.cshost&&s.push(`cshost=${encodeURIComponent(e.cshost)}`),e.controls!==void 0&&s.push(`controls=${e.controls}`),e.debug!==void 0&&s.push(`debug=${e.debug}`);const f=r.includes("?")?"&":"?";return`${r}${f}${s.join("&")}`}exports.DEFAULT_RUNTIME_PATH=d;exports.buildBranchVideoPlayerUrl=g;
|
package/dist/url.d.ts
CHANGED
package/dist/url.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
return
|
|
4
|
-
},
|
|
5
|
-
if (!/^[0-9a-f:]+$/i.test(
|
|
6
|
-
const
|
|
7
|
-
if (
|
|
8
|
-
const
|
|
9
|
-
return
|
|
10
|
-
}, l = (
|
|
11
|
-
const
|
|
12
|
-
return /^[\d.]+$/.test(
|
|
13
|
-
},
|
|
14
|
-
if (!
|
|
15
|
-
if (
|
|
16
|
-
const
|
|
17
|
-
return
|
|
1
|
+
const f = "/branch-video-runtime/player.html", o = (e) => /^\d+$/.test(e) && Number(e) > 0 && Number(e) <= 65535, p = (e) => {
|
|
2
|
+
const r = e.split(".");
|
|
3
|
+
return r.length === 4 && r.every((t) => /^\d+$/.test(t) && Number(t) <= 255);
|
|
4
|
+
}, a = (e) => {
|
|
5
|
+
if (!/^[0-9a-f:]+$/i.test(e)) return !1;
|
|
6
|
+
const r = e.split("::");
|
|
7
|
+
if (r.length > 2) return !1;
|
|
8
|
+
const t = r.flatMap((n) => n ? n.split(":") : []);
|
|
9
|
+
return t.every((n) => /^[0-9a-f]{1,4}$/i.test(n)) ? r.length === 2 ? t.length < 8 : t.length === 8 : !1;
|
|
10
|
+
}, l = (e) => {
|
|
11
|
+
const r = e.endsWith(".") ? e.slice(0, -1) : e;
|
|
12
|
+
return /^[\d.]+$/.test(r) ? p(r) : !!r && !r.includes("..") && r.split(".").every((t) => /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(t));
|
|
13
|
+
}, m = (e) => {
|
|
14
|
+
if (!e || e.includes("@")) return !1;
|
|
15
|
+
if (e.startsWith("[")) {
|
|
16
|
+
const n = e.indexOf("]"), i = e.slice(1, n), s = e.slice(n + 1);
|
|
17
|
+
return n <= 1 || !a(i) ? !1 : !s || s.startsWith(":") && o(s.slice(1));
|
|
18
18
|
}
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
21
|
-
const
|
|
22
|
-
return l(
|
|
23
|
-
},
|
|
24
|
-
const
|
|
25
|
-
return !
|
|
26
|
-
},
|
|
27
|
-
if (!
|
|
28
|
-
return
|
|
29
|
-
},
|
|
30
|
-
const
|
|
31
|
-
if (!
|
|
32
|
-
return
|
|
19
|
+
const r = e.lastIndexOf(":");
|
|
20
|
+
if (r === -1) return l(e);
|
|
21
|
+
const t = e.slice(0, r);
|
|
22
|
+
return l(t) && !t.includes(":") && o(e.slice(r + 1));
|
|
23
|
+
}, d = (e) => {
|
|
24
|
+
const r = /^(https?):\/\/([^\s/?#]+)([/\?#].*)?$/i.exec(e);
|
|
25
|
+
return !r || !m(r[2]) ? null : { authority: r[2], suffix: r[3] || "" };
|
|
26
|
+
}, h = (e) => d(e) !== null, c = (e, r) => {
|
|
27
|
+
if (!h(r) || e === "runtimeUrl" && r.includes("#")) throw new TypeError(`${e} must be an absolute HTTP(S) URL`);
|
|
28
|
+
return r;
|
|
29
|
+
}, U = (e) => {
|
|
30
|
+
const r = d(e);
|
|
31
|
+
if (!r || r.suffix && r.suffix !== "/") throw new TypeError("parentOrigin must be an HTTP(S) origin");
|
|
32
|
+
return e.endsWith("/") ? e.slice(0, -1) : e;
|
|
33
33
|
};
|
|
34
|
-
function
|
|
35
|
-
const
|
|
36
|
-
`script=${encodeURIComponent(
|
|
34
|
+
function g(e) {
|
|
35
|
+
const r = e.runtimeUrl ? c("runtimeUrl", e.runtimeUrl) : f, t = c("scriptUrl", e.scriptUrl), n = e.cover === void 0 ? void 0 : c("cover", e.cover), i = e.parentOrigin === void 0 ? void 0 : U(e.parentOrigin), s = [
|
|
36
|
+
`script=${encodeURIComponent(t)}`,
|
|
37
37
|
"embedPlatform=web_player_sdk",
|
|
38
38
|
"sdkProtocol=1"
|
|
39
39
|
];
|
|
40
|
-
s &&
|
|
41
|
-
const
|
|
42
|
-
return `${
|
|
40
|
+
n && s.push(`cover=${encodeURIComponent(n)}`), i && s.push(`parentOrigin=${encodeURIComponent(i)}`), e.cshost && s.push(`cshost=${encodeURIComponent(e.cshost)}`), e.controls !== void 0 && s.push(`controls=${e.controls}`), e.debug !== void 0 && s.push(`debug=${e.debug}`);
|
|
41
|
+
const u = r.includes("?") ? "&" : "?";
|
|
42
|
+
return `${r}${u}${s.join("&")}`;
|
|
43
43
|
}
|
|
44
44
|
export {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
f as DEFAULT_RUNTIME_PATH,
|
|
46
|
+
g as buildBranchVideoPlayerUrl
|
|
47
47
|
};
|
package/package.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "branch-video-player-sdk",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"main": "./dist/index.umd.cjs",
|
|
6
|
-
"module": "./dist/index.js",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
|
-
"unpkg": "./dist/index.umd.cjs",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"import": "./dist/index.js",
|
|
13
|
-
"require": "./dist/index.umd.cjs"
|
|
14
|
-
},
|
|
15
|
-
"./url": {
|
|
16
|
-
"types": "./dist/url.d.ts",
|
|
17
|
-
"import": "./dist/url.js",
|
|
18
|
-
"require": "./dist/url.cjs"
|
|
19
|
-
},
|
|
20
|
-
"./vite": {
|
|
21
|
-
"types": "./dist/vite.d.ts",
|
|
22
|
-
"import": "./dist/vite.js",
|
|
23
|
-
"require": "./dist/vite.cjs"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
"files": [
|
|
27
|
-
"dist",
|
|
28
|
-
"README.md"
|
|
29
|
-
]
|
|
30
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "branch-video-player-sdk",
|
|
3
|
+
"version": "0.2.13",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.umd.cjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"unpkg": "./dist/index.umd.cjs",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.umd.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./url": {
|
|
16
|
+
"types": "./dist/url.d.ts",
|
|
17
|
+
"import": "./dist/url.js",
|
|
18
|
+
"require": "./dist/url.cjs"
|
|
19
|
+
},
|
|
20
|
+
"./vite": {
|
|
21
|
+
"types": "./dist/vite.d.ts",
|
|
22
|
+
"import": "./dist/vite.js",
|
|
23
|
+
"require": "./dist/vite.cjs"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"README.md"
|
|
29
|
+
]
|
|
30
|
+
}
|