Skip to content

Commit

Permalink
Set marquee to not autoplay, add analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
skanderm committed Sep 26, 2023
1 parent a9cfb12 commit 3a10690
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ui/src/components/Player/Player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function Player({
"id" | "slug" | "nodeName" | "name" | "latLng" | "imageUrl"
>;
}) {
const [playMarquee, setPlayMarquee] = useState(true);
const [playMarquee, setPlayMarquee] = useState(false);
const [playerStatus, setPlayerStatus] = useState<PlayerStatus>("idle");
const playerRef = useRef<VideoJSPlayer | null>(null);

Expand Down Expand Up @@ -203,12 +203,15 @@ export default function Player({
</TitlePopover>
<Box
sx={displayMobileOnly}
onClick={() => setPlayMarquee(!playMarquee)}
onClick={() => {
setPlayMarquee(!playMarquee);
analytics.stream.playerTextClicked(playerText);
}}
>
<Marquee
speed={20}
play={playerTextOverflowing && !isDesktop && playMarquee}
key={`${playerText}-${playerTextOverflowing}`}
key={`${playerText}-${playerTextOverflowing}-${playMarquee}`}
>
<Box ref={playerTextRef}>
<Typography
Expand Down
7 changes: 7 additions & 0 deletions ui/src/utils/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ const stream = {
action: "Player paused",
label: feedSlug,
}),
playerTextClicked: (playerText: string) => {
sendEvent({
category: "Stream",
action: "Player text clicked",
label: playerText,
})
}
};

function sendEvent(...eventParams: Parameters<typeof ReactGA.event>) {
Expand Down

0 comments on commit 3a10690

Please sign in to comment.