add individual video page events
This commit is contained in:
parent
abd0a03cd0
commit
d6f2be85d2
1 changed files with 26 additions and 0 deletions
|
|
@ -11,11 +11,13 @@ import { ShareModal } from "~/components/ShareModal";
|
||||||
import { useSession } from "next-auth/react";
|
import { useSession } from "next-auth/react";
|
||||||
import VideoMoreMenu from "~/components/VideoMoreMenu";
|
import VideoMoreMenu from "~/components/VideoMoreMenu";
|
||||||
import ProfileMenu from "~/components/ProfileMenu";
|
import ProfileMenu from "~/components/ProfileMenu";
|
||||||
|
import { usePostHog } from "posthog-js/react";
|
||||||
|
|
||||||
const VideoList: NextPage = () => {
|
const VideoList: NextPage = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { status, data: session } = useSession();
|
const { status, data: session } = useSession();
|
||||||
const { videoId } = router.query as { videoId: string };
|
const { videoId } = router.query as { videoId: string };
|
||||||
|
const posthog = usePostHog();
|
||||||
|
|
||||||
const { data: video, isLoading } = api.video.get.useQuery(
|
const { data: video, isLoading } = api.video.get.useQuery(
|
||||||
{ videoId },
|
{ videoId },
|
||||||
|
|
@ -78,6 +80,30 @@ const VideoList: NextPage = () => {
|
||||||
width="100%"
|
width="100%"
|
||||||
height="100%"
|
height="100%"
|
||||||
controls={true}
|
controls={true}
|
||||||
|
onPlay={() =>
|
||||||
|
posthog?.capture("play video", {
|
||||||
|
videoId: video.id,
|
||||||
|
videoCreatedAt: video.createdAt,
|
||||||
|
videoUpdatedAt: video.updatedAt,
|
||||||
|
videoUser: video.user.id,
|
||||||
|
videoSharing: video.sharing,
|
||||||
|
videoDeleteAfterLinkExpires:
|
||||||
|
video.delete_after_link_expires,
|
||||||
|
videoShareLinkExpiresAt: video.shareLinkExpiresAt,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
onPause={() =>
|
||||||
|
posthog?.capture("pause video", {
|
||||||
|
videoId: video.id,
|
||||||
|
videoCreatedAt: video.createdAt,
|
||||||
|
videoUpdatedAt: video.updatedAt,
|
||||||
|
videoUser: video.user.id,
|
||||||
|
videoSharing: video.sharing,
|
||||||
|
videoDeleteAfterLinkExpires:
|
||||||
|
video.delete_after_link_expires,
|
||||||
|
videoShareLinkExpiresAt: video.shareLinkExpiresAt,
|
||||||
|
})
|
||||||
|
}
|
||||||
url={video.video_url}
|
url={video.video_url}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue