@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.cjs +41 -9
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +41 -9
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +41 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2620,9 +2620,28 @@ function generateLrsBridgeCode(options) {
|
|
|
2620
2620
|
};
|
|
2621
2621
|
}
|
|
2622
2622
|
|
|
2623
|
+
/**
|
|
2624
|
+
* Format seconds into MM:SS or HH:MM:SS format
|
|
2625
|
+
*/
|
|
2626
|
+
function formatMediaTime(seconds) {
|
|
2627
|
+
if (typeof seconds !== 'number' || isNaN(seconds)) return '0:00';
|
|
2628
|
+
var totalSeconds = Math.floor(seconds);
|
|
2629
|
+
var hours = Math.floor(totalSeconds / 3600);
|
|
2630
|
+
var minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
2631
|
+
var secs = totalSeconds % 60;
|
|
2632
|
+
|
|
2633
|
+
if (hours > 0) {
|
|
2634
|
+
return hours + ':' + (minutes < 10 ? '0' : '') + minutes + ':' + (secs < 10 ? '0' : '') + secs;
|
|
2635
|
+
}
|
|
2636
|
+
return minutes + ':' + (secs < 10 ? '0' : '') + secs;
|
|
2637
|
+
}
|
|
2638
|
+
|
|
2623
2639
|
/**
|
|
2624
2640
|
* Build activity object for media (video/audio) with human-readable name
|
|
2625
|
-
* Name format
|
|
2641
|
+
* Name format varies by action:
|
|
2642
|
+
* - played: "Video: Title (started at 1:23)"
|
|
2643
|
+
* - paused: "Video: Title (paused at 2:45)"
|
|
2644
|
+
* - completed: "Video: Title (completed)"
|
|
2626
2645
|
*/
|
|
2627
2646
|
function buildMediaActivityObject(mediaInfo) {
|
|
2628
2647
|
var mediaGuid = mediaInfo.mediaGuid || generateUUID();
|
|
@@ -2630,11 +2649,22 @@ function generateLrsBridgeCode(options) {
|
|
|
2630
2649
|
var resourceType = mediaInfo.type === 'audio' ? 'Audio' : 'Video';
|
|
2631
2650
|
|
|
2632
2651
|
// Build human-readable display name
|
|
2633
|
-
var
|
|
2634
|
-
if (!
|
|
2635
|
-
|
|
2636
|
-
}
|
|
2637
|
-
|
|
2652
|
+
var baseName = mediaInfo.name || '';
|
|
2653
|
+
if (!baseName || baseName === 'video' || baseName === 'audio' || baseName === 'Media') {
|
|
2654
|
+
baseName = mediaInfo.lessonName || 'Media';
|
|
2655
|
+
}
|
|
2656
|
+
|
|
2657
|
+
// Add time context based on action
|
|
2658
|
+
var displayName = resourceType + ': ' + baseName;
|
|
2659
|
+
var currentTime = mediaInfo.currentTime || 0;
|
|
2660
|
+
var action = mediaInfo.action;
|
|
2661
|
+
|
|
2662
|
+
if (action === 'play' || action === 'played') {
|
|
2663
|
+
displayName += ' (started at ' + formatMediaTime(currentTime) + ')';
|
|
2664
|
+
} else if (action === 'pause' || action === 'paused') {
|
|
2665
|
+
displayName += ' (paused at ' + formatMediaTime(currentTime) + ')';
|
|
2666
|
+
} else if (action === 'completed' || action === 'complete') {
|
|
2667
|
+
displayName += ' (completed)';
|
|
2638
2668
|
}
|
|
2639
2669
|
|
|
2640
2670
|
return {
|
|
@@ -2959,14 +2989,16 @@ function generateLrsBridgeCode(options) {
|
|
|
2959
2989
|
data.action === 'pause' ? 'paused' :
|
|
2960
2990
|
data.action === 'completed' ? 'completed' : 'played';
|
|
2961
2991
|
|
|
2962
|
-
// Build activity-specific object with human-readable name
|
|
2963
|
-
// e.g., "Video: Introduction" or "Audio: Podcast
|
|
2992
|
+
// Build activity-specific object with human-readable name including time context
|
|
2993
|
+
// e.g., "Video: Introduction (started at 1:23)" or "Audio: Podcast (paused at 2:45)"
|
|
2964
2994
|
var mediaObject = buildMediaActivityObject({
|
|
2965
2995
|
type: data.type,
|
|
2966
2996
|
src: data.src,
|
|
2967
2997
|
name: data.name,
|
|
2968
2998
|
duration: data.duration,
|
|
2969
|
-
lessonName: lessonInfo.name
|
|
2999
|
+
lessonName: lessonInfo.name,
|
|
3000
|
+
action: data.action,
|
|
3001
|
+
currentTime: data.currentTime
|
|
2970
3002
|
});
|
|
2971
3003
|
|
|
2972
3004
|
var result = {
|