@desynova-digital/player 3.13.14 → 3.13.15
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/actions/player.js +2 -0
- package/components/Video.js +20 -1
- package/package.json +1 -1
package/actions/player.js
CHANGED
package/components/Video.js
CHANGED
|
@@ -162,6 +162,7 @@ var Video = /*#__PURE__*/function (_Component) {
|
|
|
162
162
|
_this.handleKeypress = _this.handleKeypress.bind(_assertThisInitialized(_this));
|
|
163
163
|
_this.audioVisualizer = _this.audioVisualizer.bind(_assertThisInitialized(_this));
|
|
164
164
|
_this.checkWatermark = _this.checkWatermark.bind(_assertThisInitialized(_this));
|
|
165
|
+
_this.handleAdjustingVideoAsPerFrame = _this.handleAdjustingVideoAsPerFrame.bind(_assertThisInitialized(_this));
|
|
165
166
|
return _this;
|
|
166
167
|
}
|
|
167
168
|
_createClass(Video, [{
|
|
@@ -551,7 +552,8 @@ var Video = /*#__PURE__*/function (_Component) {
|
|
|
551
552
|
key: "seek",
|
|
552
553
|
value: function seek(time) {
|
|
553
554
|
try {
|
|
554
|
-
|
|
555
|
+
var updatedTime = this.handleAdjustingVideoAsPerFrame(time);
|
|
556
|
+
this.video.currentTime = updatedTime;
|
|
555
557
|
} catch (e) {
|
|
556
558
|
// console.log(e, 'Video is not ready.')
|
|
557
559
|
}
|
|
@@ -718,6 +720,23 @@ var Video = /*#__PURE__*/function (_Component) {
|
|
|
718
720
|
style.right = data && data.text_alignment === 'text_aligned_right' ? '0px' : '';
|
|
719
721
|
return style;
|
|
720
722
|
}
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
*
|
|
726
|
+
* @param {Number} currentTime current time of video
|
|
727
|
+
* @returns adjusting the current time to the nearest frame
|
|
728
|
+
*/
|
|
729
|
+
}, {
|
|
730
|
+
key: "handleAdjustingVideoAsPerFrame",
|
|
731
|
+
value: function handleAdjustingVideoAsPerFrame(currentTime) {
|
|
732
|
+
var frameRate = this.props.frameRate;
|
|
733
|
+
var frameDuration = 1 / frameRate;
|
|
734
|
+
var milliSeconds = currentTime - Math.floor(currentTime);
|
|
735
|
+
var frameNumber = Math.round(milliSeconds / frameDuration);
|
|
736
|
+
var updatedMilliseconds = frameNumber * frameDuration;
|
|
737
|
+
var adjustedTimeInSeconds = Math.trunc(currentTime) + updatedMilliseconds;
|
|
738
|
+
return adjustedTimeInSeconds;
|
|
739
|
+
}
|
|
721
740
|
}, {
|
|
722
741
|
key: "displaySubtitle",
|
|
723
742
|
value: function displaySubtitle(marker) {
|