@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/cli.cjs
CHANGED
|
@@ -2956,9 +2956,28 @@ function generateLrsBridgeCode(options) {
|
|
|
2956
2956
|
};
|
|
2957
2957
|
}
|
|
2958
2958
|
|
|
2959
|
+
/**
|
|
2960
|
+
* Format seconds into MM:SS or HH:MM:SS format
|
|
2961
|
+
*/
|
|
2962
|
+
function formatMediaTime(seconds) {
|
|
2963
|
+
if (typeof seconds !== 'number' || isNaN(seconds)) return '0:00';
|
|
2964
|
+
var totalSeconds = Math.floor(seconds);
|
|
2965
|
+
var hours = Math.floor(totalSeconds / 3600);
|
|
2966
|
+
var minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
2967
|
+
var secs = totalSeconds % 60;
|
|
2968
|
+
|
|
2969
|
+
if (hours > 0) {
|
|
2970
|
+
return hours + ':' + (minutes < 10 ? '0' : '') + minutes + ':' + (secs < 10 ? '0' : '') + secs;
|
|
2971
|
+
}
|
|
2972
|
+
return minutes + ':' + (secs < 10 ? '0' : '') + secs;
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2959
2975
|
/**
|
|
2960
2976
|
* Build activity object for media (video/audio) with human-readable name
|
|
2961
|
-
* Name format
|
|
2977
|
+
* Name format varies by action:
|
|
2978
|
+
* - played: "Video: Title (started at 1:23)"
|
|
2979
|
+
* - paused: "Video: Title (paused at 2:45)"
|
|
2980
|
+
* - completed: "Video: Title (completed)"
|
|
2962
2981
|
*/
|
|
2963
2982
|
function buildMediaActivityObject(mediaInfo) {
|
|
2964
2983
|
var mediaGuid = mediaInfo.mediaGuid || generateUUID();
|
|
@@ -2966,11 +2985,22 @@ function generateLrsBridgeCode(options) {
|
|
|
2966
2985
|
var resourceType = mediaInfo.type === 'audio' ? 'Audio' : 'Video';
|
|
2967
2986
|
|
|
2968
2987
|
// Build human-readable display name
|
|
2969
|
-
var
|
|
2970
|
-
if (!
|
|
2971
|
-
|
|
2972
|
-
}
|
|
2973
|
-
|
|
2988
|
+
var baseName = mediaInfo.name || '';
|
|
2989
|
+
if (!baseName || baseName === 'video' || baseName === 'audio' || baseName === 'Media') {
|
|
2990
|
+
baseName = mediaInfo.lessonName || 'Media';
|
|
2991
|
+
}
|
|
2992
|
+
|
|
2993
|
+
// Add time context based on action
|
|
2994
|
+
var displayName = resourceType + ': ' + baseName;
|
|
2995
|
+
var currentTime = mediaInfo.currentTime || 0;
|
|
2996
|
+
var action = mediaInfo.action;
|
|
2997
|
+
|
|
2998
|
+
if (action === 'play' || action === 'played') {
|
|
2999
|
+
displayName += ' (started at ' + formatMediaTime(currentTime) + ')';
|
|
3000
|
+
} else if (action === 'pause' || action === 'paused') {
|
|
3001
|
+
displayName += ' (paused at ' + formatMediaTime(currentTime) + ')';
|
|
3002
|
+
} else if (action === 'completed' || action === 'complete') {
|
|
3003
|
+
displayName += ' (completed)';
|
|
2974
3004
|
}
|
|
2975
3005
|
|
|
2976
3006
|
return {
|
|
@@ -3295,14 +3325,16 @@ function generateLrsBridgeCode(options) {
|
|
|
3295
3325
|
data.action === 'pause' ? 'paused' :
|
|
3296
3326
|
data.action === 'completed' ? 'completed' : 'played';
|
|
3297
3327
|
|
|
3298
|
-
// Build activity-specific object with human-readable name
|
|
3299
|
-
// e.g., "Video: Introduction" or "Audio: Podcast
|
|
3328
|
+
// Build activity-specific object with human-readable name including time context
|
|
3329
|
+
// e.g., "Video: Introduction (started at 1:23)" or "Audio: Podcast (paused at 2:45)"
|
|
3300
3330
|
var mediaObject = buildMediaActivityObject({
|
|
3301
3331
|
type: data.type,
|
|
3302
3332
|
src: data.src,
|
|
3303
3333
|
name: data.name,
|
|
3304
3334
|
duration: data.duration,
|
|
3305
|
-
lessonName: lessonInfo.name
|
|
3335
|
+
lessonName: lessonInfo.name,
|
|
3336
|
+
action: data.action,
|
|
3337
|
+
currentTime: data.currentTime
|
|
3306
3338
|
});
|
|
3307
3339
|
|
|
3308
3340
|
var result = {
|