@selfcommunity/react-ui 0.10.5-payments.225 → 0.10.5-payments.227
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.
|
@@ -6,6 +6,7 @@ const react_1 = require("react");
|
|
|
6
6
|
const react_waypoint_1 = require("react-waypoint");
|
|
7
7
|
const react_player_1 = tslib_1.__importDefault(require("react-player"));
|
|
8
8
|
const material_1 = require("@mui/material");
|
|
9
|
+
const react_core_1 = require("@selfcommunity/react-core");
|
|
9
10
|
const PREFIX = 'SCAutoPlayer';
|
|
10
11
|
const Root = (0, material_1.styled)(react_waypoint_1.Waypoint, {
|
|
11
12
|
name: PREFIX,
|
|
@@ -14,10 +15,12 @@ const Root = (0, material_1.styled)(react_waypoint_1.Waypoint, {
|
|
|
14
15
|
})(() => ({}));
|
|
15
16
|
function AutoPlayer(props) {
|
|
16
17
|
// PROPS
|
|
17
|
-
const {
|
|
18
|
+
const { loop = false, muted = true, playsinline = true, controls = true, stopOnUnmount = true, pip = true, onVideoWatch } = props, rest = tslib_1.__rest(props, ["loop", "muted", "playsinline", "controls", "stopOnUnmount", "pip", "onVideoWatch"]);
|
|
18
19
|
// STATE
|
|
19
20
|
const [shouldPlay, setShouldPlay] = (0, react_1.useState)(false);
|
|
20
21
|
const [played, setPlayed] = (0, react_1.useState)(0);
|
|
22
|
+
const { preferences } = (0, react_core_1.useSCPreferences)();
|
|
23
|
+
const enableAutoplay = react_core_1.SCPreferences.CONFIGURATIONS_VIDEO_AUTOPLAY_ENABLED in preferences && preferences[react_core_1.SCPreferences.CONFIGURATIONS_VIDEO_AUTOPLAY_ENABLED].value;
|
|
21
24
|
(0, react_1.useEffect)(() => {
|
|
22
25
|
if (played >= 10 && played <= 11) {
|
|
23
26
|
onVideoWatch === null || onVideoWatch === void 0 ? void 0 : onVideoWatch();
|
|
@@ -4,6 +4,7 @@ import { useEffect, useState } from 'react';
|
|
|
4
4
|
import { Waypoint } from 'react-waypoint';
|
|
5
5
|
import ReactPlayer from 'react-player';
|
|
6
6
|
import { styled } from '@mui/material';
|
|
7
|
+
import { SCPreferences, useSCPreferences } from '@selfcommunity/react-core';
|
|
7
8
|
const PREFIX = 'SCAutoPlayer';
|
|
8
9
|
const Root = styled(Waypoint, {
|
|
9
10
|
name: PREFIX,
|
|
@@ -12,10 +13,12 @@ const Root = styled(Waypoint, {
|
|
|
12
13
|
})(() => ({}));
|
|
13
14
|
export default function AutoPlayer(props) {
|
|
14
15
|
// PROPS
|
|
15
|
-
const {
|
|
16
|
+
const { loop = false, muted = true, playsinline = true, controls = true, stopOnUnmount = true, pip = true, onVideoWatch } = props, rest = __rest(props, ["loop", "muted", "playsinline", "controls", "stopOnUnmount", "pip", "onVideoWatch"]);
|
|
16
17
|
// STATE
|
|
17
18
|
const [shouldPlay, setShouldPlay] = useState(false);
|
|
18
19
|
const [played, setPlayed] = useState(0);
|
|
20
|
+
const { preferences } = useSCPreferences();
|
|
21
|
+
const enableAutoplay = SCPreferences.CONFIGURATIONS_VIDEO_AUTOPLAY_ENABLED in preferences && preferences[SCPreferences.CONFIGURATIONS_VIDEO_AUTOPLAY_ENABLED].value;
|
|
19
22
|
useEffect(() => {
|
|
20
23
|
if (played >= 10 && played <= 11) {
|
|
21
24
|
onVideoWatch === null || onVideoWatch === void 0 ? void 0 : onVideoWatch();
|