lx-video-player 1.0.12 → 1.0.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/dist/video-player.js +49 -44
- package/dist/video-player.umd.cjs +12 -12
- package/package.json +1 -1
package/dist/video-player.js
CHANGED
|
@@ -4,90 +4,95 @@ const M = {
|
|
|
4
4
|
maxBufferLength: 10,
|
|
5
5
|
maxBufferSize: 40 * 1024 * 1024,
|
|
6
6
|
maxMaxBufferLength: 30
|
|
7
|
-
}, l = navigator.userAgent.toLowerCase(),
|
|
8
|
-
|
|
9
|
-
const x =
|
|
7
|
+
}, l = navigator.userAgent.toLowerCase(), y = l.indexOf("micromessenger") > 0, k = l.indexOf("android") > 0;
|
|
8
|
+
y && l.indexOf("wxwork");
|
|
9
|
+
const x = y && l.indexOf("wxwork") > 0, D = /iphone|ipad|ipod|ios/.test(l);
|
|
10
10
|
function P(s) {
|
|
11
11
|
const { onReady: h } = s || {}, g = D || k && x;
|
|
12
12
|
let r, a = !1, f = !1, v = 0, m = 0, u = !1, p = !1, w = null;
|
|
13
|
-
const
|
|
13
|
+
const b = async () => {
|
|
14
14
|
if (w)
|
|
15
15
|
return w;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
try {
|
|
17
|
+
const { default: e } = await import("./tcplayer.v4.8.0.min-31e6d34b.js").then((t) => t.t);
|
|
18
|
+
console.log(e, "tcplayer---------"), w = e;
|
|
19
|
+
} catch (e) {
|
|
20
|
+
console.log(e, "error------");
|
|
21
|
+
}
|
|
22
|
+
return w;
|
|
23
|
+
}, L = (e) => {
|
|
19
24
|
!a && !f || (p ? e == null || e.pause() : e == null || e.play());
|
|
20
|
-
},
|
|
21
|
-
!a || f || (v = e.deltaY, m =
|
|
22
|
-
}, T = (e,
|
|
25
|
+
}, O = (e, t) => {
|
|
26
|
+
!a || f || (v = e.deltaY, m = t.currentTime());
|
|
27
|
+
}, T = (e, t) => {
|
|
23
28
|
if (!a || f)
|
|
24
29
|
return;
|
|
25
|
-
const
|
|
26
|
-
let d = m + c *
|
|
27
|
-
d < 0 && (d = 0), d > c && (d = c),
|
|
28
|
-
}, E = async (e,
|
|
30
|
+
const n = u ? e.deltaY : e.deltaX, o = u ? window.innerHeight : window.innerWidth, i = (n - v) / o, c = t.duration();
|
|
31
|
+
let d = m + c * i;
|
|
32
|
+
d < 0 && (d = 0), d > c && (d = c), t.currentTime(d);
|
|
33
|
+
}, E = async (e, t) => {
|
|
29
34
|
try {
|
|
30
|
-
const { default:
|
|
31
|
-
|
|
32
|
-
new
|
|
35
|
+
const { default: n } = await import("./hammer-005503be.js").then((i) => i.h), o = new n.Manager(t);
|
|
36
|
+
o.add(
|
|
37
|
+
new n.Pan({
|
|
33
38
|
threshold: 10,
|
|
34
39
|
pointers: 0,
|
|
35
|
-
direction:
|
|
40
|
+
direction: n.DIRECTION_ALL
|
|
36
41
|
})
|
|
37
|
-
),
|
|
38
|
-
|
|
39
|
-
}),
|
|
40
|
-
|
|
41
|
-
}),
|
|
42
|
-
T(
|
|
42
|
+
), o.add(new n.Swipe()).recognizeWith(o.get("pan")), o.add(new n.Tap({ event: "doubletap", taps: 2 })), o.on("doubletap", () => {
|
|
43
|
+
L(e);
|
|
44
|
+
}), o.on("panstart", (i) => {
|
|
45
|
+
O(i, e);
|
|
46
|
+
}), o.on("panmove", (i) => {
|
|
47
|
+
T(i, e);
|
|
43
48
|
});
|
|
44
49
|
} catch {
|
|
45
50
|
}
|
|
46
51
|
}, H = (e) => {
|
|
47
52
|
e.on("fullscreenchange", () => {
|
|
48
53
|
a = e.isFullscreen();
|
|
49
|
-
const
|
|
54
|
+
const t = e.el_, n = t.querySelector(".vjs-progress-control");
|
|
50
55
|
u = e.videoWidth() > e.videoHeight();
|
|
51
|
-
const
|
|
56
|
+
const o = window.innerWidth, i = window.innerHeight;
|
|
52
57
|
f = window.orientation === 90 || window.orientation === -90;
|
|
53
|
-
const c = Math.floor(Math.abs((
|
|
58
|
+
const c = Math.floor(Math.abs((o - i) / 2));
|
|
54
59
|
if (u)
|
|
55
|
-
a ? (Object.assign(
|
|
60
|
+
a ? (Object.assign(t.style, {
|
|
56
61
|
top: `${c}px`,
|
|
57
62
|
left: `-${c}px`
|
|
58
|
-
}),
|
|
63
|
+
}), t.classList.add("landscape"), n && (n.style.pointerEvents = "none")) : (t.classList.remove("landscape"), t.setAttribute("style", ""), n && (n.style.pointerEvents = ""));
|
|
59
64
|
else {
|
|
60
65
|
if (!x)
|
|
61
66
|
return;
|
|
62
|
-
a ? (Object.assign(
|
|
67
|
+
a ? (Object.assign(t.style, {
|
|
63
68
|
width: "100vw",
|
|
64
69
|
height: "100vh",
|
|
65
70
|
position: "fixed",
|
|
66
71
|
zIndex: "999",
|
|
67
72
|
top: "0px"
|
|
68
|
-
}),
|
|
73
|
+
}), n && (n.style.pointerEvents = "none")) : (t.removeAttribute("style"), n && (n.style.pointerEvents = ""));
|
|
69
74
|
}
|
|
70
75
|
});
|
|
71
|
-
}, I = (e,
|
|
72
|
-
|
|
76
|
+
}, I = (e, t) => {
|
|
77
|
+
t.on("play", () => {
|
|
73
78
|
p = !0;
|
|
74
|
-
}),
|
|
79
|
+
}), t.on("pause", () => {
|
|
75
80
|
p = !1;
|
|
76
|
-
}),
|
|
81
|
+
}), t.on("ended", () => {
|
|
77
82
|
p = !1;
|
|
78
|
-
}),
|
|
79
|
-
h == null || h(
|
|
83
|
+
}), t.on("ready", () => {
|
|
84
|
+
h == null || h(t);
|
|
80
85
|
});
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
}, S = async (e,
|
|
84
|
-
r = (await
|
|
86
|
+
const n = document == null ? void 0 : document.getElementById(e);
|
|
87
|
+
n && E(t, n);
|
|
88
|
+
}, S = async (e, t) => {
|
|
89
|
+
r = (await b())(t, { ...e, fakeFullscreen: g }), r && (I(t, r), g && H(r));
|
|
85
90
|
};
|
|
86
91
|
return {
|
|
87
|
-
loadVideo: async (e,
|
|
88
|
-
if (r && (r.dispose(), r = void 0), !(!e || !
|
|
92
|
+
loadVideo: async (e, t) => {
|
|
93
|
+
if (r && (r.dispose(), r = void 0), !(!e || !t))
|
|
89
94
|
try {
|
|
90
|
-
await S(
|
|
95
|
+
await S(t, e);
|
|
91
96
|
} catch {
|
|
92
97
|
}
|
|
93
98
|
},
|