@webitch/short-player 0.1.1 → 0.1.3
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/app/layout.d.ts +6 -6
- package/dist/app/layout.js +23 -0
- package/dist/app/layout.js.map +1 -0
- package/dist/app/page.d.ts +1 -1
- package/dist/app/page.js +19 -0
- package/dist/app/page.js.map +1 -0
- package/dist/component/index.d.ts +20 -20
- package/dist/component/index.d.ts.map +1 -1
- package/dist/component/index.js +64 -0
- package/dist/component/index.js.map +1 -0
- package/dist/entites/PlayBtn/ui/index.d.ts +4 -4
- package/dist/entites/PlayBtn/ui/index.js +23 -0
- package/dist/entites/PlayBtn/ui/index.js.map +1 -0
- package/dist/entites/ProgressBar/index.d.ts +1 -1
- package/dist/entites/ProgressBar/index.js +6 -0
- package/dist/entites/ProgressBar/index.js.map +1 -0
- package/dist/entites/ProgressBar/lib/handlers.d.ts +10 -10
- package/dist/entites/ProgressBar/lib/handlers.js +99 -0
- package/dist/entites/ProgressBar/lib/handlers.js.map +1 -0
- package/dist/entites/ProgressBar/ui/index.d.ts +7 -7
- package/dist/entites/ProgressBar/ui/index.js +135 -0
- package/dist/entites/ProgressBar/ui/index.js.map +1 -0
- package/dist/entites/SettingsButtons/index.d.ts +1 -1
- package/dist/entites/SettingsButtons/index.js +6 -0
- package/dist/entites/SettingsButtons/index.js.map +1 -0
- package/dist/entites/SettingsButtons/lib/handlers.d.ts +7 -7
- package/dist/entites/SettingsButtons/lib/handlers.js +46 -0
- package/dist/entites/SettingsButtons/lib/handlers.js.map +1 -0
- package/dist/entites/SettingsButtons/models/settings-buttons.interface.d.ts +5 -5
- package/dist/entites/SettingsButtons/models/settings-buttons.interface.js +3 -0
- package/dist/entites/SettingsButtons/models/settings-buttons.interface.js.map +1 -0
- package/dist/entites/SettingsButtons/ui/index.d.ts +2 -2
- package/dist/entites/SettingsButtons/ui/index.js +60 -0
- package/dist/entites/SettingsButtons/ui/index.js.map +1 -0
- package/dist/entites/ShortDescription/ui/index.d.ts +9 -9
- package/dist/entites/ShortDescription/ui/index.d.ts.map +1 -1
- package/dist/entites/ShortDescription/ui/index.js +15 -0
- package/dist/entites/ShortDescription/ui/index.js.map +1 -0
- package/dist/entites/ShortVideoBtns/ui/index.d.ts +10 -10
- package/dist/entites/ShortVideoBtns/ui/index.d.ts.map +1 -1
- package/dist/entites/ShortVideoBtns/ui/index.js +16 -0
- package/dist/entites/ShortVideoBtns/ui/index.js.map +1 -0
- package/dist/entites/SoundBtn/lib/handlers.d.ts +5 -5
- package/dist/entites/SoundBtn/lib/handlers.js +61 -0
- package/dist/entites/SoundBtn/lib/handlers.js.map +1 -0
- package/dist/entites/SoundBtn/ui/index.d.ts +6 -6
- package/dist/entites/SoundBtn/ui/index.js +94 -0
- package/dist/entites/SoundBtn/ui/index.js.map +1 -0
- package/dist/entites/progress-bar/index.d.ts +1 -1
- package/dist/entites/progress-bar/index.js +6 -0
- package/dist/entites/progress-bar/index.js.map +1 -0
- package/dist/entites/progress-bar/lib/handlers.d.ts +15 -15
- package/dist/entites/progress-bar/lib/handlers.js +109 -0
- package/dist/entites/progress-bar/lib/handlers.js.map +1 -0
- package/dist/entites/progress-bar/ui/progress-bar.d.ts +10 -10
- package/dist/entites/progress-bar/ui/progress-bar.js +125 -0
- package/dist/entites/progress-bar/ui/progress-bar.js.map +1 -0
- package/dist/features/player-tools/lib/handlers.d.ts +2 -2
- package/dist/features/player-tools/lib/handlers.js +14 -0
- package/dist/features/player-tools/lib/handlers.js.map +1 -0
- package/dist/features/player-tools/model/player-tools.interface.d.ts +13 -13
- package/dist/features/player-tools/model/player-tools.interface.js +3 -0
- package/dist/features/player-tools/model/player-tools.interface.js.map +1 -0
- package/dist/features/player-tools/ui/player-tools.d.ts +2 -2
- package/dist/features/player-tools/ui/player-tools.js +23 -0
- package/dist/features/player-tools/ui/player-tools.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/shared/constants/svgs.d.ts +18 -18
- package/dist/shared/constants/svgs.js +22 -0
- package/dist/shared/constants/svgs.js.map +1 -0
- package/dist/shared/constants/themes.d.ts +4 -4
- package/dist/shared/constants/themes.js +9 -0
- package/dist/shared/constants/themes.js.map +1 -0
- package/dist/shared/hooks/getDeviceIsMobile.d.ts +4 -4
- package/dist/shared/hooks/getDeviceIsMobile.d.ts.map +1 -1
- package/dist/shared/hooks/getDeviceIsMobile.js +14 -0
- package/dist/shared/hooks/getDeviceIsMobile.js.map +1 -0
- package/dist/shared/providers/themeProvider.d.ts +16 -16
- package/dist/shared/providers/themeProvider.js +56 -0
- package/dist/shared/providers/themeProvider.js.map +1 -0
- package/dist/shared/ui/Svg/index.d.ts +12 -12
- package/dist/shared/ui/Svg/index.d.ts.map +1 -1
- package/dist/shared/ui/Svg/index.js +49 -0
- package/dist/shared/ui/Svg/index.js.map +1 -0
- package/dist/shared/ui/index.d.ts +1 -1
- package/dist/shared/ui/index.js +6 -0
- package/dist/shared/ui/index.js.map +1 -0
- package/dist/shared/utils/formatViews.d.ts +1 -1
- package/dist/shared/utils/formatViews.js +14 -0
- package/dist/shared/utils/formatViews.js.map +1 -0
- package/dist/shared/utils/getHHSStime.d.ts +1 -1
- package/dist/shared/utils/getHHSStime.d.ts.map +1 -1
- package/dist/shared/utils/getHHSStime.js +36 -0
- package/dist/shared/utils/getHHSStime.js.map +1 -0
- package/dist/widgets/video-tag/lib/handlers.d.ts +5 -5
- package/dist/widgets/video-tag/lib/handlers.js +26 -0
- package/dist/widgets/video-tag/lib/handlers.js.map +1 -0
- package/dist/widgets/video-tag/model/video-tag.interface.d.ts +15 -15
- package/dist/widgets/video-tag/model/video-tag.interface.js +3 -0
- package/dist/widgets/video-tag/model/video-tag.interface.js.map +1 -0
- package/dist/widgets/video-tag/ui/video-tag.d.ts +2 -2
- package/dist/widgets/video-tag/ui/video-tag.js +62 -0
- package/dist/widgets/video-tag/ui/video-tag.js.map +1 -0
- package/package.json +6 -4
- package/dist/index.ts +0 -1
package/dist/app/layout.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Metadata } from "next";
|
|
2
|
-
import "./globals.scss";
|
|
3
|
-
export declare const metadata: Metadata;
|
|
4
|
-
export default function RootLayout({ children, }: Readonly<{
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
}>): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import type { Metadata } from "next";
|
|
2
|
+
import "./globals.scss";
|
|
3
|
+
export declare const metadata: Metadata;
|
|
4
|
+
export default function RootLayout({ children, }: Readonly<{
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.metadata = void 0;
|
|
4
|
+
exports.default = RootLayout;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const google_1 = require("next/font/google");
|
|
7
|
+
require("./globals.scss");
|
|
8
|
+
const geistSans = (0, google_1.Geist)({
|
|
9
|
+
variable: "--font-geist-sans",
|
|
10
|
+
subsets: ["latin"],
|
|
11
|
+
});
|
|
12
|
+
const geistMono = (0, google_1.Geist_Mono)({
|
|
13
|
+
variable: "--font-geist-mono",
|
|
14
|
+
subsets: ["latin"],
|
|
15
|
+
});
|
|
16
|
+
exports.metadata = {
|
|
17
|
+
title: "Create Next App",
|
|
18
|
+
description: "Generated by create next app",
|
|
19
|
+
};
|
|
20
|
+
function RootLayout({ children, }) {
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)("html", { lang: "en", className: `${geistSans.variable} ${geistMono.variable}`, children: (0, jsx_runtime_1.jsx)("body", { children: children }) }));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/app/layout.tsx"],"names":[],"mappings":";;;AAmBA,6BAUC;;AA5BD,6CAAqD;AACrD,0BAAwB;AAExB,MAAM,SAAS,GAAG,IAAA,cAAK,EAAC;IACtB,QAAQ,EAAE,mBAAmB;IAC7B,OAAO,EAAE,CAAC,OAAO,CAAC;CACnB,CAAC,CAAC;AAEH,MAAM,SAAS,GAAG,IAAA,mBAAU,EAAC;IAC3B,QAAQ,EAAE,mBAAmB;IAC7B,OAAO,EAAE,CAAC,OAAO,CAAC;CACnB,CAAC,CAAC;AAEU,QAAA,QAAQ,GAAa;IAChC,KAAK,EAAE,iBAAiB;IACxB,WAAW,EAAE,8BAA8B;CAC5C,CAAC;AAEF,SAAwB,UAAU,CAAC,EACjC,QAAQ,GAGR;IACA,OAAO,CACL,iCAAM,IAAI,EAAC,IAAI,EAAC,SAAS,EAAE,GAAG,SAAS,CAAC,QAAQ,IAAI,SAAS,CAAC,QAAQ,EAAE,YACtE,2CAAO,QAAQ,GAAQ,GAClB,CACR,CAAC;AACJ,CAAC"}
|
package/dist/app/page.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default function Home(): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export default function Home(): import("react/jsx-runtime").JSX.Element;
|
|
2
2
|
//# sourceMappingURL=page.d.ts.map
|
package/dist/app/page.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.default = Home;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const component_1 = require("@/component");
|
|
7
|
+
// СТАРТУЕМ ПЕРЕДЕЛ ПОД ЛАЙВЫ
|
|
8
|
+
// const VIDEODATA = {
|
|
9
|
+
// playlistUrl: '/videos/hls_output/master.m3u8',
|
|
10
|
+
// duration: 9.333,
|
|
11
|
+
// }
|
|
12
|
+
const VIDEODATA = {
|
|
13
|
+
playlistUrl: '/videos/long-video/longVIdeo.m3u8',
|
|
14
|
+
duration: 40.333,
|
|
15
|
+
};
|
|
16
|
+
function Home() {
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { width: '500px', height: '1000px' }, children: (0, jsx_runtime_1.jsx)(component_1.ShortPlayer, { playlistUrl: VIDEODATA.playlistUrl, duration: VIDEODATA === null || VIDEODATA === void 0 ? void 0 : VIDEODATA.duration, theme: "dark" }) }));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.js","sourceRoot":"","sources":["../../src/app/page.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;;AAoBZ,uBAOC;;AAzBD,2CAA0C;AAG1C,6BAA6B;AAE7B,sBAAsB;AACtB,mDAAmD;AACnD,qBAAqB;AACrB,IAAI;AAGJ,MAAM,SAAS,GAAG;IAChB,WAAW,EAAE,mCAAmC;IAChD,QAAQ,EAAE,MAAM;CACjB,CAAA;AAID,SAAwB,IAAI;IAE1B,OAAO,CACL,gCAAK,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAC,YAC7C,uBAAC,uBAAW,IAAC,WAAW,EAAE,SAAS,CAAC,WAAW,EAAE,QAAQ,EAAE,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,QAAQ,EAAE,KAAK,EAAC,MAAM,GAAE,GAC1F,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import Hls from "hls.js";
|
|
2
|
-
import { Dispatch, RefObject, SetStateAction } from "react";
|
|
3
|
-
import React from "react";
|
|
4
|
-
interface IShortPlayerContext {
|
|
5
|
-
isPaused: boolean;
|
|
6
|
-
setIsPaused: React.Dispatch<React.SetStateAction<boolean>>;
|
|
7
|
-
hls: Hls;
|
|
8
|
-
hideToolsTimer: RefObject<NodeJS.Timeout | null>;
|
|
9
|
-
isVisibleTools: boolean;
|
|
10
|
-
setIsVisibleTools: Dispatch<SetStateAction<boolean>>;
|
|
11
|
-
}
|
|
12
|
-
export declare const playerContext: React.Context<IShortPlayerContext
|
|
13
|
-
export declare const usePlayerContext: () => IShortPlayerContext;
|
|
14
|
-
interface IShortPlayer {
|
|
15
|
-
playlistUrl: string;
|
|
16
|
-
duration: number;
|
|
17
|
-
theme: string;
|
|
18
|
-
}
|
|
19
|
-
export declare const ShortPlayer: React.FC<IShortPlayer>;
|
|
20
|
-
export {};
|
|
1
|
+
import Hls from "hls.js";
|
|
2
|
+
import { Dispatch, RefObject, SetStateAction } from "react";
|
|
3
|
+
import React from "react";
|
|
4
|
+
interface IShortPlayerContext {
|
|
5
|
+
isPaused: boolean;
|
|
6
|
+
setIsPaused: React.Dispatch<React.SetStateAction<boolean>>;
|
|
7
|
+
hls: Hls;
|
|
8
|
+
hideToolsTimer: RefObject<NodeJS.Timeout | null>;
|
|
9
|
+
isVisibleTools: boolean;
|
|
10
|
+
setIsVisibleTools: Dispatch<SetStateAction<boolean>>;
|
|
11
|
+
}
|
|
12
|
+
export declare const playerContext: React.Context<IShortPlayerContext>;
|
|
13
|
+
export declare const usePlayerContext: () => IShortPlayerContext;
|
|
14
|
+
interface IShortPlayer {
|
|
15
|
+
playlistUrl: string;
|
|
16
|
+
duration: number;
|
|
17
|
+
theme: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const ShortPlayer: React.FC<IShortPlayer>;
|
|
20
|
+
export {};
|
|
21
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/component/index.tsx"],"names":[],"mappings":"AAEA,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,EAAiB,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAwD,M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EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA6B9C,CAAA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ShortPlayer = exports.usePlayerContext = exports.playerContext = void 0;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const hls_js_1 = __importDefault(require("hls.js"));
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const video_tag_1 = require("../widgets/video-tag/ui/video-tag");
|
|
12
|
+
const themeProvider_1 = require("../shared/providers/themeProvider");
|
|
13
|
+
exports.playerContext = (0, react_1.createContext)(null);
|
|
14
|
+
const ShortPlayerProvider = ({ children, videoRef, hls }) => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const [isPaused, setIsPaused] = (0, react_1.useState)(true);
|
|
17
|
+
const [isVisibleTools, setIsVisibleTools] = (0, react_1.useState)(false);
|
|
18
|
+
const hideToolsTimer = (0, react_1.useRef)(null);
|
|
19
|
+
if (isPaused) {
|
|
20
|
+
(_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
(_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
|
|
24
|
+
}
|
|
25
|
+
const value = {
|
|
26
|
+
isPaused,
|
|
27
|
+
setIsPaused,
|
|
28
|
+
hls,
|
|
29
|
+
hideToolsTimer,
|
|
30
|
+
isVisibleTools,
|
|
31
|
+
setIsVisibleTools,
|
|
32
|
+
};
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(exports.playerContext.Provider, { value: value, children: children }));
|
|
34
|
+
};
|
|
35
|
+
const usePlayerContext = () => {
|
|
36
|
+
const context = (0, react_1.useContext)(exports.playerContext);
|
|
37
|
+
if (!context) {
|
|
38
|
+
throw new Error('usePlayerContext must be used within PlayerProvider');
|
|
39
|
+
}
|
|
40
|
+
return context;
|
|
41
|
+
};
|
|
42
|
+
exports.usePlayerContext = usePlayerContext;
|
|
43
|
+
const ShortPlayer = ({ playlistUrl, duration, theme = 'dark' }) => {
|
|
44
|
+
const videoRef = (0, react_1.useRef)(null);
|
|
45
|
+
const hls = new hls_js_1.default({ startLevel: -1,
|
|
46
|
+
maxBufferLength: 3,
|
|
47
|
+
lowLatencyMode: false,
|
|
48
|
+
maxMaxBufferLength: 60,
|
|
49
|
+
liveSyncDurationCount: 3,
|
|
50
|
+
liveDurationInfinity: true,
|
|
51
|
+
autoStartLoad: true,
|
|
52
|
+
enableWorker: true
|
|
53
|
+
// debug: true
|
|
54
|
+
});
|
|
55
|
+
(0, react_1.useEffect)(() => {
|
|
56
|
+
if (hls_js_1.default.isSupported() && videoRef.current) {
|
|
57
|
+
hls.loadSource(playlistUrl);
|
|
58
|
+
hls.attachMedia(videoRef.current);
|
|
59
|
+
}
|
|
60
|
+
}, []);
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)(ShortPlayerProvider, { videoRef: videoRef, hls: hls, children: (0, jsx_runtime_1.jsx)(themeProvider_1.ThemeProvider, { initialTheme: theme, children: (0, jsx_runtime_1.jsx)(video_tag_1.VideoTag, { duration: duration, videoRef: videoRef }) }) }));
|
|
62
|
+
};
|
|
63
|
+
exports.ShortPlayer = ShortPlayer;
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/component/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;;;;;;;AAEZ,oDAAyB;AACzB,iCAAiI;AAGjI,iEAA6D;AAC7D,qEAAyE;AAW5D,QAAA,aAAa,GAAG,IAA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M,EAAmB,IAAI,CAAC,CAAA;IAE/C,MAAM,GAAG,GAAG,IAAI,gBAAG,CAAC,EAAC,UAAU,EAAE,CAAC,CAAC;QACjC,eAAe,EAAE,CAAC;QAClB,cAAc,EAAE,KAAK;QACrB,kBAAkB,EAAE,EAAE;QACtB,qBAAqB,EAAE,CAAC;QACxB,oBAAoB,EAAE,IAAI;QAC1B,aAAa,EAAE,IAAI;QACnB,YAAY,EAAE,IAAI;QAClB,cAAc;KACf,CAAC,CAAA;IAEF,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,gBAAG,CAAC,WAAW,EAAE,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;YACxC,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;YAC3B,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QACrC,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,CACL,uBAAC,mBAAmB,IAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,YAC/C,uBAAC,6BAAa,IAAC,YAAY,EAAE,KAAc,YACzC,uBAAC,oBAAQ,IAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAG,GACrC,GACI,CACvB,CAAC;AACJ,CAAC,CAAA;AA7BY,QAAA,WAAW,eA6BvB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
export declare const PlayBtn: ({ videoRef }: {
|
|
3
|
-
videoRef: RefObject<HTMLVideoElement | null>;
|
|
4
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export declare const PlayBtn: ({ videoRef }: {
|
|
3
|
+
videoRef: RefObject<HTMLVideoElement | null>;
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PlayBtn = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const component_1 = require("../../../component");
|
|
9
|
+
const ui_1 = require("../../../shared/ui");
|
|
10
|
+
const styles_module_scss_1 = __importDefault(require("./styles.module.scss"));
|
|
11
|
+
const PlayBtn = ({ videoRef }) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const context = (0, component_1.usePlayerContext)();
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.playBtnWrap, children: (0, jsx_runtime_1.jsx)("button", { className: styles_module_scss_1.default.playBtn, onClick: (e) => {
|
|
15
|
+
e.stopPropagation();
|
|
16
|
+
context.setIsPaused((prev) => !prev);
|
|
17
|
+
}, children: ((_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused) ?
|
|
18
|
+
(0, jsx_runtime_1.jsx)(ui_1.Svg, { name: "play" })
|
|
19
|
+
:
|
|
20
|
+
(0, jsx_runtime_1.jsx)(ui_1.Svg, { name: "stop" }) }) }));
|
|
21
|
+
};
|
|
22
|
+
exports.PlayBtn = PlayBtn;
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/entites/PlayBtn/ui/index.tsx"],"names":[],"mappings":";;;;;;;AAAA,kDAAqD;AACrD,2CAAwC;AAExC,8EAAyC;AAElC,MAAM,OAAO,GAAG,CAAC,EAAC,QAAQ,EAAkD,EAAE,EAAE;;IACnF,MAAM,OAAO,GAAG,IAAA,4BAAgB,GAAE,CAAA;IAElC,OAAO,CACH,gCAAK,SAAS,EAAE,4BAAM,CAAC,WAAW,YAC9B,mCACI,SAAS,EAAE,4BAAM,CAAC,OAAO,EACzB,OAAO,EAAE,CAAC,CAAmB,EAAE,EAAE;gBAC7B,CAAC,CAAC,eAAe,EAAE,CAAC;gBACpB,OAAO,CAAC,WAAW,CAAC,CAAC,IAAa,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAA;YACjD,CAAC,YAEA,CAAA,MAAA,QAAQ,CAAC,OAAO,0CAAE,MAAM,EAAC,CAAC;gBACnB,uBAAC,QAAG,IAAC,IAAI,EAAC,MAAM,GAAG;gBACvB,CAAC;oBACG,uBAAC,QAAG,IAAC,IAAI,EAAC,MAAM,GAAE,GAErB,GACP,CACT,CAAA;AACL,CAAC,CAAA;AApBY,QAAA,OAAO,WAoBnB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ProgressBar } from './ui';
|
|
1
|
+
export { ProgressBar } from './ui';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProgressBar = void 0;
|
|
4
|
+
var ui_1 = require("./ui");
|
|
5
|
+
Object.defineProperty(exports, "ProgressBar", { enumerable: true, get: function () { return ui_1.ProgressBar; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/entites/ProgressBar/index.ts"],"names":[],"mappings":";;;AAAA,2BAAkC;AAAzB,iGAAA,WAAW,OAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Dispatch, JSX, RefObject, SetStateAction } from "react";
|
|
2
|
-
export declare const handleMouseOver: (e: React.MouseEvent, isDragging: boolean, duration: number, progressContainerRef: RefObject<HTMLDivElement | null>, setHoverTime: (newHoverTime: number) => void) => void;
|
|
3
|
-
export declare const handleClick: (e: React.MouseEvent, isDragging: boolean, duration: number, progressContainerRef: RefObject<HTMLDivElement | null>, videoRef: RefObject<HTMLMediaElement>, setCurrentVideoTime: (newCurrentVideoTime: number) => void, setIsDragging: (isDragging: boolean) => void) => void;
|
|
4
|
-
export declare const handleMouseDown: (e: React.MouseEvent, setIsDragging: Dispatch<SetStateAction<boolean>>) => void;
|
|
5
|
-
export declare const handleMouseUpWrapper: (e: React.MouseEvent, duration: number, progressContainerRef: RefObject<HTMLDivElement | null>, videoRef: RefObject<HTMLMediaElement>, setCurrentVideoTime: (newCurrentVideoTime: number) => void, setIsDragging: (isDragging: boolean) => void, setHoverTime: (newHoverTime: number) => void) => void;
|
|
6
|
-
export interface ProgressBarFragmentProps {
|
|
7
|
-
duration: number;
|
|
8
|
-
currentVideoTime: number;
|
|
9
|
-
}
|
|
10
|
-
export declare const getProgressBarFragments: ({ duration, currentVideoTime, }: ProgressBarFragmentProps) => JSX.Element[];
|
|
1
|
+
import { Dispatch, JSX, RefObject, SetStateAction } from "react";
|
|
2
|
+
export declare const handleMouseOver: (e: React.MouseEvent, isDragging: boolean, duration: number, progressContainerRef: RefObject<HTMLDivElement | null>, setHoverTime: (newHoverTime: number) => void) => void;
|
|
3
|
+
export declare const handleClick: (e: React.MouseEvent, isDragging: boolean, duration: number, progressContainerRef: RefObject<HTMLDivElement | null>, videoRef: RefObject<HTMLMediaElement>, setCurrentVideoTime: (newCurrentVideoTime: number) => void, setIsDragging: (isDragging: boolean) => void) => void;
|
|
4
|
+
export declare const handleMouseDown: (e: React.MouseEvent, setIsDragging: Dispatch<SetStateAction<boolean>>) => void;
|
|
5
|
+
export declare const handleMouseUpWrapper: (e: React.MouseEvent, duration: number, progressContainerRef: RefObject<HTMLDivElement | null>, videoRef: RefObject<HTMLMediaElement>, setCurrentVideoTime: (newCurrentVideoTime: number) => void, setIsDragging: (isDragging: boolean) => void, setHoverTime: (newHoverTime: number) => void) => void;
|
|
6
|
+
export interface ProgressBarFragmentProps {
|
|
7
|
+
duration: number;
|
|
8
|
+
currentVideoTime: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const getProgressBarFragments: ({ duration, currentVideoTime, }: ProgressBarFragmentProps) => JSX.Element[];
|
|
11
11
|
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getProgressBarFragments = exports.handleMouseUpWrapper = exports.handleMouseDown = exports.handleClick = exports.handleMouseOver = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const styles_module_scss_1 = __importDefault(require("../ui/styles.module.scss"));
|
|
9
|
+
// Упрощенные хендлеры для мыши
|
|
10
|
+
const handleMouseOver = (e, isDragging, duration, progressContainerRef, setHoverTime) => {
|
|
11
|
+
if (!isDragging && progressContainerRef.current && duration) {
|
|
12
|
+
const rect = progressContainerRef.current.getBoundingClientRect();
|
|
13
|
+
const clickPosition = Math.min(Math.max(e.clientX - rect.left, 0), rect.width);
|
|
14
|
+
const newTime = (clickPosition / rect.width) * duration;
|
|
15
|
+
setHoverTime(newTime);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
exports.handleMouseOver = handleMouseOver;
|
|
19
|
+
const handleClick = (e, isDragging, duration, progressContainerRef, videoRef, setCurrentVideoTime, setIsDragging) => {
|
|
20
|
+
if (!isDragging && progressContainerRef.current && duration) {
|
|
21
|
+
console.log('handleClick');
|
|
22
|
+
const rect = progressContainerRef.current.getBoundingClientRect();
|
|
23
|
+
const clickPosition = Math.min(Math.max(e.clientX - rect.left, 0), rect.width);
|
|
24
|
+
const newTime = (clickPosition / rect.width) * duration;
|
|
25
|
+
videoRef.current.currentTime = newTime;
|
|
26
|
+
setCurrentVideoTime(newTime);
|
|
27
|
+
setIsDragging(false);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.handleClick = handleClick;
|
|
31
|
+
const handleMouseDown = (e, setIsDragging) => {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
console.log('handleMouseDown');
|
|
34
|
+
setIsDragging(true);
|
|
35
|
+
};
|
|
36
|
+
exports.handleMouseDown = handleMouseDown;
|
|
37
|
+
const handleMouseUpWrapper = (e, duration, progressContainerRef, videoRef, setCurrentVideoTime, setIsDragging, setHoverTime) => {
|
|
38
|
+
console.log('handleMouseUpWrapper222s');
|
|
39
|
+
if (!progressContainerRef.current || !videoRef.current || !duration)
|
|
40
|
+
return;
|
|
41
|
+
const rect = progressContainerRef.current.getBoundingClientRect();
|
|
42
|
+
const clickPosition = Math.min(Math.max(e.clientX - rect.left, 0), rect.width);
|
|
43
|
+
const clickPercentage = (clickPosition / rect.width);
|
|
44
|
+
const newTime = clickPercentage * duration;
|
|
45
|
+
// Финальное обновление
|
|
46
|
+
videoRef.current.currentTime = newTime;
|
|
47
|
+
setCurrentVideoTime(newTime);
|
|
48
|
+
setHoverTime(0);
|
|
49
|
+
setIsDragging(false);
|
|
50
|
+
// Восстанавливаем таймер обновления
|
|
51
|
+
};
|
|
52
|
+
exports.handleMouseUpWrapper = handleMouseUpWrapper;
|
|
53
|
+
const getProgressBarFragments = ({ duration, currentVideoTime, }) => {
|
|
54
|
+
const elements = [];
|
|
55
|
+
// Общая логика прогресса и буфера
|
|
56
|
+
const getGradientStops = (start, end, progress) => {
|
|
57
|
+
const gradientStops = [];
|
|
58
|
+
const progressPercent = progress >= end
|
|
59
|
+
? 100
|
|
60
|
+
: progress > start
|
|
61
|
+
? ((progress - start) / (end - start)) * 100
|
|
62
|
+
: 0;
|
|
63
|
+
if (progressPercent > 0) {
|
|
64
|
+
gradientStops.push("#1e90ff 0%");
|
|
65
|
+
gradientStops.push(`#1e90ff ${progressPercent}%`);
|
|
66
|
+
gradientStops.push(`#444 ${progressPercent}%`);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
gradientStops.push("#444 0%");
|
|
70
|
+
}
|
|
71
|
+
const bufferStops = [];
|
|
72
|
+
bufferStops.forEach(buffer => {
|
|
73
|
+
gradientStops.push(`#666 ${buffer.start}%`);
|
|
74
|
+
gradientStops.push(`#666 ${buffer.end}%`);
|
|
75
|
+
});
|
|
76
|
+
const lastValue = gradientStops.length > 0
|
|
77
|
+
? parseFloat(gradientStops[gradientStops.length - 1].split(" ")[1].replace("%", ""))
|
|
78
|
+
: 0;
|
|
79
|
+
if (lastValue < 100) {
|
|
80
|
+
gradientStops.push(`#444 ${Math.max(lastValue, progressPercent)}%`);
|
|
81
|
+
gradientStops.push(`#444 100%`);
|
|
82
|
+
}
|
|
83
|
+
return gradientStops;
|
|
84
|
+
};
|
|
85
|
+
// Если нет фрагментов — одна сплошная полоса
|
|
86
|
+
if (duration) {
|
|
87
|
+
const gradientStops = getGradientStops(0, duration || 100, currentVideoTime);
|
|
88
|
+
const gradient = `linear-gradient(to right, ${gradientStops.join(", ")})`;
|
|
89
|
+
elements.push((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.fragment, style: {
|
|
90
|
+
left: "0%",
|
|
91
|
+
width: "100%",
|
|
92
|
+
background: gradient,
|
|
93
|
+
} }, "single-fragment"));
|
|
94
|
+
return elements;
|
|
95
|
+
}
|
|
96
|
+
return elements;
|
|
97
|
+
};
|
|
98
|
+
exports.getProgressBarFragments = getProgressBarFragments;
|
|
99
|
+
//# sourceMappingURL=handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../../../src/entites/ProgressBar/lib/handlers.tsx"],"names":[],"mappings":";;;;;;;AACA,kFAA6C;AAEzC,+BAA+B;AAC5B,MAAM,eAAe,GAAG,CAAC,CAAmB,EAAE,UAAmB,EAAE,QAAgB,EAAE,oBAAsD,EAAE,YAA4C,EAAE,EAAE;IAChM,IAAI,CAAC,UAAU,IAAI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E,CAAC;YACpB,aAAa,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC;YACpE,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAClC,CAAC;QAED,OAAO,aAAa,CAAC;IACvB,CAAC,CAAC;IAEF,6CAA6C;IAC7C,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,aAAa,GAAG,gBAAgB,CACpC,CAAC,EACD,QAAQ,IAAI,GAAG,EACf,gBAAgB,CACjB,CAAC;QAEF,MAAM,QAAQ,GAAG,6BAA6B,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;QAE1E,QAAQ,CAAC,IAAI,CACX,gCAEE,SAAS,EAAE,4BAAM,CAAC,QAAQ,EAC1B,KAAK,EAAE;gBACL,IAAI,EAAE,IAAI;gBACV,KAAK,EAAE,MAAM;gBACb,UAAU,EAAE,QAAQ;aACrB,IANG,iBAAiB,CAOrB,CACH,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC;AAzEW,QAAA,uBAAuB,2BAyElC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { RefObject } from "react";
|
|
2
|
-
interface IProgressBar {
|
|
3
|
-
duration: number;
|
|
4
|
-
videoRef: RefObject<HTMLVideoElement | null>;
|
|
5
|
-
}
|
|
6
|
-
export declare const ProgressBar: React.FC<IProgressBar>;
|
|
7
|
-
export {};
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
interface IProgressBar {
|
|
3
|
+
duration: number;
|
|
4
|
+
videoRef: RefObject<HTMLVideoElement | null>;
|
|
5
|
+
}
|
|
6
|
+
export declare const ProgressBar: React.FC<IProgressBar>;
|
|
7
|
+
export {};
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ProgressBar = void 0;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const component_1 = require("../../../component");
|
|
11
|
+
const handlers_1 = require("../lib/handlers");
|
|
12
|
+
const getHHSStime_1 = require("../../../shared/utils/getHHSStime");
|
|
13
|
+
const styles_module_scss_1 = __importDefault(require("./styles.module.scss"));
|
|
14
|
+
// interface IBufferedFragment {
|
|
15
|
+
// start: number;
|
|
16
|
+
// end: number;
|
|
17
|
+
// }
|
|
18
|
+
const ProgressBar = ({ duration, videoRef, }) => {
|
|
19
|
+
const [hoverTime, setHoverTime] = (0, react_1.useState)(0);
|
|
20
|
+
const [isDragging, setIsDragging] = (0, react_1.useState)(false);
|
|
21
|
+
const [currentVideoTime, setCurrentVideoTime] = (0, react_1.useState)(0); // Локальное состояние для времени
|
|
22
|
+
const progressContainerRef = (0, react_1.useRef)(null);
|
|
23
|
+
// const isMovingRef = useRef<HTMLDivElement>(null);
|
|
24
|
+
const animationFrameRef = (0, react_1.useRef)(0); // Ref для requestAnimationFrame
|
|
25
|
+
const context = (0, component_1.usePlayerContext)();
|
|
26
|
+
// Оптимизированный таймер для обновления времени
|
|
27
|
+
(0, react_1.useEffect)(() => {
|
|
28
|
+
const video = videoRef.current;
|
|
29
|
+
if (!video || isDragging)
|
|
30
|
+
return;
|
|
31
|
+
const updateTime = () => {
|
|
32
|
+
setCurrentVideoTime(video.currentTime);
|
|
33
|
+
animationFrameRef.current = requestAnimationFrame(updateTime);
|
|
34
|
+
};
|
|
35
|
+
// Запускаем обновление через requestAnimationFrame для плавности
|
|
36
|
+
animationFrameRef.current = requestAnimationFrame(updateTime);
|
|
37
|
+
return () => {
|
|
38
|
+
if (animationFrameRef.current) {
|
|
39
|
+
cancelAnimationFrame(animationFrameRef.current);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}, [videoRef, duration, isDragging]);
|
|
43
|
+
(0, react_1.useEffect)(() => {
|
|
44
|
+
if (!isDragging)
|
|
45
|
+
return;
|
|
46
|
+
console.log('Dragging started');
|
|
47
|
+
const handleMouseMoveWrapper = (e) => {
|
|
48
|
+
console.log('handleMouseMoveWrapper');
|
|
49
|
+
if (!progressContainerRef.current || !duration)
|
|
50
|
+
return;
|
|
51
|
+
// Ставим видео на паузу при начале перетаскивания
|
|
52
|
+
context.setIsPaused(true);
|
|
53
|
+
// Используем requestAnimationFrame для плавного обновления
|
|
54
|
+
requestAnimationFrame(() => {
|
|
55
|
+
const rect = progressContainerRef.current.getBoundingClientRect();
|
|
56
|
+
const clickPosition = Math.min(Math.max(e.clientX - rect.left, 0), rect.width);
|
|
57
|
+
const clickPercentage = (clickPosition / rect.width);
|
|
58
|
+
const newTime = clickPercentage * duration;
|
|
59
|
+
// Обновляем локальное состояние
|
|
60
|
+
setCurrentVideoTime(newTime);
|
|
61
|
+
if (videoRef.current) {
|
|
62
|
+
videoRef.current.currentTime = newTime;
|
|
63
|
+
}
|
|
64
|
+
setHoverTime(newTime);
|
|
65
|
+
const timeHoverPosition = document.getElementById('timeHover');
|
|
66
|
+
if (timeHoverPosition) {
|
|
67
|
+
timeHoverPosition.style.left = `${clickPosition}px`;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
const handleMouseUpWrapperGlobal = (e) => {
|
|
72
|
+
console.log('handleMouseUpWrapper - GLOBAL');
|
|
73
|
+
if (!progressContainerRef.current || !videoRef.current || !duration)
|
|
74
|
+
return;
|
|
75
|
+
const rect = progressContainerRef.current.getBoundingClientRect();
|
|
76
|
+
const clickPosition = Math.min(Math.max(e.clientX - rect.left, 0), rect.width);
|
|
77
|
+
const clickPercentage = (clickPosition / rect.width);
|
|
78
|
+
const newTime = clickPercentage * duration;
|
|
79
|
+
// Финальное обновление
|
|
80
|
+
videoRef.current.currentTime = newTime;
|
|
81
|
+
setCurrentVideoTime(newTime);
|
|
82
|
+
setHoverTime(0);
|
|
83
|
+
setIsDragging(false);
|
|
84
|
+
// Восстанавливаем воспроизведение (если нужно)
|
|
85
|
+
// context.setIsPaused(false); // Раскомментируйте если нужно
|
|
86
|
+
};
|
|
87
|
+
const playerContainer = document.documentElement;
|
|
88
|
+
if (!playerContainer)
|
|
89
|
+
return;
|
|
90
|
+
window.addEventListener('mousemove', handleMouseMoveWrapper);
|
|
91
|
+
window.addEventListener('mouseup', handleMouseUpWrapperGlobal);
|
|
92
|
+
return () => {
|
|
93
|
+
console.log('Cleaning up drag handlers');
|
|
94
|
+
window.removeEventListener('mousemove', handleMouseMoveWrapper);
|
|
95
|
+
window.removeEventListener('mouseup', handleMouseUpWrapperGlobal);
|
|
96
|
+
};
|
|
97
|
+
}, [isDragging, duration, videoRef, context]);
|
|
98
|
+
// Обновляем буфер
|
|
99
|
+
// useEffect(() => {
|
|
100
|
+
// if (!videoRef?.current) return;
|
|
101
|
+
// const videoElement = videoRef.current;
|
|
102
|
+
// const updateBufferedRanges = () => {
|
|
103
|
+
// const fragments: IBufferedFragment[] = [];
|
|
104
|
+
// for (let index = 0; index < videoElement.buffered.length; index++) {
|
|
105
|
+
// fragments.push({
|
|
106
|
+
// start: videoElement.buffered.start(index),
|
|
107
|
+
// end: videoElement.buffered.end(index)
|
|
108
|
+
// });
|
|
109
|
+
// }
|
|
110
|
+
// setBufferedFragments(fragments);
|
|
111
|
+
// };
|
|
112
|
+
// videoElement.addEventListener('progress', updateBufferedRanges);
|
|
113
|
+
// videoElement.addEventListener('loadeddata', updateBufferedRanges);
|
|
114
|
+
// return () => {
|
|
115
|
+
// videoElement.removeEventListener('progress', updateBufferedRanges);
|
|
116
|
+
// videoElement.removeEventListener('loadeddata', updateBufferedRanges);
|
|
117
|
+
// };
|
|
118
|
+
// }, [videoRef]);
|
|
119
|
+
// if (isLiveStream || !duration) return <div>это стрим, нужно переделать прогрес бар</div>
|
|
120
|
+
console.log('isDragging = ', isDragging);
|
|
121
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.progressBarContainer, children: [(0, jsx_runtime_1.jsx)("div", { id: 'timeHover', className: hoverTime ? styles_module_scss_1.default.progressTimeHover : styles_module_scss_1.default.progressTimeHover_hidden, style: {
|
|
122
|
+
left: `${(hoverTime / duration) * 100}%`,
|
|
123
|
+
display: hoverTime ? 'block' : 'none'
|
|
124
|
+
}, children: (0, getHHSStime_1.getHHSStime)(Math.trunc(hoverTime)) }), (0, jsx_runtime_1.jsx)("div", { id: "progressBar", ref: progressContainerRef, className: styles_module_scss_1.default.progressContainer, onClick: (e) => (0, handlers_1.handleClick)(e, isDragging, duration, progressContainerRef, videoRef, setCurrentVideoTime, setIsDragging), onMouseDown: (e) => {
|
|
125
|
+
(0, handlers_1.handleMouseDown)(e, setIsDragging);
|
|
126
|
+
},
|
|
127
|
+
// onMouseUp={(e: React.MouseEvent) => handleMouseUpWrapper(e, duration, progressContainerRef, videoRef, setCurrentVideoTime, setIsDragging, setHoverTime)}
|
|
128
|
+
onMouseLeave: () => {
|
|
129
|
+
if (!isDragging) {
|
|
130
|
+
setHoverTime(0);
|
|
131
|
+
}
|
|
132
|
+
}, onMouseMove: (e) => (0, handlers_1.handleMouseOver)(e, isDragging, duration, progressContainerRef, setHoverTime), children: (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.fragmentsContainer, children: (0, handlers_1.getProgressBarFragments)({ duration, currentVideoTime }) }) })] }));
|
|
133
|
+
};
|
|
134
|
+
exports.ProgressBar = ProgressBar;
|
|
135
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/entites/ProgressBar/ui/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;;;;;;;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AE,aAAa,CAAC,EAC1I,WAAW,EAAE,CAAC,CAAmB,EAAE,EAAE;oBACjC,IAAA,0BAAe,EAAC,CAAC,EAAE,aAAa,CAAC,CAAC;gBACtC,CAAC;gBACD,2JAA2J;gBAC3J,YAAY,EAAE,GAAG,EAAE;oBACf,IAAI,CAAC,UAAU,EAAE,CAAC;wBACd,YAAY,CAAC,CAAC,CAAC,CAAC;oBACpB,CAAC;gBACL,CAAC,EACD,WAAW,EAAE,CAAC,CAAmB,EAAE,EAAE,CAAC,IAAA,0BAAe,EAAC,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,oBAAoB,EAAE,YAAY,CAAC,YAElH,gCAAK,SAAS,EAAE,4BAAM,CAAC,kBAAkB,YACpC,IAAA,kCAAuB,EAAC,EAAC,QAAQ,EAAE,gBAAgB,EAAE,CAAC,GAErD,GACJ,IACJ,CACT,CAAC;AACN,CAAC,CAAC;AA3KW,QAAA,WAAW,eA2KtB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { SettingsButtons } from './ui';
|
|
1
|
+
export { SettingsButtons } from './ui';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SettingsButtons = void 0;
|
|
4
|
+
var ui_1 = require("./ui");
|
|
5
|
+
Object.defineProperty(exports, "SettingsButtons", { enumerable: true, get: function () { return ui_1.SettingsButtons; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/entites/SettingsButtons/index.ts"],"names":[],"mappings":";;;AAAA,2BAAsC;AAA7B,qGAAA,eAAe,OAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Dispatch, RefObject, SetStateAction } from "react";
|
|
2
|
-
import { ModalType } from "../models/settings-buttons.interface";
|
|
3
|
-
export declare const handleChangeVideoSpeed: (videoRef: RefObject<HTMLVideoElement>, value: number) => void;
|
|
4
|
-
export declare const openModal: (e: React.MouseEvent, newTitle: ModalType, setModalHistory: (newModalHistory: ModalType[] | ((prev: ModalType[]) => ModalType[])) => void, setActiveModal: (activeModal: ModalType) => void) => void;
|
|
5
|
-
export declare const closeModal: (modalHistory: ModalType[], setModalHistory: (newModalHistory: ModalType[]) => void, setActiveModal: (activeModal: ModalType) => void) => void;
|
|
6
|
-
export declare const goBack: (modalHistory: ModalType[], setModalHistory: (newModalHistory: ModalType[] | ((prev: ModalType[]) => ModalType[])) => void, setActiveModal: (activeModal: ModalType) => void) => void;
|
|
7
|
-
export declare const handleOpenFullScreen: (e: React.MouseEvent, setIsFull: Dispatch<SetStateAction<boolean>>) => void;
|
|
1
|
+
import { Dispatch, RefObject, SetStateAction } from "react";
|
|
2
|
+
import { ModalType } from "../models/settings-buttons.interface";
|
|
3
|
+
export declare const handleChangeVideoSpeed: (videoRef: RefObject<HTMLVideoElement>, value: number) => void;
|
|
4
|
+
export declare const openModal: (e: React.MouseEvent, newTitle: ModalType, setModalHistory: (newModalHistory: ModalType[] | ((prev: ModalType[]) => ModalType[])) => void, setActiveModal: (activeModal: ModalType) => void) => void;
|
|
5
|
+
export declare const closeModal: (modalHistory: ModalType[], setModalHistory: (newModalHistory: ModalType[]) => void, setActiveModal: (activeModal: ModalType) => void) => void;
|
|
6
|
+
export declare const goBack: (modalHistory: ModalType[], setModalHistory: (newModalHistory: ModalType[] | ((prev: ModalType[]) => ModalType[])) => void, setActiveModal: (activeModal: ModalType) => void) => void;
|
|
7
|
+
export declare const handleOpenFullScreen: (e: React.MouseEvent, setIsFull: Dispatch<SetStateAction<boolean>>) => void;
|
|
8
8
|
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleOpenFullScreen = exports.goBack = exports.closeModal = exports.openModal = exports.handleChangeVideoSpeed = void 0;
|
|
4
|
+
const handleChangeVideoSpeed = (videoRef, value) => {
|
|
5
|
+
if (!videoRef || !videoRef.current)
|
|
6
|
+
return;
|
|
7
|
+
videoRef.current.playbackRate = value;
|
|
8
|
+
};
|
|
9
|
+
exports.handleChangeVideoSpeed = handleChangeVideoSpeed;
|
|
10
|
+
const openModal = (e, newTitle, setModalHistory, setActiveModal) => {
|
|
11
|
+
e.stopPropagation();
|
|
12
|
+
if (newTitle) {
|
|
13
|
+
setModalHistory((prev) => [...prev, newTitle]);
|
|
14
|
+
setActiveModal(newTitle);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.openModal = openModal;
|
|
18
|
+
const closeModal = (modalHistory, setModalHistory, setActiveModal) => {
|
|
19
|
+
setModalHistory([]);
|
|
20
|
+
setActiveModal(null);
|
|
21
|
+
};
|
|
22
|
+
exports.closeModal = closeModal;
|
|
23
|
+
const goBack = (modalHistory, setModalHistory, setActiveModal) => {
|
|
24
|
+
if (modalHistory.length > 0) {
|
|
25
|
+
const previousModal = modalHistory[modalHistory.length - 2];
|
|
26
|
+
setModalHistory(prev => prev.slice(0, -1));
|
|
27
|
+
setActiveModal(previousModal);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.goBack = goBack;
|
|
31
|
+
const handleOpenFullScreen = (e, setIsFull) => {
|
|
32
|
+
e.stopPropagation();
|
|
33
|
+
const playerContainer = document.getElementById('playerContainer');
|
|
34
|
+
setIsFull((prev) => {
|
|
35
|
+
if (prev) {
|
|
36
|
+
document === null || document === void 0 ? void 0 : document.exitFullscreen();
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
playerContainer === null || playerContainer === void 0 ? void 0 : playerContainer.requestFullscreen();
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
exports.handleOpenFullScreen = handleOpenFullScreen;
|
|
46
|
+
//# sourceMappingURL=handlers.js.map
|