play-pause-yandex-triggers

add triggers to play/pause control
This commit is contained in:
gofnnp 2024-06-25 02:39:31 +04:00
parent 9f899518fd
commit 966716fd61

View File

@ -31,6 +31,12 @@ const PersonalVideo = React.memo<IPersonalVideoProps>(({ url, gender }) => {
metricService.reachGoal(EGoals.ROSE_VIDEO_PLAY_END);
};
const handlePlayPause = () => {
setIsPlaying((prev) => !prev);
if (isPlaying) metricService.reachGoal(EGoals.ROSE_VIDEO_PLAY_USER_PLAY);
if (!isPlaying) metricService.reachGoal(EGoals.ROSE_VIDEO_PLAY_USER_STOP);
};
return (
<div className={`${styles.container} ym-hide-content`}>
{!isPlaying && !isError && !isStarted && (
@ -67,7 +73,7 @@ const PersonalVideo = React.memo<IPersonalVideoProps>(({ url, gender }) => {
{!isError && isStarted && (
<PlayPauseButton
state={isPlaying ? "pause" : "play"}
onClick={() => setIsPlaying((prev) => !prev)}
onClick={handlePlayPause}
className={styles["play-pause-button"]}
/>
)}