@desynova-digital/player 3.13.14 → 3.13.16
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 +25 -2
- 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,12 +552,17 @@ var Video = /*#__PURE__*/function (_Component) {
|
|
|
551
552
|
key: "seek",
|
|
552
553
|
value: function seek(time) {
|
|
553
554
|
try {
|
|
554
|
-
|
|
555
|
+
var updatedTime = 0;
|
|
556
|
+
if (time < 0) {
|
|
557
|
+
updatedTime = 0;
|
|
558
|
+
} else {
|
|
559
|
+
updatedTime = time > this.video.duration ? this.video.duration : this.handleAdjustingVideoAsPerFrame(time);
|
|
560
|
+
}
|
|
561
|
+
this.video.currentTime = updatedTime;
|
|
555
562
|
} catch (e) {
|
|
556
563
|
// console.log(e, 'Video is not ready.')
|
|
557
564
|
}
|
|
558
565
|
}
|
|
559
|
-
|
|
560
566
|
// jump forward x seconds
|
|
561
567
|
}, {
|
|
562
568
|
key: "forward",
|
|
@@ -718,6 +724,23 @@ var Video = /*#__PURE__*/function (_Component) {
|
|
|
718
724
|
style.right = data && data.text_alignment === 'text_aligned_right' ? '0px' : '';
|
|
719
725
|
return style;
|
|
720
726
|
}
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
*
|
|
730
|
+
* @param {Number} currentTime current time of video
|
|
731
|
+
* @returns adjusting the current time to the nearest frame
|
|
732
|
+
*/
|
|
733
|
+
}, {
|
|
734
|
+
key: "handleAdjustingVideoAsPerFrame",
|
|
735
|
+
value: function handleAdjustingVideoAsPerFrame(currentTime) {
|
|
736
|
+
var frameRate = this.props.frameRate;
|
|
737
|
+
var frameDuration = 1 / frameRate;
|
|
738
|
+
var milliSeconds = currentTime - Math.floor(currentTime);
|
|
739
|
+
var frameNumber = Math.round(milliSeconds / frameDuration);
|
|
740
|
+
var updatedMilliseconds = frameNumber * frameDuration;
|
|
741
|
+
var adjustedTimeInSeconds = Math.trunc(currentTime) + updatedMilliseconds;
|
|
742
|
+
return adjustedTimeInSeconds;
|
|
743
|
+
}
|
|
721
744
|
}, {
|
|
722
745
|
key: "displaySubtitle",
|
|
723
746
|
value: function displaySubtitle(marker) {
|