@lazycatcloud/lzc-video-player 0.0.35 → 0.0.36
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/lzc-video-player.js +50 -51
- package/dist/model.d.ts +1 -0
- package/dist/stores/playlist.d.ts +45 -0
- package/package.json +1 -1
package/dist/lzc-video-player.js
CHANGED
|
@@ -51463,6 +51463,12 @@ const getFrame = (t) => t ? client$2.getFileDownloadLink(t) : EmptySvg, addFrame
|
|
|
51463
51463
|
getters: {
|
|
51464
51464
|
getHistoryInfo(r) {
|
|
51465
51465
|
return (a) => r.infos.find((n) => n.sourceUrl === a);
|
|
51466
|
+
},
|
|
51467
|
+
getHistoryInfoByPath(r) {
|
|
51468
|
+
return (a) => r.infos.find((n) => {
|
|
51469
|
+
if (n.path && n.path === a)
|
|
51470
|
+
return n;
|
|
51471
|
+
});
|
|
51466
51472
|
}
|
|
51467
51473
|
},
|
|
51468
51474
|
actions: {
|
|
@@ -53307,7 +53313,7 @@ const QItem = createComponent({
|
|
|
53307
53313
|
}, s = (u, l) => {
|
|
53308
53314
|
var c, d, f;
|
|
53309
53315
|
return (c = a.value) != null && c.auto ? u.id == "auto" : (d = a.value) != null && d.origin ? u.id === "origin" : Math.min(u.height, u.width) === ((f = a.value) == null ? void 0 : f.res) && l > 0;
|
|
53310
|
-
}, o = (u) => u.id === "origin" ? "\u539F\u59CB\u753B\u8D28" : u.id === "auto" ? "\u81EA\u52A8" : `${u.
|
|
53316
|
+
}, o = (u) => u.id === "origin" ? "\u539F\u59CB\u753B\u8D28" : u.id === "auto" ? "\u81EA\u52A8" : `${u.height} P`;
|
|
53311
53317
|
return (u, l) => (openBlock(), createBlock(SimpleList, {
|
|
53312
53318
|
items: unref(r),
|
|
53313
53319
|
isActive: s,
|
|
@@ -87183,16 +87189,6 @@ const previewConfig = {
|
|
|
87183
87189
|
tile: 4,
|
|
87184
87190
|
len: 16
|
|
87185
87191
|
};
|
|
87186
|
-
function isNetdiskSource(t, e = !1) {
|
|
87187
|
-
return e ? !0 : !(t.startsWith("http") || t.startsWith("blob"));
|
|
87188
|
-
}
|
|
87189
|
-
function filenameByUrl(t, e) {
|
|
87190
|
-
e = e.split("?")[0];
|
|
87191
|
-
let r = new RegExp(`${t}/hls/(.*?)/master.m3u8$`, "i"), a = e.match(r);
|
|
87192
|
-
if (a && a.length >= 2 || (a = e.match(/_lzc\/files\/home\/(.*?)$/i), a && a.length >= 2))
|
|
87193
|
-
return a[1];
|
|
87194
|
-
throw "invalid netdisk file url";
|
|
87195
|
-
}
|
|
87196
87192
|
function clearUrl(t) {
|
|
87197
87193
|
return t.startsWith("/") ? t.substring(1) : t.startsWith("%2F") ? t.substring(3) : t;
|
|
87198
87194
|
}
|
|
@@ -87203,11 +87199,11 @@ function useVideoPreview(t, e) {
|
|
|
87203
87199
|
e.currentTime() / (previewConfig.len * previewConfig.interval)
|
|
87204
87200
|
);
|
|
87205
87201
|
}
|
|
87206
|
-
function s(c = 0) {
|
|
87207
|
-
const
|
|
87202
|
+
function s(c, d = 0) {
|
|
87203
|
+
const f = d * previewConfig.len * previewConfig.interval, p = c.path;
|
|
87208
87204
|
return `${t}/screenshot/${clearUrl(
|
|
87209
|
-
|
|
87210
|
-
)}?start=${
|
|
87205
|
+
p
|
|
87206
|
+
)}?start=${f}`;
|
|
87211
87207
|
}
|
|
87212
87208
|
function o(c) {
|
|
87213
87209
|
if (a)
|
|
@@ -87217,13 +87213,16 @@ function useVideoPreview(t, e) {
|
|
|
87217
87213
|
);
|
|
87218
87214
|
if (c > d)
|
|
87219
87215
|
return;
|
|
87220
|
-
const f =
|
|
87221
|
-
if (
|
|
87216
|
+
const f = e.currentVideoInfo();
|
|
87217
|
+
if (!f.fromNetdisk && !f.path)
|
|
87218
|
+
return;
|
|
87219
|
+
const p = s(f, c);
|
|
87220
|
+
if (r.has(p))
|
|
87222
87221
|
return o(c + 1);
|
|
87223
|
-
console.log("load video preview: ", c,
|
|
87224
|
-
const
|
|
87225
|
-
|
|
87226
|
-
r.set(
|
|
87222
|
+
console.log("load video preview: ", c, p);
|
|
87223
|
+
const g = new Image();
|
|
87224
|
+
g.src = p, a = !0, g.onload = () => {
|
|
87225
|
+
r.set(p, g), a = !1;
|
|
87227
87226
|
};
|
|
87228
87227
|
}
|
|
87229
87228
|
function u() {
|
|
@@ -87231,8 +87230,11 @@ function useVideoPreview(t, e) {
|
|
|
87231
87230
|
return o(c);
|
|
87232
87231
|
}
|
|
87233
87232
|
function l() {
|
|
87234
|
-
const c = n(), d =
|
|
87235
|
-
|
|
87233
|
+
const c = n(), d = e.currentVideoInfo();
|
|
87234
|
+
if (!d.fromNetdisk && !d.path)
|
|
87235
|
+
return;
|
|
87236
|
+
const f = s(d, c);
|
|
87237
|
+
return r.get(f);
|
|
87236
87238
|
}
|
|
87237
87239
|
return { loadPreview: u, getPreview: l, currentPage: n };
|
|
87238
87240
|
}
|
|
@@ -87251,7 +87253,7 @@ function useSource(t) {
|
|
|
87251
87253
|
async function u(g) {
|
|
87252
87254
|
getFileLinkWithDefault(g._id).then((m) => {
|
|
87253
87255
|
t.poster(m);
|
|
87254
|
-
}), t.src(g.sourceUrl), g.name && (e = g.name),
|
|
87256
|
+
}), t.src(g.sourceUrl), g.name && (e = g.name), g.fromNetdisk && !LzcApp.isTvOsWebShell() && t.on(
|
|
87255
87257
|
"timeupdate",
|
|
87256
87258
|
lodash_throttle(() => {
|
|
87257
87259
|
(t.networkState() == 1 || t.networkState() == 2) && n.loadPreview();
|
|
@@ -87275,20 +87277,19 @@ function useSource(t) {
|
|
|
87275
87277
|
image: g
|
|
87276
87278
|
};
|
|
87277
87279
|
}
|
|
87278
|
-
t.currentSrc.bind(t), t.currentSrc = function() {
|
|
87279
|
-
const g = decodeURI(f());
|
|
87280
|
-
return isNetdiskSource(g) ? "/" + clearUrl(decodeURIComponent(filenameByUrl(a, g))) : g;
|
|
87281
|
-
};
|
|
87282
87280
|
const f = t.src.bind(t);
|
|
87283
87281
|
function p(g) {
|
|
87284
87282
|
if (!g)
|
|
87285
87283
|
return f();
|
|
87286
|
-
const m = (y, E = "") =>
|
|
87287
|
-
|
|
87288
|
-
|
|
87289
|
-
|
|
87290
|
-
|
|
87291
|
-
|
|
87284
|
+
const m = (y, E = "") => {
|
|
87285
|
+
const I = t.currentVideoInfo();
|
|
87286
|
+
return I.fromNetdisk && I.path || y.startsWith("/") && !y.startsWith(a) ? {
|
|
87287
|
+
src: `${a}/hls/${clearUrl(I.path || y)}/master.m3u8`,
|
|
87288
|
+
type: "application/x-mpegURL"
|
|
87289
|
+
} : {
|
|
87290
|
+
src: y,
|
|
87291
|
+
type: E
|
|
87292
|
+
};
|
|
87292
87293
|
};
|
|
87293
87294
|
let v = [];
|
|
87294
87295
|
Array.isArray(g) ? v = g.map((y) => m(y.src, y.type)) : typeof g == "string" ? v.push(m(g, "")) : v.push(m(g.src, g.type)), f(v);
|
|
@@ -87322,7 +87323,12 @@ function useSource(t) {
|
|
|
87322
87323
|
}
|
|
87323
87324
|
}, t.on("openVideo", async (g) => {
|
|
87324
87325
|
const m = g.info;
|
|
87325
|
-
e = m.name, t.
|
|
87326
|
+
e = m.name, t.currentVideoInfo = () => ({
|
|
87327
|
+
...m,
|
|
87328
|
+
duration: t.duration(),
|
|
87329
|
+
currentTime: t.currentTime(),
|
|
87330
|
+
name: t.currentVideoName()
|
|
87331
|
+
}), t.isCastMode() || (console.debug("openVideo: ", m), await u(m), t.isNetdiskSource = () => !!m.fromNetdisk, m.duration - m.currentTime > 3 && t.one("canplay", function() {
|
|
87326
87332
|
t.currentTime(m.currentTime);
|
|
87327
87333
|
}));
|
|
87328
87334
|
}), t.currentVideoName = c, t.currentPreview = d, t.isCastMode = function() {
|
|
@@ -87332,7 +87338,7 @@ function useSource(t) {
|
|
|
87332
87338
|
t.one("loadedmetadata", function() {
|
|
87333
87339
|
g != null && o(g), t.currentTime(m);
|
|
87334
87340
|
}), t.src(t.currentSource()), t.play();
|
|
87335
|
-
}
|
|
87341
|
+
};
|
|
87336
87342
|
}
|
|
87337
87343
|
function unrefElement(t) {
|
|
87338
87344
|
var e;
|
|
@@ -87463,33 +87469,26 @@ const _hoisted_1 = ["onClick"], _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
87463
87469
|
c.name = "referrer", c.content = "no-referrer", document.head.append(c), n = videojs(s.value, u()), useSource(n), n.dimensions(window.innerWidth, window.innerHeight), n.poster(r.poster);
|
|
87464
87470
|
const d = new LzcModal(n);
|
|
87465
87471
|
n.addChild(d), n.lzcModal = () => d, n.enableTouchActivity();
|
|
87466
|
-
const f = () =>
|
|
87467
|
-
_id: "",
|
|
87468
|
-
sourceUrl: n.src(),
|
|
87469
|
-
duration: n.duration(),
|
|
87470
|
-
currentTime: n.currentTime(),
|
|
87471
|
-
name: n.currentVideoName(),
|
|
87472
|
-
invalid: !1
|
|
87473
|
-
}), p = async (m) => {
|
|
87472
|
+
const f = async (g) => {
|
|
87474
87473
|
if (n.isDisposed()) {
|
|
87475
87474
|
console.debug("skip update because player already disposed.");
|
|
87476
87475
|
return;
|
|
87477
87476
|
}
|
|
87478
|
-
let
|
|
87479
|
-
|
|
87480
|
-
},
|
|
87477
|
+
let m = null;
|
|
87478
|
+
g && (m = () => makeVideoFrame(n)), l.updateOrCreateHistory(n.currentVideoInfo(), m);
|
|
87479
|
+
}, p = lodash_debounce(() => f(!1), 5e3, {
|
|
87481
87480
|
maxWait: 15e3
|
|
87482
87481
|
});
|
|
87483
87482
|
r.options && r.options.preload == "auto" && n.load(), n.on("back", () => {
|
|
87484
87483
|
n.dispose(), e("back");
|
|
87485
|
-
}), n.on("seeked",
|
|
87484
|
+
}), n.on("seeked", p), n.on("pause", () => f(!0)), n.on("timeupdate", p), n.on("userinactive", () => {
|
|
87486
87485
|
document.body.style.cursor = "none";
|
|
87487
87486
|
}), n.on("useractive", () => {
|
|
87488
87487
|
document.body.style.cursor = "default";
|
|
87489
87488
|
}), n.one("canplay", () => {
|
|
87490
|
-
var
|
|
87491
|
-
(
|
|
87492
|
-
}), console.log("player", n), r.onInit && r.onInit(n), window.videojs = videojs,
|
|
87489
|
+
var g;
|
|
87490
|
+
(g = r.options) != null && g.autoplay && n.play(), f(!0);
|
|
87491
|
+
}), console.log("player", n), r.onInit && r.onInit(n), window.videojs = videojs, window.player = n;
|
|
87493
87492
|
}), onUnmounted(() => {
|
|
87494
87493
|
n.isDisposed() || n.dispose();
|
|
87495
87494
|
}), (l, c) => (openBlock(), createElementBlock("div", {
|
package/dist/model.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export declare const useHistoryInfo: () => import("pinia").Store<"historyInfo",
|
|
|
30
30
|
invalid: boolean;
|
|
31
31
|
updateTime?: number | undefined;
|
|
32
32
|
fromNetdisk?: boolean | undefined;
|
|
33
|
+
path?: string | undefined;
|
|
33
34
|
_id: string;
|
|
34
35
|
}[];
|
|
35
36
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
@@ -43,6 +44,50 @@ export declare const useHistoryInfo: () => import("pinia").Store<"historyInfo",
|
|
|
43
44
|
invalid: boolean;
|
|
44
45
|
updateTime?: number | undefined;
|
|
45
46
|
fromNetdisk?: boolean | undefined;
|
|
47
|
+
path?: string | undefined;
|
|
48
|
+
_id: string;
|
|
49
|
+
} | undefined;
|
|
50
|
+
getHistoryInfoByPath(state: {
|
|
51
|
+
collection: {
|
|
52
|
+
find: (selector: Record<string, any>, options?: import("@lazycatcloud/minidb/dist/remoteDB").CollectionFindOptions | undefined) => {
|
|
53
|
+
fetch: () => Promise<VideoInfo[]>;
|
|
54
|
+
};
|
|
55
|
+
findOne: (selector: Record<string, any>, options?: import("@lazycatcloud/minidb/dist/remoteDB").CollectionFindOptions | undefined) => Promise<VideoInfo | null>;
|
|
56
|
+
upsertOrUpdate: (selector: Record<string, any>, doc: VideoInfo, options?: import("@lazycatcloud/minidb/dist/remoteDB").CollectionFindOptions | undefined) => Promise<VideoInfo | null>;
|
|
57
|
+
upsert: {
|
|
58
|
+
(doc: VideoInfo): Promise<VideoInfo | null>;
|
|
59
|
+
(doc: VideoInfo, base: VideoInfo | null | undefined): Promise<VideoInfo | null>;
|
|
60
|
+
(docs: VideoInfo[]): Promise<(VideoInfo | null)[]>;
|
|
61
|
+
(docs: VideoInfo[], bases: (VideoInfo | null | undefined)[]): Promise<(VideoInfo | null)[]>;
|
|
62
|
+
};
|
|
63
|
+
remove: {
|
|
64
|
+
(id: any): Promise<void>;
|
|
65
|
+
(ids: any[]): Promise<void>;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
infos: {
|
|
69
|
+
sourceUrl: string;
|
|
70
|
+
name: string;
|
|
71
|
+
duration: number;
|
|
72
|
+
currentTime: number;
|
|
73
|
+
invalid: boolean;
|
|
74
|
+
updateTime?: number | undefined;
|
|
75
|
+
fromNetdisk?: boolean | undefined;
|
|
76
|
+
path?: string | undefined;
|
|
77
|
+
_id: string;
|
|
78
|
+
}[];
|
|
79
|
+
} & import("pinia").PiniaCustomStateProperties<{
|
|
80
|
+
collection: RemoteDB<VideoInfo>;
|
|
81
|
+
infos: VideoInfo[];
|
|
82
|
+
}>): (path: string) => {
|
|
83
|
+
sourceUrl: string;
|
|
84
|
+
name: string;
|
|
85
|
+
duration: number;
|
|
86
|
+
currentTime: number;
|
|
87
|
+
invalid: boolean;
|
|
88
|
+
updateTime?: number | undefined;
|
|
89
|
+
fromNetdisk?: boolean | undefined;
|
|
90
|
+
path?: string | undefined;
|
|
46
91
|
_id: string;
|
|
47
92
|
} | undefined;
|
|
48
93
|
}, {
|