musora-content-services 1.0.158 → 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,10 @@
|
|
|
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
|
+
|
|
7
|
+
### [1.0.159](https://github.com/railroadmedia/musora-content-services/compare/v1.0.158...v1.0.159) (2024-11-08)
|
|
8
|
+
|
|
5
9
|
### [1.0.158](https://github.com/railroadmedia/musora-content-services/compare/v1.0.157...v1.0.158) (2024-11-08)
|
|
6
10
|
|
|
7
11
|
### [1.0.157](https://github.com/railroadmedia/musora-content-services/compare/v1.0.156...v1.0.157) (2024-11-08)
|
package/package.json
CHANGED
|
@@ -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;
|
|
@@ -248,7 +248,7 @@ async function fetchDataHandler(url, dataVersion, method = "get") {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
async function postDataHandler(url, data) {
|
|
251
|
-
return fetchHandler(url, 'post', data);
|
|
251
|
+
return fetchHandler(url, 'post', null, data);
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
export async function fetchHandler(url, method = "get", dataVersion = null, body = null) {
|