1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.useSyncVolumeWithMediaTag = void 0;
|
4 | const react_1 = require("react");
|
5 | const is_approximately_the_same_1 = require("./is-approximately-the-same");
|
6 | const volume_prop_1 = require("./volume-prop");
|
7 | const useSyncVolumeWithMediaTag = ({ volumePropFrame, actualVolume, volume, mediaVolume, mediaRef, }) => {
|
8 | (0, react_1.useEffect)(() => {
|
9 | const userPreferredVolume = (0, volume_prop_1.evaluateVolume)({
|
10 | frame: volumePropFrame,
|
11 | volume,
|
12 | mediaVolume,
|
13 | });
|
14 | if (!(0, is_approximately_the_same_1.isApproximatelyTheSame)(userPreferredVolume, actualVolume) &&
|
15 | mediaRef.current) {
|
16 | mediaRef.current.volume = userPreferredVolume;
|
17 | }
|
18 | }, [actualVolume, volumePropFrame, mediaRef, volume, mediaVolume]);
|
19 | };
|
20 | exports.useSyncVolumeWithMediaTag = useSyncVolumeWithMediaTag;
|
21 |
|
\ | No newline at end of file |