Skip to content

Commit

Permalink
Merge pull request #145 from rajnishdargan/release-1.0.0
Browse files Browse the repository at this point in the history
Issue #PS-2775  feat : V1 Player Telemetry (PS-2775) & Telemetry Service Integration (PS-2733)
  • Loading branch information
itsvick authored Dec 10, 2024
2 parents d509d49 + fdb5993 commit 1116116
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ NEXT_PUBLIC_TENANT_ID="" # Tenant Id of User
NEXT_PUBLIC_CLOUD_STORAGE_URL="" # Use environment variable for S3 Cloud Storage URL - should have / at the end.
NEXT_PUBLIC_CHANNEL_ID="" # Channel Id of knowlg-inQuiry setup
NEXT_PUBLIC_FRAMEWORK_ID="" # Framework Id of knowlg-inQuiry setup
NEXT_PUBLIC_TELEMETRY_URL="" #telemetry service path
AWS_ACCESS_KEY_ID="" # For AWS S3 large file chunks upload
AWS_ACCESS_SECRET_KEY="" # For AWS S3 large file chunks upload
AWS_BUCKET_NAME="" # For AWS S3 large file chunks upload
AWS_REGION="" # For AWS S3 large file chunks upload
AWS_REGION="" # For AWS S3 large file chunks upload
8 changes: 8 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ const nextConfig = {
source: "/action/content/:path*", // Match other /action/asset routes
destination: "/api/proxy?path=/action/content/:path*", // Forward other /action/asset requests to proxy.js
},
{
source: "/action/data/v3/telemetry",
destination: `${process.env.NEXT_PUBLIC_TELEMETRY_URL}/v1/telemetry`,
},
{
source: "/data/v3/telemetry",
destination: `${process.env.NEXT_PUBLIC_TELEMETRY_URL}/v1/telemetry`,
},
{
source: "/action/:path*", // Match any other routes starting with /action/
destination: "/api/proxy?path=/action/:path*", // Forward them to proxy.js
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"id": "org.sunbird.iframeEvent",
"ver": "1.0",
"author": "Manjunath Davanam",
"type": "widget",
"title": "eventreader",
"description": "Reading Telemetry event from the canvas",
"renderer": {
"main": "renderer/plugin.js"
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 14 additions & 3 deletions src/components/V1-Player/V1Player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ const V1Player = ({ playerConfig }: PlayerProps) => {
preview.contentWindow.addEventListener("message", (event: any) => {
console.log("V1 player event", event);
});

preview.addEventListener("renderer:telemetry:event", (event: any) => {
console.log("V1 player telemetry event ===>", event);
if (event.detail.telemetryData.eid === 'START') {
console.log("V1 player telemetry START event ===>", event);
}
if (event.detail.telemetryData.eid === 'END') {
console.log("V1 player telemetry END event ===>", event);
}
});
}, 100);
};

Expand All @@ -32,9 +42,10 @@ const V1Player = ({ playerConfig }: PlayerProps) => {
preview.removeEventListener("load", handleLoad);

// Reset iframe to prevent residual styles or memory leaks
if (preview) {
preview.src = "";
}
// Commenting below code - Content Preview is only work due to below code
// if (preview) {
// preview.src = "";
// }
};
}
}, [playerConfig]);
Expand Down
7 changes: 1 addition & 6 deletions src/components/players/PlayerConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,7 @@ export const V1PlayerConfig = {
id: "org.sunbird.iframeEvent",
ver: 1,
type: "plugin",
},
{
id: "org.sunbird.player.endpage",
ver: 1.1,
type: "plugin",
},
}
],
sideMenu: {
showShare: true,
Expand Down

0 comments on commit 1116116

Please sign in to comment.