Skip to content

Commit

Permalink
fix: simplify expression
Browse files Browse the repository at this point in the history
  • Loading branch information
KaustubhKumar05 committed Mar 18, 2024
1 parent 6762d12 commit 3063cfa
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/hms-video-store/src/common/PluginUsageTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ class PluginUsageTracker {
case 'mediaPlugin.toggled.off':
case 'mediaPlugin.stats': {
if (this.pluginLastAddedAt.has(pluginKey)) {
const duration = event.properties.duration
? event.properties.duration
: (Date.now() - (this.pluginLastAddedAt.get(pluginKey) || 0)) / 1000;
const duration =
event.properties.duration || (Date.now() - (this.pluginLastAddedAt.get(pluginKey) || 0)) / 1000;
this.pluginUsage.set(pluginKey, (this.pluginUsage.get(pluginKey) || 0) + Math.max(duration, 0) * 1000);
this.pluginLastAddedAt.delete(pluginKey);
}
Expand Down

0 comments on commit 3063cfa

Please sign in to comment.