|
1 | 1 | import { getRoot, types } from 'mobx-state-tree';
|
2 | 2 | import React from 'react';
|
3 | 3 |
|
| 4 | +import { isTimeRelativelySimilar } from '../../../lib/AudioUltra'; |
4 | 5 | import { AnnotationMixin } from '../../../mixins/AnnotationMixin';
|
| 6 | +import IsReadyMixin from '../../../mixins/IsReadyMixin'; |
5 | 7 | import ProcessAttrsMixin from '../../../mixins/ProcessAttrs';
|
6 |
| -import ObjectBase from '../Base'; |
7 | 8 | import { SyncMixin } from '../../../mixins/SyncMixin';
|
8 |
| -import IsReadyMixin from '../../../mixins/IsReadyMixin'; |
9 |
| -import { isTimeRelativelySimilar } from '../../../lib/AudioUltra'; |
| 9 | +import { parseValue } from '../../../utils/data'; |
10 | 10 | import { FF_DEV_2715, isFF } from '../../../utils/feature-flags';
|
| 11 | +import ObjectBase from '../Base'; |
11 | 12 |
|
12 | 13 | const isFFDev2715 = isFF(FF_DEV_2715);
|
13 | 14 |
|
@@ -40,7 +41,7 @@ const isFFDev2715 = isFF(FF_DEV_2715);
|
40 | 41 | * @meta_description Customize Label Studio with the Video tag for basic video annotation tasks for machine learning and data science projects.
|
41 | 42 | * @param {string} name Name of the element
|
42 | 43 | * @param {string} value URL of the video
|
43 |
| - * @param {number} [frameRate=24] videp frame rate per second; default is 24 |
| 44 | + * @param {number} [frameRate=24] video frame rate per second; default is 24; can use task data like `$fps` |
44 | 45 | * @param {string} [sync] object name to sync with
|
45 | 46 | * @param {boolean} [muted=false] muted video
|
46 | 47 | * @param {number} [height=600] height of the video
|
@@ -114,10 +115,11 @@ const Model = types
|
114 | 115 |
|
115 | 116 | return {
|
116 | 117 | afterCreate() {
|
117 |
| - const { framerate } = self; |
| 118 | + const framerate = Number(parseValue(self.framerate, self.store.task?.dataObj)); |
118 | 119 |
|
119 |
| - if (!framerate) self.framerate = 24; |
120 |
| - else if (framerate < 1) self.framerate = 1 / framerate; |
| 120 | + if (!framerate || isNaN(framerate)) self.framerate = '24'; |
| 121 | + else if (framerate < 1) self.framerate = String(1 / framerate); |
| 122 | + else self.framerate = String(framerate); |
121 | 123 | },
|
122 | 124 |
|
123 | 125 | triggerSyncPlay() {
|
|
0 commit comments