Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add creationTime to offline assets #2406

Merged
merged 4 commits into from
Apr 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions externs/shaka/offline.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ shaka.extern.StoredContent;

/**
* @typedef {{
* creationTime: number,
* originalManifestUri: string,
* duration: number,
* size: number,
Expand All @@ -69,6 +70,8 @@ shaka.extern.StoredContent;
* appMetadata: Object
* }}
*
* @property {number} creationTime
* The date time when the asset was created.
* @property {string} originalManifestUri
* The URI that the manifest was originally loaded from.
* @property {number} duration
Expand Down
1 change: 1 addition & 0 deletions lib/offline/indexeddb/v1_storage_cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ shaka.offline.indexeddb.V1StorageCell = class
streamsPerPeriod);

return {
creationTime: 0,
originalManifestUri: old.originalManifestUri,
duration: old.duration,
size: old.size,
Expand Down
1 change: 1 addition & 0 deletions lib/offline/indexeddb/v2_storage_cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ shaka.offline.indexeddb.V2StorageCell = class

return {
appMetadata: old.appMetadata,
creationTime: 0,
drmInfo: old.drmInfo,
duration: old.duration,
// JSON serialization turns Infinity into null, so turn it back now.
Expand Down
1 change: 1 addition & 0 deletions lib/offline/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,7 @@ shaka.offline.Storage = class {
}

return {
creationTime: Date.now(),
originalManifestUri: originalManifestUri,
duration: manifest.presentationTimeline.getDuration(),
size: 0,
Expand Down
5 changes: 5 additions & 0 deletions test/offline/manifest_convert_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ describe('ManifestConverter', () => {
]),
},
appMetadata: null,
creationTime: 0,
};

const manifest = createConverter().fromManifestDB(manifestDb);
Expand Down Expand Up @@ -134,6 +135,7 @@ describe('ManifestConverter', () => {
sessionIds: [],
drmInfo: null,
appMetadata: null,
creationTime: 0,
streams: [
createVideoStreamDB(1, [0]),
createVideoStreamDB(2, [1]),
Expand All @@ -160,6 +162,7 @@ describe('ManifestConverter', () => {
sessionIds: [],
drmInfo: null,
appMetadata: null,
creationTime: 0,
streams: [
createAudioStreamDB(1, [0]),
createAudioStreamDB(2, [1]),
Expand All @@ -186,6 +189,7 @@ describe('ManifestConverter', () => {
sessionIds: [],
drmInfo: null,
appMetadata: null,
creationTime: 0,
streams: [
createVideoStreamDB(1, [0]),
createTextStreamDB(2),
Expand Down Expand Up @@ -218,6 +222,7 @@ describe('ManifestConverter', () => {
sessionIds: [],
drmInfo: null,
appMetadata: null,
creationTime: 0,
streams: [
// Audio
createAudioStreamDB(audio1, [variant2]),
Expand Down
1 change: 1 addition & 0 deletions test/offline/offline_manifest_parser_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ filterDescribe('OfflineManifestParser', offlineManifestParserSupport, () => {

/** @type {shaka.extern.ManifestDB} */
const manifest = {
creationTime: Date.now(),
originalManifestUri: '',
duration: 600 * seconds,
size: 100 * mb,
Expand Down
1 change: 1 addition & 0 deletions test/test/util/offline_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ shaka.test.OfflineUtils = class {
*/
static createManifest(originalUri) {
return {
creationTime: Date.now(),
appMetadata: null,
drmInfo: null,
duration: 90,
Expand Down