@patch-adams/core 1.4.13 → 1.4.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -2947,9 +2947,28 @@ function generateLrsBridgeCode(options) {
2947
2947
  };
2948
2948
  }
2949
2949
 
2950
+ /**
2951
+ * Format seconds into MM:SS or HH:MM:SS format
2952
+ */
2953
+ function formatMediaTime(seconds) {
2954
+ if (typeof seconds !== 'number' || isNaN(seconds)) return '0:00';
2955
+ var totalSeconds = Math.floor(seconds);
2956
+ var hours = Math.floor(totalSeconds / 3600);
2957
+ var minutes = Math.floor((totalSeconds % 3600) / 60);
2958
+ var secs = totalSeconds % 60;
2959
+
2960
+ if (hours > 0) {
2961
+ return hours + ':' + (minutes < 10 ? '0' : '') + minutes + ':' + (secs < 10 ? '0' : '') + secs;
2962
+ }
2963
+ return minutes + ':' + (secs < 10 ? '0' : '') + secs;
2964
+ }
2965
+
2950
2966
  /**
2951
2967
  * Build activity object for media (video/audio) with human-readable name
2952
- * Name format: "Video: Title" or "Audio: Title"
2968
+ * Name format varies by action:
2969
+ * - played: "Video: Title (started at 1:23)"
2970
+ * - paused: "Video: Title (paused at 2:45)"
2971
+ * - completed: "Video: Title (completed)"
2953
2972
  */
2954
2973
  function buildMediaActivityObject(mediaInfo) {
2955
2974
  var mediaGuid = mediaInfo.mediaGuid || generateUUID();
@@ -2957,11 +2976,22 @@ function generateLrsBridgeCode(options) {
2957
2976
  var resourceType = mediaInfo.type === 'audio' ? 'Audio' : 'Video';
2958
2977
 
2959
2978
  // Build human-readable display name
2960
- var displayName = mediaInfo.name || '';
2961
- if (!displayName || displayName === 'video' || displayName === 'audio' || displayName === 'Media') {
2962
- displayName = resourceType + ': ' + (mediaInfo.lessonName || 'Media');
2963
- } else {
2964
- displayName = resourceType + ': ' + displayName;
2979
+ var baseName = mediaInfo.name || '';
2980
+ if (!baseName || baseName === 'video' || baseName === 'audio' || baseName === 'Media') {
2981
+ baseName = mediaInfo.lessonName || 'Media';
2982
+ }
2983
+
2984
+ // Add time context based on action
2985
+ var displayName = resourceType + ': ' + baseName;
2986
+ var currentTime = mediaInfo.currentTime || 0;
2987
+ var action = mediaInfo.action;
2988
+
2989
+ if (action === 'play' || action === 'played') {
2990
+ displayName += ' (started at ' + formatMediaTime(currentTime) + ')';
2991
+ } else if (action === 'pause' || action === 'paused') {
2992
+ displayName += ' (paused at ' + formatMediaTime(currentTime) + ')';
2993
+ } else if (action === 'completed' || action === 'complete') {
2994
+ displayName += ' (completed)';
2965
2995
  }
2966
2996
 
2967
2997
  return {
@@ -3286,14 +3316,16 @@ function generateLrsBridgeCode(options) {
3286
3316
  data.action === 'pause' ? 'paused' :
3287
3317
  data.action === 'completed' ? 'completed' : 'played';
3288
3318
 
3289
- // Build activity-specific object with human-readable name
3290
- // e.g., "Video: Introduction" or "Audio: Podcast Episode 1"
3319
+ // Build activity-specific object with human-readable name including time context
3320
+ // e.g., "Video: Introduction (started at 1:23)" or "Audio: Podcast (paused at 2:45)"
3291
3321
  var mediaObject = buildMediaActivityObject({
3292
3322
  type: data.type,
3293
3323
  src: data.src,
3294
3324
  name: data.name,
3295
3325
  duration: data.duration,
3296
- lessonName: lessonInfo.name
3326
+ lessonName: lessonInfo.name,
3327
+ action: data.action,
3328
+ currentTime: data.currentTime
3297
3329
  });
3298
3330
 
3299
3331
  var result = {