From 1a793bba982798bd53126570ae19f88fecaad3a9 Mon Sep 17 00:00:00 2001 From: suvarnakale Date: Thu, 12 Dec 2024 17:55:12 +0530 Subject: [PATCH] Issue #PS-2753 feat : Implemention of telemetry for V1 player --- src/components/V1-Player/V1Player.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/V1-Player/V1Player.tsx b/src/components/V1-Player/V1Player.tsx index a8107cb..a27da05 100644 --- a/src/components/V1-Player/V1Player.tsx +++ b/src/components/V1-Player/V1Player.tsx @@ -1,3 +1,4 @@ +import { getTelemetryEvents } from "@/utils/Helper"; import React, { useRef, useEffect } from "react"; interface PlayerProps { @@ -17,7 +18,10 @@ const V1Player = ({ playerConfig }: PlayerProps) => { const handleLoad = () => { setTimeout(() => { - if (preview.contentWindow && preview.contentWindow.initializePreview) { + if ( + preview.contentWindow && + preview.contentWindow.initializePreview + ) { preview.contentWindow.initializePreview(playerConfig); } preview.contentWindow.addEventListener("message", (event: any) => { @@ -26,12 +30,13 @@ const V1Player = ({ playerConfig }: PlayerProps) => { preview.addEventListener("renderer:telemetry:event", (event: any) => { console.log("V1 player telemetry event ===>", event); - if (event.detail.telemetryData.eid === 'START') { + if (event.detail.telemetryData.eid === "START") { console.log("V1 player telemetry START event ===>", event); } - if (event.detail.telemetryData.eid === 'END') { + if (event.detail.telemetryData.eid === "END") { console.log("V1 player telemetry END event ===>", event); } + getTelemetryEvents(event.detail.telemetryData, "v1"); }); }, 100); };