@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 CHANGED
@@ -106,6 +106,8 @@ function pause() {
106
106
  source: ''
107
107
  };
108
108
  this.video.pause();
109
+ var currentTime = this.video.video.currentTime;
110
+ this.video.seek(currentTime);
109
111
  return {
110
112
  type: OPERATE,
111
113
  operation: operation
@@ -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
- this.video.currentTime = time;
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@desynova-digital/player",
3
- "version": "3.13.14",
3
+ "version": "3.13.15",
4
4
  "description": "Video Player Package for Contido Application",
5
5
  "main": "index.js",
6
6
  "scripts": {