diff --git a/lib/content/mixin.js b/lib/content/mixin.js index 2b1c24d58..ef803e19e 100644 --- a/lib/content/mixin.js +++ b/lib/content/mixin.js @@ -130,8 +130,28 @@ export default { type: Boolean, default: false, }, + timeSpent: { + type: Number, + default: 0, + }, + duration: { + type: Number, + default: null, + }, }, computed: { + // For when we want to force a renderer to use time-based progress (e.g. instead of % completed) + forceDurationBasedProgress() { + return this.options.force_duration_based_progress || false; + }, + // Uses clock-time to track time so that all content types can be tracked the same way + durationBasedProgress() { + const duration = this.duration || this.defaultDuration; + if (!duration) { + return null; + } + return this.timeSpent / duration; + }, defaultItemPreset() { return this.defaultFile ? this.defaultFile.preset