musora-content-services 1.0.159 → 1.0.160

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/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.0.160](https://github.com/railroadmedia/musora-content-services/compare/v1.0.159...v1.0.160) (2024-11-08)
6
+
5
7
  ### [1.0.159](https://github.com/railroadmedia/musora-content-services/compare/v1.0.158...v1.0.159) (2024-11-08)
6
8
 
7
9
  ### [1.0.158](https://github.com/railroadmedia/musora-content-services/compare/v1.0.157...v1.0.158) (2024-11-08)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musora-content-services",
3
- "version": "1.0.159",
3
+ "version": "1.0.160",
4
4
  "description": "A package for Musoras content services ",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -85,13 +85,26 @@ export async function contentStatusReset(contentId) {
85
85
  });
86
86
  }
87
87
 
88
-
88
+ /**
89
+ * Record watch session
90
+ * @return {string} sessionId - provide in future calls to update progress
91
+ * @param {int} contentId
92
+ * @param {string} mediaType - options are video, assignment, practice
93
+ * @param {string} mediaCategory - options are youtube, vimeo, soundslice, play-alongs
94
+ * @param {int} mediaLengthSeconds
95
+ * @param {int} currentSeconds
96
+ * @param {int} secondsPlayed
97
+ * @param {string} sessionId - This function records a sessionId to pass into future updates to progress on the same video
98
+ */
89
99
  export async function recordWatchSession(contentId, mediaType, mediaCategory, mediaLengthSeconds, currentSeconds, secondsPlayed, sessionId = null) {
90
100
  let mediaTypeId = getMediaTypeId(mediaType, mediaCategory);
91
101
  let updateLocalProgress = mediaTypeId === 1 || mediaTypeId === 2; //only update for video playback
102
+ if (!sessionId) {
103
+ sessionId = uuidv4();
104
+ }
92
105
  await dataContext.update(
93
106
  async function (localContext) {
94
- if (contentId && updateLocalProgress ) {
107
+ if (contentId && updateLocalProgress) {
95
108
  let data = localContext.data[contentId] ?? [];
96
109
  let progress = data?.[DATA_KEY_PROGRESS] ?? 0;
97
110
  let status = data?.[DATA_KEY_STATUS] ?? 0;