funuicss 3.7.7 → 3.7.9
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/css/fun.css +193 -77
- package/package.json +1 -1
- package/ui/specials/Circle.d.ts +2 -1
- package/ui/specials/Circle.js +2 -2
- package/ui/video/Video.d.ts +38 -2
- package/ui/video/Video.js +274 -160
package/css/fun.css
CHANGED
|
@@ -1412,152 +1412,268 @@ border-radius: var(--borderRadius);
|
|
|
1412
1412
|
outline-offset: 2px;
|
|
1413
1413
|
}
|
|
1414
1414
|
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
/* video */
|
|
1418
|
-
.video_player{
|
|
1415
|
+
/* Video Component Styles */
|
|
1416
|
+
.video_player {
|
|
1419
1417
|
border-radius: 1rem;
|
|
1420
1418
|
width: 100%;
|
|
1419
|
+
cursor: pointer;
|
|
1421
1420
|
}
|
|
1422
|
-
|
|
1421
|
+
|
|
1422
|
+
.video_container {
|
|
1423
1423
|
position: relative;
|
|
1424
1424
|
width: fit-content;
|
|
1425
1425
|
height: fit-content;
|
|
1426
1426
|
padding: 0;
|
|
1427
1427
|
border-radius: 1rem;
|
|
1428
1428
|
color: var(--text-color);
|
|
1429
|
+
cursor: pointer;
|
|
1430
|
+
transition: all 0.3s ease;
|
|
1429
1431
|
}
|
|
1430
|
-
|
|
1432
|
+
|
|
1433
|
+
.video_controls {
|
|
1431
1434
|
position: absolute;
|
|
1432
1435
|
bottom: 0;
|
|
1433
1436
|
left: 0;
|
|
1434
1437
|
width: 100%;
|
|
1435
|
-
|
|
1438
|
+
padding: 1.5rem 1rem 1rem;
|
|
1436
1439
|
display: flex;
|
|
1437
1440
|
flex-direction: column;
|
|
1438
1441
|
justify-content: flex-end;
|
|
1439
|
-
padding: 1rem ;
|
|
1440
|
-
display: none;
|
|
1441
|
-
|
|
1442
1442
|
border-radius: 1rem;
|
|
1443
|
+
transition: all 0.3s ease;
|
|
1444
|
+
opacity: 1;
|
|
1445
|
+
transform: translateY(0);
|
|
1443
1446
|
}
|
|
1444
1447
|
|
|
1445
|
-
.
|
|
1448
|
+
.video_controls.hide_controls {
|
|
1449
|
+
opacity: 0;
|
|
1450
|
+
transform: translateY(10px);
|
|
1451
|
+
pointer-events: none;
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
.video_controls.show_controls {
|
|
1455
|
+
opacity: 1;
|
|
1456
|
+
transform: translateY(0);
|
|
1457
|
+
pointer-events: all;
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
.video_poster {
|
|
1446
1461
|
position: absolute;
|
|
1447
1462
|
top: 0;
|
|
1448
1463
|
width: 100%;
|
|
1449
1464
|
height: 100%;
|
|
1450
1465
|
border-radius: 1rem;
|
|
1451
1466
|
background-position: center !important;
|
|
1452
|
-
background-size: cover;
|
|
1453
|
-
background-repeat: no-repeat;
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
display: flex ;
|
|
1467
|
+
background-size: cover !important;
|
|
1468
|
+
background-repeat: no-repeat !important;
|
|
1469
|
+
cursor: pointer;
|
|
1470
|
+
z-index: 1;
|
|
1457
1471
|
}
|
|
1458
1472
|
|
|
1459
|
-
|
|
1460
|
-
|
|
1473
|
+
/* Beautiful Progress Bar */
|
|
1474
|
+
.progress-container {
|
|
1475
|
+
width: 100%;
|
|
1476
|
+
padding: 0 0.5rem;
|
|
1461
1477
|
}
|
|
1462
1478
|
|
|
1463
|
-
.
|
|
1464
|
-
|
|
1479
|
+
.progress-wrapper {
|
|
1480
|
+
position: relative;
|
|
1481
|
+
width: 100%;
|
|
1465
1482
|
}
|
|
1466
1483
|
|
|
1467
|
-
.
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1484
|
+
.video-progress {
|
|
1485
|
+
-webkit-appearance: none;
|
|
1486
|
+
appearance: none;
|
|
1487
|
+
width: 100%;
|
|
1488
|
+
padding: 0 !important;
|
|
1489
|
+
height: 5px !important;
|
|
1490
|
+
border-radius: 10px;
|
|
1491
|
+
background: linear-gradient(
|
|
1492
|
+
to right,
|
|
1493
|
+
var(--primary) 0%,
|
|
1494
|
+
var(--primary) var(--progress-percent),
|
|
1495
|
+
rgba(255, 255, 255, 0.3) var(--progress-percent),
|
|
1496
|
+
rgba(255, 255, 255, 0.3) 100%
|
|
1497
|
+
);
|
|
1498
|
+
outline: none;
|
|
1499
|
+
cursor: pointer;
|
|
1500
|
+
transition: all 0.3s ease;
|
|
1501
|
+
position: relative;
|
|
1471
1502
|
}
|
|
1472
1503
|
|
|
1504
|
+
.video-progress:hover {
|
|
1505
|
+
height: 8px;
|
|
1506
|
+
}
|
|
1473
1507
|
|
|
1474
|
-
.
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1508
|
+
.video-progress::-webkit-slider-thumb {
|
|
1509
|
+
-webkit-appearance: none;
|
|
1510
|
+
appearance: none;
|
|
1511
|
+
/* opacity: 0 !important; */
|
|
1512
|
+
width: 16px;
|
|
1513
|
+
height: 16px;
|
|
1514
|
+
border-radius: 50%;
|
|
1515
|
+
background: var(--primary);
|
|
1516
|
+
cursor: pointer;
|
|
1517
|
+
border: 2px solid white;
|
|
1518
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
|
1519
|
+
transition: all 0.2s ease;
|
|
1520
|
+
opacity: 0;
|
|
1480
1521
|
}
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
padding: 1rem;
|
|
1486
|
-
line-height: 0;
|
|
1487
|
-
color: var(--text-color);
|
|
1522
|
+
|
|
1523
|
+
.video-progress:hover::-webkit-slider-thumb {
|
|
1524
|
+
opacity: 1;
|
|
1525
|
+
transform: scale(1.1);
|
|
1488
1526
|
}
|
|
1489
|
-
|
|
1490
1527
|
|
|
1528
|
+
.video-progress::-moz-range-thumb {
|
|
1529
|
+
width: 16px;
|
|
1530
|
+
height: 16px;
|
|
1531
|
+
border-radius: 50%;
|
|
1532
|
+
background: var(--primary);
|
|
1533
|
+
cursor: pointer;
|
|
1534
|
+
border: 2px solid white;
|
|
1535
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
|
1536
|
+
transition: all 0.2s ease;
|
|
1537
|
+
opacity: 0;
|
|
1538
|
+
}
|
|
1491
1539
|
|
|
1540
|
+
.video-progress:hover::-moz-range-thumb {
|
|
1541
|
+
opacity: 1;
|
|
1542
|
+
transform: scale(1.1);
|
|
1543
|
+
}
|
|
1492
1544
|
|
|
1493
|
-
._play-button {
|
|
1494
|
-
display: flex;
|
|
1495
|
-
align-items: center;
|
|
1496
|
-
justify-content: center;
|
|
1497
|
-
width: 5rem;
|
|
1498
|
-
height: 5rem;
|
|
1499
|
-
border-radius: 50%;
|
|
1500
|
-
background-color: var(--raiseOpaque);
|
|
1501
|
-
backdrop-filter: var(--raiseBackdrop) !important;
|
|
1502
|
-
transition: transform 0.3s ease;
|
|
1503
|
-
cursor: pointer;
|
|
1504
|
-
line-height: 0 !important;
|
|
1505
|
-
z-index: 2;
|
|
1506
1545
|
|
|
1507
|
-
}
|
|
1508
1546
|
|
|
1509
|
-
._play-button:hover {
|
|
1510
|
-
background-color: var(--primary) !important;
|
|
1511
|
-
color: var(--white) !important;
|
|
1512
|
-
border-color: var(--primary400);
|
|
1513
|
-
color: var(--text-color);
|
|
1514
|
-
}
|
|
1515
1547
|
|
|
1548
|
+
/* Beautiful Volume Control */
|
|
1549
|
+
.volume-control-wrapper {
|
|
1550
|
+
display: flex;
|
|
1551
|
+
align-items: center;
|
|
1552
|
+
gap: 8px;
|
|
1553
|
+
position: relative;
|
|
1554
|
+
}
|
|
1516
1555
|
|
|
1556
|
+
.volume-slider-wrapper {
|
|
1557
|
+
width: 80px;
|
|
1558
|
+
padding: 8px 0;
|
|
1559
|
+
}
|
|
1517
1560
|
|
|
1518
|
-
.
|
|
1561
|
+
.volume-slider {
|
|
1562
|
+
-webkit-appearance: none;
|
|
1519
1563
|
appearance: none;
|
|
1520
1564
|
width: 100%;
|
|
1521
|
-
height:
|
|
1565
|
+
height: 15px !important;
|
|
1566
|
+
padding: 0 !important;
|
|
1567
|
+
border-radius: 10px;
|
|
1522
1568
|
background: linear-gradient(
|
|
1523
1569
|
to right,
|
|
1524
1570
|
var(--primary) 0%,
|
|
1525
|
-
var(--primary)
|
|
1526
|
-
|
|
1527
|
-
|
|
1571
|
+
var(--primary) var(--volume-percent),
|
|
1572
|
+
rgba(255, 255, 255, 0.3) var(--volume-percent),
|
|
1573
|
+
rgba(255, 255, 255, 0.3) 100%
|
|
1528
1574
|
);
|
|
1529
|
-
border-radius: 3px;
|
|
1530
1575
|
outline: none;
|
|
1531
|
-
|
|
1532
|
-
|
|
1576
|
+
cursor: pointer;
|
|
1577
|
+
transition: all 0.3s ease;
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
.volume-slider:hover {
|
|
1581
|
+
height: 6px;
|
|
1533
1582
|
}
|
|
1534
1583
|
|
|
1535
|
-
|
|
1536
|
-
|
|
1584
|
+
.volume-slider::-webkit-slider-thumb {
|
|
1585
|
+
-webkit-appearance: none;
|
|
1537
1586
|
appearance: none;
|
|
1538
|
-
height: 14px;
|
|
1539
1587
|
width: 14px;
|
|
1588
|
+
opacity: 0 !important;
|
|
1589
|
+
height: 14px;
|
|
1540
1590
|
border-radius: 50%;
|
|
1541
1591
|
background: var(--primary);
|
|
1542
|
-
border: none;
|
|
1543
1592
|
cursor: pointer;
|
|
1544
|
-
|
|
1545
|
-
transition:
|
|
1546
|
-
margin-top: -4px;
|
|
1593
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
|
|
1594
|
+
transition: all 0.2s ease;
|
|
1547
1595
|
}
|
|
1548
1596
|
|
|
1597
|
+
.volume-slider:hover::-webkit-slider-thumb {
|
|
1598
|
+
opacity: 1;
|
|
1599
|
+
transform: scale(1.1);
|
|
1600
|
+
}
|
|
1549
1601
|
|
|
1550
|
-
.
|
|
1551
|
-
height: 14px;
|
|
1602
|
+
.volume-slider::-moz-range-thumb {
|
|
1552
1603
|
width: 14px;
|
|
1604
|
+
height: 14px;
|
|
1553
1605
|
border-radius: 50%;
|
|
1554
1606
|
background: var(--primary);
|
|
1555
|
-
border: none;
|
|
1556
1607
|
cursor: pointer;
|
|
1608
|
+
border: 2px solid white;
|
|
1609
|
+
transition: all 0.2s ease;
|
|
1557
1610
|
opacity: 0;
|
|
1558
|
-
transition: opacity 0.3s ease;
|
|
1559
1611
|
}
|
|
1560
1612
|
|
|
1613
|
+
.volume-slider:hover::-moz-range-thumb {
|
|
1614
|
+
opacity: 1;
|
|
1615
|
+
transform: scale(1.1);
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
/* Time display */
|
|
1619
|
+
.video_time {
|
|
1620
|
+
background-color: var(--raiseThemes);
|
|
1621
|
+
backdrop-filter: var(--raiseBackdrop);
|
|
1622
|
+
border-radius: 1rem;
|
|
1623
|
+
padding: 0.5rem 1rem;
|
|
1624
|
+
line-height: 1;
|
|
1625
|
+
font-size: 0.875rem;
|
|
1626
|
+
font-weight: 500;
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
/* Control buttons hover effects */
|
|
1630
|
+
.video_container .circle {
|
|
1631
|
+
transition: all 0.2s ease;
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1634
|
+
.video_container .circle:hover {
|
|
1635
|
+
background-color: var(--primary) !important;
|
|
1636
|
+
color: var(--white) !important;
|
|
1637
|
+
transform: scale(1.1);
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
/* Responsive design */
|
|
1641
|
+
@media (max-width: 768px) {
|
|
1642
|
+
.video_controls {
|
|
1643
|
+
padding: 1rem 0.5rem 0.5rem;
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
.video_time {
|
|
1647
|
+
padding: 0.25rem 0.75rem;
|
|
1648
|
+
font-size: 0.75rem;
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
.controls-row {
|
|
1652
|
+
gap: 0.5rem !important;
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
.volume-slider-wrapper {
|
|
1656
|
+
width: 60px;
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
/* Fullscreen adjustments */
|
|
1661
|
+
.video_container:fullscreen {
|
|
1662
|
+
width: 100vw;
|
|
1663
|
+
height: 100vh;
|
|
1664
|
+
border-radius: 0;
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
.video_container:fullscreen .video_player {
|
|
1668
|
+
border-radius: 0;
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
.video_container:fullscreen .video_controls {
|
|
1672
|
+
border-radius: 0;
|
|
1673
|
+
padding: 2rem 1.5rem 1rem;
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
|
|
1561
1677
|
|
|
1562
1678
|
|
|
1563
1679
|
/* Mobile layout when menu is open */
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.7.
|
|
2
|
+
"version": "3.7.9",
|
|
3
3
|
"name": "funuicss",
|
|
4
4
|
"description": "React and Next.js component UI Library for creating Easy and good looking websites with fewer lines of code. Elevate your web development experience with our cutting-edge React/Next.js component UI Library. Craft stunning websites effortlessly, boasting both seamless functionality and aesthetic appeal—all achieved with minimal lines of code. Unleash the power of simplicity and style in your projects!",
|
|
5
5
|
"main": "index.js",
|
package/ui/specials/Circle.d.ts
CHANGED
|
@@ -7,11 +7,12 @@ interface Circle_Props extends HTMLProps<HTMLDivElement> {
|
|
|
7
7
|
color?: string;
|
|
8
8
|
children?: ReactNode;
|
|
9
9
|
hoverable?: boolean;
|
|
10
|
+
className?: string;
|
|
10
11
|
raised?: boolean;
|
|
11
12
|
bordered?: boolean;
|
|
12
13
|
key?: React.Key;
|
|
13
14
|
style?: React.CSSProperties;
|
|
14
15
|
onClick?: () => void;
|
|
15
16
|
}
|
|
16
|
-
export default function Circle({ size, funcss, bg, color, children, hoverable, raised, key, onClick, bordered, style, ...rest }: Circle_Props): React.JSX.Element;
|
|
17
|
+
export default function Circle({ size, funcss, bg, color, children, hoverable, raised, key, onClick, className, bordered, style, ...rest }: Circle_Props): React.JSX.Element;
|
|
17
18
|
export {};
|
package/ui/specials/Circle.js
CHANGED
|
@@ -59,7 +59,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
59
59
|
exports.default = Circle;
|
|
60
60
|
var React = __importStar(require("react"));
|
|
61
61
|
function Circle(_a) {
|
|
62
|
-
var _b = _a.size, size = _b === void 0 ? 2 : _b, funcss = _a.funcss, bg = _a.bg, color = _a.color, children = _a.children, hoverable = _a.hoverable, raised = _a.raised, key = _a.key, onClick = _a.onClick, bordered = _a.bordered, style = _a.style, rest = __rest(_a, ["size", "funcss", "bg", "color", "children", "hoverable", "raised", "key", "onClick", "bordered", "style"]);
|
|
63
|
-
return (React.createElement("div", __assign({ className: " animated fade-in ".concat(bordered ? "border" : "", " pointer avatar ").concat(funcss || '', " ").concat("text-" + (color === null || color === void 0 ? void 0 : color.trim()) || '', " ").concat(raised ? "raised" : '', " ").concat(bg || 'lighter', " ").concat(hoverable ? 'hoverable' : ''), style: __assign({ width: "".concat(size + "rem" || '2.3rem'), height: "".concat(size + "rem" || '2.3rem') }, style), key: key, onClick: onClick }, rest),
|
|
62
|
+
var _b = _a.size, size = _b === void 0 ? 2 : _b, funcss = _a.funcss, bg = _a.bg, color = _a.color, children = _a.children, hoverable = _a.hoverable, raised = _a.raised, key = _a.key, onClick = _a.onClick, _c = _a.className, className = _c === void 0 ? '' : _c, bordered = _a.bordered, style = _a.style, rest = __rest(_a, ["size", "funcss", "bg", "color", "children", "hoverable", "raised", "key", "onClick", "className", "bordered", "style"]);
|
|
63
|
+
return (React.createElement("div", __assign({ className: " ".concat(className, " animated fade-in ").concat(bordered ? "border" : "", " pointer avatar ").concat(funcss || '', " ").concat("text-" + (color === null || color === void 0 ? void 0 : color.trim()) || '', " ").concat(raised ? "raised" : '', " ").concat(bg || 'lighter', " ").concat(hoverable ? 'hoverable' : ''), style: __assign({ width: "".concat(size + "rem" || '2.3rem'), height: "".concat(size + "rem" || '2.3rem') }, style), key: key, onClick: onClick }, rest),
|
|
64
64
|
React.createElement(React.Fragment, null, children)));
|
|
65
65
|
}
|
package/ui/video/Video.d.ts
CHANGED
|
@@ -1,12 +1,48 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
interface VideoProps {
|
|
3
3
|
src: string;
|
|
4
4
|
poster?: string;
|
|
5
5
|
onDuration?: (duration: number) => void;
|
|
6
|
+
onEnded?: () => void;
|
|
6
7
|
isPause?: boolean;
|
|
7
8
|
spacebarPlay?: boolean;
|
|
8
9
|
className?: string;
|
|
9
10
|
autoPlay?: boolean;
|
|
11
|
+
showControls?: boolean;
|
|
12
|
+
showPlayPause?: boolean;
|
|
13
|
+
showProgress?: boolean;
|
|
14
|
+
showVolume?: boolean;
|
|
15
|
+
showTime?: boolean;
|
|
16
|
+
showFullscreen?: boolean;
|
|
17
|
+
showDownload?: boolean;
|
|
18
|
+
showSeekButtons?: boolean;
|
|
19
|
+
playIcon?: string | ReactNode;
|
|
20
|
+
pauseIcon?: string | ReactNode;
|
|
21
|
+
fullscreenIcon?: string | ReactNode;
|
|
22
|
+
downloadIcon?: string | ReactNode;
|
|
23
|
+
volumeIcon?: string | ReactNode;
|
|
24
|
+
muteIcon?: string | ReactNode;
|
|
25
|
+
rewindIcon?: string | ReactNode;
|
|
26
|
+
forwardIcon?: string | ReactNode;
|
|
27
|
+
hideControlsDelay?: number;
|
|
28
|
+
loop?: boolean;
|
|
29
|
+
muted?: boolean;
|
|
30
|
+
seekAmount?: number;
|
|
31
|
+
funcss?: string;
|
|
32
|
+
containerCss?: string;
|
|
33
|
+
videoCss?: string;
|
|
34
|
+
controlsCss?: string;
|
|
35
|
+
progressCss?: string;
|
|
36
|
+
progressBarCss?: string;
|
|
37
|
+
timeCss?: string;
|
|
38
|
+
playCss?: string;
|
|
39
|
+
pauseCss?: string;
|
|
40
|
+
volumeCss?: string;
|
|
41
|
+
fullscreenCss?: string;
|
|
42
|
+
downloadCss?: string;
|
|
43
|
+
rewindCss?: string;
|
|
44
|
+
forwardCss?: string;
|
|
45
|
+
buttonCss?: string;
|
|
10
46
|
}
|
|
11
|
-
export default function Video({ src, poster, onDuration, isPause, className, autoPlay,
|
|
47
|
+
export default function Video({ src, poster, onDuration, onEnded, isPause, spacebarPlay, className, autoPlay, showControls, showPlayPause, showProgress, showVolume, showTime, showFullscreen, showDownload, showSeekButtons, playIcon, pauseIcon, fullscreenIcon, downloadIcon, volumeIcon, muteIcon, rewindIcon, forwardIcon, hideControlsDelay, loop, muted, seekAmount, funcss, containerCss, videoCss, controlsCss, progressCss, progressBarCss, timeCss, playCss, pauseCss, volumeCss, fullscreenCss, downloadCss, rewindCss, forwardCss, buttonCss, }: VideoProps): React.JSX.Element;
|
|
12
48
|
export {};
|
package/ui/video/Video.js
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
|
-
var __assign = (this && this.__assign) || function () {
|
|
4
|
-
__assign = Object.assign || function(t) {
|
|
5
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
-
s = arguments[i];
|
|
7
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
-
t[p] = s[p];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
return __assign.apply(this, arguments);
|
|
13
|
-
};
|
|
14
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
4
|
if (k2 === undefined) k2 = k;
|
|
16
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -44,16 +33,41 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
44
33
|
return result;
|
|
45
34
|
};
|
|
46
35
|
})();
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
46
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
47
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
|
+
function step(op) {
|
|
50
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
51
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
52
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
53
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
54
|
+
switch (op[0]) {
|
|
55
|
+
case 0: case 1: t = op; break;
|
|
56
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
57
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
58
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
59
|
+
default:
|
|
60
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
61
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
62
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
63
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
64
|
+
if (t[2]) _.ops.pop();
|
|
65
|
+
_.trys.pop(); continue;
|
|
66
|
+
}
|
|
67
|
+
op = body.call(thisArg, _);
|
|
68
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
69
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70
|
+
}
|
|
57
71
|
};
|
|
58
72
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
59
73
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -62,51 +76,114 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
62
76
|
exports.default = Video;
|
|
63
77
|
var react_1 = __importStar(require("react"));
|
|
64
78
|
var pi_1 = require("react-icons/pi");
|
|
79
|
+
var tfi_1 = require("react-icons/tfi");
|
|
65
80
|
var Text_1 = __importDefault(require("../text/Text"));
|
|
66
81
|
var RowFlex_1 = __importDefault(require("../specials/RowFlex"));
|
|
67
82
|
var ToolTip_1 = __importDefault(require("../tooltip/ToolTip"));
|
|
68
83
|
var Circle_1 = __importDefault(require("../specials/Circle"));
|
|
69
84
|
var Tip_1 = __importDefault(require("../tooltip/Tip"));
|
|
70
|
-
var tfi_1 = require("react-icons/tfi");
|
|
71
85
|
var videoFunctions_1 = require("./videoFunctions");
|
|
72
86
|
var videoShortcuts_1 = require("./videoShortcuts");
|
|
87
|
+
var getDynamicIcon_1 = require("../../utils/getDynamicIcon");
|
|
73
88
|
function Video(_a) {
|
|
74
|
-
var
|
|
89
|
+
var _this = this;
|
|
90
|
+
var src = _a.src, poster = _a.poster, onDuration = _a.onDuration, onEnded = _a.onEnded, isPause = _a.isPause, _b = _a.spacebarPlay, spacebarPlay = _b === void 0 ? true : _b, _c = _a.className, className = _c === void 0 ? '' : _c, _d = _a.autoPlay, autoPlay = _d === void 0 ? false : _d, _e = _a.showControls, showControls = _e === void 0 ? true : _e, _f = _a.showPlayPause, showPlayPause = _f === void 0 ? true : _f, _g = _a.showProgress, showProgress = _g === void 0 ? true : _g, _h = _a.showVolume, showVolume = _h === void 0 ? true : _h, _j = _a.showTime, showTime = _j === void 0 ? true : _j, _k = _a.showFullscreen, showFullscreen = _k === void 0 ? true : _k, _l = _a.showDownload, showDownload = _l === void 0 ? true : _l, _m = _a.showSeekButtons, showSeekButtons = _m === void 0 ? true : _m, playIcon = _a.playIcon, pauseIcon = _a.pauseIcon, fullscreenIcon = _a.fullscreenIcon, downloadIcon = _a.downloadIcon, volumeIcon = _a.volumeIcon, muteIcon = _a.muteIcon, rewindIcon = _a.rewindIcon, forwardIcon = _a.forwardIcon, _o = _a.hideControlsDelay, hideControlsDelay = _o === void 0 ? 3000 : _o, _p = _a.loop, loop = _p === void 0 ? false : _p, _q = _a.muted, muted = _q === void 0 ? false : _q, _r = _a.seekAmount, seekAmount = _r === void 0 ? 10 : _r, _s = _a.funcss, funcss = _s === void 0 ? '' : _s, _t = _a.containerCss, containerCss = _t === void 0 ? '' : _t, _u = _a.videoCss, videoCss = _u === void 0 ? '' : _u, _v = _a.controlsCss, controlsCss = _v === void 0 ? '' : _v, _w = _a.progressCss, progressCss = _w === void 0 ? '' : _w, _x = _a.progressBarCss, progressBarCss = _x === void 0 ? '' : _x, _y = _a.timeCss, timeCss = _y === void 0 ? '' : _y, _z = _a.playCss, playCss = _z === void 0 ? '' : _z, _0 = _a.pauseCss, pauseCss = _0 === void 0 ? '' : _0, _1 = _a.volumeCss, volumeCss = _1 === void 0 ? '' : _1, _2 = _a.fullscreenCss, fullscreenCss = _2 === void 0 ? '' : _2, _3 = _a.downloadCss, downloadCss = _3 === void 0 ? '' : _3, _4 = _a.rewindCss, rewindCss = _4 === void 0 ? '' : _4, _5 = _a.forwardCss, forwardCss = _5 === void 0 ? '' : _5, _6 = _a.buttonCss, buttonCss = _6 === void 0 ? '' : _6;
|
|
75
91
|
var videoRef = (0, react_1.useRef)(null);
|
|
76
92
|
var containerRef = (0, react_1.useRef)(null);
|
|
77
93
|
var animationFrameRef = (0, react_1.useRef)(null);
|
|
78
|
-
var
|
|
79
|
-
var
|
|
80
|
-
var
|
|
81
|
-
var
|
|
82
|
-
var
|
|
83
|
-
var
|
|
84
|
-
var
|
|
85
|
-
var
|
|
86
|
-
var
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
94
|
+
var _7 = (0, react_1.useState)(false), isPlaying = _7[0], setIsPlaying = _7[1];
|
|
95
|
+
var _8 = (0, react_1.useState)(0), currentTime = _8[0], setCurrentTime = _8[1];
|
|
96
|
+
var _9 = (0, react_1.useState)(0), duration = _9[0], setDuration = _9[1];
|
|
97
|
+
var _10 = (0, react_1.useState)(muted ? 0 : 1), volume = _10[0], setVolume = _10[1];
|
|
98
|
+
var _11 = (0, react_1.useState)(muted), isMuted = _11[0], setIsMuted = _11[1];
|
|
99
|
+
var _12 = (0, react_1.useState)(false), isFullScreen = _12[0], setIsFullScreen = _12[1];
|
|
100
|
+
var _13 = (0, react_1.useState)(false), showControlsState = _13[0], setShowControlsState = _13[1];
|
|
101
|
+
var _14 = (0, react_1.useState)(false), hasStarted = _14[0], setHasStarted = _14[1];
|
|
102
|
+
var _15 = (0, react_1.useState)(false), isHoveringProgress = _15[0], setIsHoveringProgress = _15[1];
|
|
103
|
+
var _16 = (0, react_1.useState)(false), isHoveringVolume = _16[0], setIsHoveringVolume = _16[1];
|
|
104
|
+
// Dynamic icon states
|
|
105
|
+
var _17 = (0, react_1.useState)(null), dynamicPlayIcon = _17[0], setDynamicPlayIcon = _17[1];
|
|
106
|
+
var _18 = (0, react_1.useState)(null), dynamicPauseIcon = _18[0], setDynamicPauseIcon = _18[1];
|
|
107
|
+
var _19 = (0, react_1.useState)(null), dynamicFullscreenIcon = _19[0], setDynamicFullscreenIcon = _19[1];
|
|
108
|
+
var _20 = (0, react_1.useState)(null), dynamicDownloadIcon = _20[0], setDynamicDownloadIcon = _20[1];
|
|
109
|
+
var _21 = (0, react_1.useState)(null), dynamicVolumeIcon = _21[0], setDynamicVolumeIcon = _21[1];
|
|
110
|
+
var _22 = (0, react_1.useState)(null), dynamicMuteIcon = _22[0], setDynamicMuteIcon = _22[1];
|
|
111
|
+
var _23 = (0, react_1.useState)(null), dynamicRewindIcon = _23[0], setDynamicRewindIcon = _23[1];
|
|
112
|
+
var _24 = (0, react_1.useState)(null), dynamicForwardIcon = _24[0], setDynamicForwardIcon = _24[1];
|
|
113
|
+
// Helper function to load dynamic icons
|
|
114
|
+
var loadDynamicIcon = function (iconProp, setter, defaultIcon) { return __awaiter(_this, void 0, void 0, function () {
|
|
115
|
+
var iconNode;
|
|
116
|
+
return __generator(this, function (_a) {
|
|
117
|
+
switch (_a.label) {
|
|
118
|
+
case 0:
|
|
119
|
+
if (!iconProp) {
|
|
120
|
+
setter(defaultIcon);
|
|
121
|
+
return [2 /*return*/];
|
|
122
|
+
}
|
|
123
|
+
if (!(typeof iconProp === 'string')) return [3 /*break*/, 2];
|
|
124
|
+
return [4 /*yield*/, (0, getDynamicIcon_1.getDynamicIcon)(iconProp)];
|
|
125
|
+
case 1:
|
|
126
|
+
iconNode = _a.sent();
|
|
127
|
+
setter(iconNode || defaultIcon);
|
|
128
|
+
return [3 /*break*/, 3];
|
|
129
|
+
case 2:
|
|
130
|
+
// It's already a ReactNode - use it directly
|
|
131
|
+
setter(iconProp);
|
|
132
|
+
_a.label = 3;
|
|
133
|
+
case 3: return [2 /*return*/];
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}); };
|
|
137
|
+
// Load all dynamic icons on component mount and when icon props change
|
|
90
138
|
(0, react_1.useEffect)(function () {
|
|
91
|
-
var
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
139
|
+
var loadIcons = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
140
|
+
return __generator(this, function (_a) {
|
|
141
|
+
switch (_a.label) {
|
|
142
|
+
case 0: return [4 /*yield*/, Promise.all([
|
|
143
|
+
loadDynamicIcon(playIcon, setDynamicPlayIcon, react_1.default.createElement(pi_1.PiPlay, { size: 16 })),
|
|
144
|
+
loadDynamicIcon(pauseIcon, setDynamicPauseIcon, react_1.default.createElement(pi_1.PiPause, { size: 16 })),
|
|
145
|
+
loadDynamicIcon(fullscreenIcon, setDynamicFullscreenIcon, react_1.default.createElement(pi_1.PiCornersOut, { size: 16 })),
|
|
146
|
+
loadDynamicIcon(downloadIcon, setDynamicDownloadIcon, react_1.default.createElement(tfi_1.TfiDownload, { size: 14 })),
|
|
147
|
+
loadDynamicIcon(volumeIcon, setDynamicVolumeIcon, react_1.default.createElement(pi_1.PiSpeakerHigh, { size: 16 })),
|
|
148
|
+
loadDynamicIcon(muteIcon, setDynamicMuteIcon, react_1.default.createElement(pi_1.PiSpeakerSlash, { size: 16 })),
|
|
149
|
+
loadDynamicIcon(rewindIcon, setDynamicRewindIcon, react_1.default.createElement(tfi_1.TfiControlBackward, { size: 14 })),
|
|
150
|
+
loadDynamicIcon(forwardIcon, setDynamicForwardIcon, react_1.default.createElement(tfi_1.TfiControlForward, { size: 14 })),
|
|
151
|
+
])];
|
|
152
|
+
case 1:
|
|
153
|
+
_a.sent();
|
|
154
|
+
return [2 /*return*/];
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}); };
|
|
158
|
+
loadIcons();
|
|
159
|
+
}, [
|
|
160
|
+
playIcon, pauseIcon, fullscreenIcon, downloadIcon,
|
|
161
|
+
volumeIcon, muteIcon, rewindIcon, forwardIcon
|
|
162
|
+
]);
|
|
163
|
+
// Helper function to render icon with proper size
|
|
164
|
+
var renderIcon = function (icon, defaultSize) {
|
|
165
|
+
if (defaultSize === void 0) { defaultSize = 16; }
|
|
166
|
+
if (!icon)
|
|
167
|
+
return null;
|
|
168
|
+
// If it's a React element, clone it with the size prop
|
|
169
|
+
if (react_1.default.isValidElement(icon)) {
|
|
170
|
+
return react_1.default.cloneElement(icon, {
|
|
171
|
+
size: icon.props.size || defaultSize
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
return icon;
|
|
175
|
+
};
|
|
176
|
+
// Play/Pause functionality
|
|
99
177
|
var playVideo = function () {
|
|
100
178
|
var video = videoRef.current;
|
|
101
179
|
if (video) {
|
|
102
|
-
// ✅ if video ended, reset it to start
|
|
103
180
|
if (video.currentTime === video.duration) {
|
|
104
181
|
video.currentTime = 0;
|
|
105
182
|
}
|
|
106
183
|
video.play().then(function () {
|
|
107
184
|
setIsPlaying(true);
|
|
108
185
|
setHasStarted(true);
|
|
109
|
-
}).catch(
|
|
186
|
+
}).catch(console.error);
|
|
110
187
|
}
|
|
111
188
|
};
|
|
112
189
|
var pauseVideo = function () {
|
|
@@ -116,24 +193,43 @@ function Video(_a) {
|
|
|
116
193
|
setIsPlaying(false);
|
|
117
194
|
}
|
|
118
195
|
};
|
|
119
|
-
(0, react_1.useEffect)(function () {
|
|
120
|
-
var handleKey = function (e) { return (0, videoShortcuts_1.handleKeyDown)(e, isPlaying, playVideo, pauseVideo, spacebarPlay); };
|
|
121
|
-
document.addEventListener('keydown', handleKey);
|
|
122
|
-
return function () { return document.removeEventListener('keydown', handleKey); };
|
|
123
|
-
}, [isPlaying]);
|
|
124
196
|
var handlePlayPauseToggle = function () {
|
|
125
197
|
isPlaying ? pauseVideo() : playVideo();
|
|
126
198
|
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
199
|
+
// Click handlers for different video areas
|
|
200
|
+
var handleVideoClick = function (e) {
|
|
201
|
+
var container = containerRef.current;
|
|
202
|
+
if (!container)
|
|
203
|
+
return;
|
|
204
|
+
var rect = container.getBoundingClientRect();
|
|
205
|
+
var clickX = e.clientX - rect.left;
|
|
206
|
+
var width = rect.width;
|
|
207
|
+
// Divide video into three areas
|
|
208
|
+
var leftArea = width * 0.3;
|
|
209
|
+
var rightArea = width * 0.7;
|
|
210
|
+
if (clickX < leftArea) {
|
|
211
|
+
// Left area - rewind
|
|
212
|
+
handleSeek(-seekAmount);
|
|
213
|
+
}
|
|
214
|
+
else if (clickX > rightArea) {
|
|
215
|
+
// Right area - forward
|
|
216
|
+
handleSeek(seekAmount);
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
// Middle area - play/pause
|
|
220
|
+
handlePlayPauseToggle();
|
|
221
|
+
}
|
|
131
222
|
};
|
|
132
|
-
|
|
223
|
+
// Seek functionality
|
|
224
|
+
var handleSeek = function (seconds) {
|
|
133
225
|
var video = videoRef.current;
|
|
134
|
-
if (video)
|
|
135
|
-
video.currentTime = Math.min(video.currentTime +
|
|
226
|
+
if (video) {
|
|
227
|
+
video.currentTime = Math.max(0, Math.min(video.currentTime + seconds, duration));
|
|
228
|
+
}
|
|
136
229
|
};
|
|
230
|
+
var handleRewind = function () { return handleSeek(-seekAmount); };
|
|
231
|
+
var handleForward = function () { return handleSeek(seekAmount); };
|
|
232
|
+
// Fullscreen functionality
|
|
137
233
|
var handleToggleFullScreen = function () {
|
|
138
234
|
var _a, _b;
|
|
139
235
|
var element = containerRef.current;
|
|
@@ -146,6 +242,40 @@ function Video(_a) {
|
|
|
146
242
|
(_b = document.exitFullscreen) === null || _b === void 0 ? void 0 : _b.call(document);
|
|
147
243
|
}
|
|
148
244
|
};
|
|
245
|
+
// Volume functionality
|
|
246
|
+
var handleVolumeChange = function (e) {
|
|
247
|
+
var newVolume = parseFloat(e.target.value);
|
|
248
|
+
setVolume(newVolume);
|
|
249
|
+
setIsMuted(newVolume === 0);
|
|
250
|
+
if (videoRef.current) {
|
|
251
|
+
videoRef.current.volume = newVolume;
|
|
252
|
+
videoRef.current.muted = newVolume === 0;
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
var handleToggleMute = function () {
|
|
256
|
+
var newMuted = !isMuted;
|
|
257
|
+
setIsMuted(newMuted);
|
|
258
|
+
if (videoRef.current) {
|
|
259
|
+
videoRef.current.muted = newMuted;
|
|
260
|
+
if (newMuted) {
|
|
261
|
+
setVolume(0);
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
setVolume(1);
|
|
265
|
+
if (videoRef.current)
|
|
266
|
+
videoRef.current.volume = 1;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
// Progress functionality
|
|
271
|
+
var handleProgressChange = function (e) {
|
|
272
|
+
var newTime = parseFloat(e.target.value);
|
|
273
|
+
if (videoRef.current) {
|
|
274
|
+
videoRef.current.currentTime = newTime;
|
|
275
|
+
}
|
|
276
|
+
setCurrentTime(newTime);
|
|
277
|
+
};
|
|
278
|
+
// Time update animation
|
|
149
279
|
var updateCurrentTime = (0, react_1.useCallback)(function () {
|
|
150
280
|
var video = videoRef.current;
|
|
151
281
|
if (video) {
|
|
@@ -153,59 +283,44 @@ function Video(_a) {
|
|
|
153
283
|
animationFrameRef.current = requestAnimationFrame(updateCurrentTime);
|
|
154
284
|
}
|
|
155
285
|
}, []);
|
|
286
|
+
// Event handlers
|
|
156
287
|
var handleLoadedMetadata = function () {
|
|
157
288
|
var video = videoRef.current;
|
|
158
289
|
if (video) {
|
|
159
290
|
setDuration(video.duration || 0);
|
|
160
291
|
onDuration === null || onDuration === void 0 ? void 0 : onDuration(video.duration);
|
|
161
292
|
if (autoPlay) {
|
|
293
|
+
video.muted = true;
|
|
162
294
|
video.play().then(function () {
|
|
163
|
-
setIsPlaying(true);
|
|
295
|
+
setIsPlaying(true);
|
|
164
296
|
setHasStarted(true);
|
|
165
|
-
}).catch(
|
|
297
|
+
}).catch(console.error);
|
|
166
298
|
}
|
|
167
299
|
}
|
|
168
300
|
};
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}).catch(function (err) {
|
|
176
|
-
console.warn('Autoplay failed', err);
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
}, [autoPlay]);
|
|
180
|
-
var handleProgressBarChange = function (e) {
|
|
181
|
-
var newTime = parseFloat(e.target.value);
|
|
182
|
-
if (videoRef.current) {
|
|
183
|
-
videoRef.current.currentTime = newTime;
|
|
184
|
-
}
|
|
185
|
-
setCurrentTime(newTime);
|
|
186
|
-
};
|
|
187
|
-
var handleVolumeChange = function (e) {
|
|
188
|
-
if (videoRef.current) {
|
|
189
|
-
videoRef.current.muted = false;
|
|
301
|
+
var handleVideoEnd = function () {
|
|
302
|
+
setIsPlaying(false);
|
|
303
|
+
onEnded === null || onEnded === void 0 ? void 0 : onEnded(); // Call the onEnded callback
|
|
304
|
+
if (loop && videoRef.current) {
|
|
305
|
+
videoRef.current.currentTime = 0;
|
|
306
|
+
playVideo();
|
|
190
307
|
}
|
|
191
|
-
var newVolume = parseFloat(e.target.value);
|
|
192
|
-
setVolume(newVolume);
|
|
193
|
-
if (videoRef.current)
|
|
194
|
-
videoRef.current.volume = newVolume;
|
|
195
308
|
};
|
|
309
|
+
// Effects
|
|
196
310
|
(0, react_1.useEffect)(function () {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}, [autoPlay]);
|
|
311
|
+
var handleKey = function (e) {
|
|
312
|
+
return (0, videoShortcuts_1.handleKeyDown)(e, isPlaying, playVideo, pauseVideo, spacebarPlay);
|
|
313
|
+
};
|
|
314
|
+
document.addEventListener('keydown', handleKey);
|
|
315
|
+
return function () { return document.removeEventListener('keydown', handleKey); };
|
|
316
|
+
}, [isPlaying, spacebarPlay]);
|
|
204
317
|
(0, react_1.useEffect)(function () {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
318
|
+
var video = videoRef.current;
|
|
319
|
+
if (!video)
|
|
320
|
+
return;
|
|
321
|
+
video.addEventListener('ended', handleVideoEnd);
|
|
322
|
+
return function () { return video.removeEventListener('ended', handleVideoEnd); };
|
|
323
|
+
}, [loop, onEnded]);
|
|
209
324
|
(0, react_1.useEffect)(function () {
|
|
210
325
|
if (isPause)
|
|
211
326
|
pauseVideo();
|
|
@@ -217,24 +332,32 @@ function Video(_a) {
|
|
|
217
332
|
document.addEventListener('fullscreenchange', handleFullscreenChange);
|
|
218
333
|
return function () { return document.removeEventListener('fullscreenchange', handleFullscreenChange); };
|
|
219
334
|
}, []);
|
|
335
|
+
// Controls visibility with hover
|
|
220
336
|
(0, react_1.useEffect)(function () {
|
|
221
337
|
var timer;
|
|
222
|
-
var
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
338
|
+
var show = function () {
|
|
339
|
+
setShowControlsState(true);
|
|
340
|
+
clearTimeout(timer);
|
|
341
|
+
timer = setTimeout(function () { return setShowControlsState(false); }, hideControlsDelay);
|
|
342
|
+
};
|
|
343
|
+
var hide = function () {
|
|
344
|
+
setShowControlsState(false);
|
|
229
345
|
};
|
|
230
|
-
|
|
231
|
-
|
|
346
|
+
var container = containerRef.current;
|
|
347
|
+
if (container && showControls) {
|
|
348
|
+
container.addEventListener('mouseenter', show);
|
|
349
|
+
container.addEventListener('mouseleave', hide);
|
|
350
|
+
container.addEventListener('mousemove', show);
|
|
351
|
+
}
|
|
232
352
|
return function () {
|
|
233
|
-
|
|
234
|
-
|
|
353
|
+
if (container) {
|
|
354
|
+
container.removeEventListener('mouseenter', show);
|
|
355
|
+
container.removeEventListener('mouseleave', hide);
|
|
356
|
+
container.removeEventListener('mousemove', show);
|
|
357
|
+
}
|
|
235
358
|
clearTimeout(timer);
|
|
236
359
|
};
|
|
237
|
-
}, []);
|
|
360
|
+
}, [showControls, hideControlsDelay]);
|
|
238
361
|
(0, react_1.useEffect)(function () {
|
|
239
362
|
if (isPlaying) {
|
|
240
363
|
animationFrameRef.current = requestAnimationFrame(updateCurrentTime);
|
|
@@ -247,59 +370,50 @@ function Video(_a) {
|
|
|
247
370
|
cancelAnimationFrame(animationFrameRef.current);
|
|
248
371
|
};
|
|
249
372
|
}, [isPlaying, updateCurrentTime]);
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
373
|
+
// Beautiful Progress Bar Component
|
|
374
|
+
var ProgressBar = function () { return (react_1.default.createElement("div", { className: "progress-container mb-4" },
|
|
375
|
+
react_1.default.createElement("div", { className: "progress-wrapper" },
|
|
376
|
+
react_1.default.createElement("input", { type: "range", min: 0, max: duration, value: currentTime, onChange: handleProgressChange, className: "video-progress ".concat(progressCss), style: {
|
|
377
|
+
'--progress-percent': "".concat((currentTime / duration) * 100, "%"),
|
|
378
|
+
}, onMouseEnter: function () { return setIsHoveringProgress(true); }, onMouseLeave: function () { return setIsHoveringProgress(false); } })))); };
|
|
379
|
+
// Beautiful Volume Control Component
|
|
380
|
+
var VolumeControl = function () { return (react_1.default.createElement("div", { className: "volume-control-wrapper" },
|
|
381
|
+
react_1.default.createElement(ToolTip_1.default, null,
|
|
382
|
+
react_1.default.createElement(Circle_1.default, { bordered: true, size: 2.5, onClick: handleToggleMute, className: "volume-toggle ".concat(buttonCss, " ").concat(volumeCss) }, isMuted || volume === 0
|
|
383
|
+
? renderIcon(dynamicMuteIcon, 16)
|
|
384
|
+
: renderIcon(dynamicVolumeIcon, 16)),
|
|
385
|
+
react_1.default.createElement(Tip_1.default, { tip: "top", content: isMuted ? "Unmute" : "Mute" })),
|
|
386
|
+
react_1.default.createElement("div", { className: "volume-slider-wrapper", onMouseEnter: function () { return setIsHoveringVolume(true); }, onMouseLeave: function () { return setIsHoveringVolume(false); } },
|
|
387
|
+
react_1.default.createElement("input", { type: "range", min: 0, max: 1, step: 0.01, value: volume, onChange: handleVolumeChange, className: "volume-slider", style: {
|
|
388
|
+
'--volume-percent': "".concat(volume * 100, "%"),
|
|
389
|
+
} })))); };
|
|
390
|
+
return (react_1.default.createElement("div", { ref: containerRef, className: "video_container fit ".concat(funcss, " ").concat(containerCss, " ").concat(className), onClick: handleVideoClick },
|
|
266
391
|
poster && !hasStarted && !isPlaying && (react_1.default.createElement("div", { style: { backgroundImage: "url(".concat(poster, ")") }, className: "video_poster" })),
|
|
267
|
-
react_1.default.createElement("video",
|
|
268
|
-
react_1.default.createElement("div", { className: "video_controls ".concat(
|
|
269
|
-
react_1.default.createElement(
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
react_1.default.createElement(
|
|
278
|
-
react_1.default.createElement(
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
react_1.default.createElement(
|
|
287
|
-
react_1.default.createElement("div", { onMouseEnter: function () { return setShowVolume(true); }, onMouseLeave: function () { return setShowVolume(false); } },
|
|
288
|
-
react_1.default.createElement(RowFlex_1.default, null,
|
|
289
|
-
react_1.default.createElement(Circle_1.default, { bordered: true, size: 2.5 },
|
|
290
|
-
react_1.default.createElement(tfi_1.TfiVolume, null)),
|
|
291
|
-
showVolume && (react_1.default.createElement("input", { type: "range", min: 0, max: 1, step: 0.01, value: volume, onChange: handleVolumeChange, className: "width-100 max-w-50 animated slide-right", style: { height: '3px', marginLeft: 8 }, "aria-label": "Volume" })))),
|
|
292
|
-
react_1.default.createElement("div", { className: 'video_time' },
|
|
293
|
-
react_1.default.createElement(Text_1.default, { text: (0, videoFunctions_1.formatTime)(currentTime), funcss: 'm-0', size: "sm" }),
|
|
294
|
-
"/",
|
|
295
|
-
react_1.default.createElement(Text_1.default, { text: "".concat((0, videoFunctions_1.formatTime)(duration - currentTime)), funcss: 'm-0', size: "sm" }))),
|
|
392
|
+
react_1.default.createElement("video", { ref: videoRef, preload: "auto", src: src, className: "video_player fit min-w-200 ".concat(videoCss), onLoadedMetadata: handleLoadedMetadata, playsInline: true, controls: false, loop: loop, muted: muted }),
|
|
393
|
+
showControls && (react_1.default.createElement("div", { className: "video_controls ".concat(controlsCss, " ").concat(showControlsState ? 'show_controls' : 'hide_controls') },
|
|
394
|
+
showProgress && react_1.default.createElement(ProgressBar, null),
|
|
395
|
+
react_1.default.createElement(RowFlex_1.default, { gap: 1, justify: "space-between", alignItems: "center", className: "controls-row" },
|
|
396
|
+
react_1.default.createElement(RowFlex_1.default, { gap: 0.5, alignItems: "center" },
|
|
397
|
+
showPlayPause && (react_1.default.createElement(ToolTip_1.default, null,
|
|
398
|
+
react_1.default.createElement(Circle_1.default, { bordered: true, size: 2.5, onClick: handlePlayPauseToggle, className: "".concat(buttonCss, " ").concat(isPlaying ? pauseCss : playCss) }, isPlaying
|
|
399
|
+
? renderIcon(dynamicPauseIcon, 16)
|
|
400
|
+
: renderIcon(dynamicPlayIcon, 16)),
|
|
401
|
+
react_1.default.createElement(Tip_1.default, { tip: "top", content: isPlaying ? "Pause" : "Play" }))),
|
|
402
|
+
showSeekButtons && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
403
|
+
react_1.default.createElement(ToolTip_1.default, null,
|
|
404
|
+
react_1.default.createElement(Circle_1.default, { bordered: true, size: 2.5, onClick: handleRewind, className: "".concat(buttonCss, " ").concat(rewindCss) }, renderIcon(dynamicRewindIcon, 14)),
|
|
405
|
+
react_1.default.createElement(Tip_1.default, { tip: "top", content: "".concat(seekAmount, "s Back") })),
|
|
406
|
+
react_1.default.createElement(ToolTip_1.default, null,
|
|
407
|
+
react_1.default.createElement(Circle_1.default, { bordered: true, size: 2.5, onClick: handleForward, className: "".concat(buttonCss, " ").concat(forwardCss) }, renderIcon(dynamicForwardIcon, 14)),
|
|
408
|
+
react_1.default.createElement(Tip_1.default, { tip: "top", content: "".concat(seekAmount, "s Forward") })))),
|
|
409
|
+
showVolume && react_1.default.createElement(VolumeControl, null),
|
|
410
|
+
showTime && (react_1.default.createElement("div", { className: "video_time ".concat(timeCss) },
|
|
411
|
+
react_1.default.createElement(Text_1.default, { text: "".concat((0, videoFunctions_1.formatTime)(currentTime), " / ").concat((0, videoFunctions_1.formatTime)(duration)), funcss: 'm-0', size: "sm" })))),
|
|
296
412
|
react_1.default.createElement(RowFlex_1.default, { gap: 0.3 },
|
|
297
|
-
react_1.default.createElement(ToolTip_1.default, null,
|
|
298
|
-
react_1.default.createElement(Circle_1.default, { bordered: true, size: 2.5, onClick: handleToggleFullScreen },
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
react_1.default.createElement(
|
|
303
|
-
react_1.default.createElement(tfi_1.TfiDownload, null)),
|
|
304
|
-
react_1.default.createElement(Tip_1.default, { tip: "left", animation: "ScaleUp", duration: 0.5, content: "Download" })))))));
|
|
413
|
+
showFullscreen && (react_1.default.createElement(ToolTip_1.default, null,
|
|
414
|
+
react_1.default.createElement(Circle_1.default, { bordered: true, size: 2.5, onClick: handleToggleFullScreen, className: "".concat(buttonCss, " ").concat(fullscreenCss) }, renderIcon(dynamicFullscreenIcon, 16)),
|
|
415
|
+
react_1.default.createElement(Tip_1.default, { tip: "top", content: "Fullscreen" }))),
|
|
416
|
+
showDownload && (react_1.default.createElement(ToolTip_1.default, null,
|
|
417
|
+
react_1.default.createElement(Circle_1.default, { bordered: true, size: 2.5, onClick: function () { return window.open(src, '_blank'); }, className: "".concat(buttonCss, " ").concat(downloadCss) }, renderIcon(dynamicDownloadIcon, 14)),
|
|
418
|
+
react_1.default.createElement(Tip_1.default, { tip: "top", content: "Download" })))))))));
|
|
305
419
|
}
|