@desynova-digital/player 3.13.13 → 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 +26 -3
- package/package.json +1 -1
package/actions/player.js
CHANGED
package/components/Video.js
CHANGED
|
@@ -95,7 +95,7 @@ var defaultProps = {
|
|
|
95
95
|
aspectRatio: 'auto',
|
|
96
96
|
crossOrigin: 'anonymous'
|
|
97
97
|
};
|
|
98
|
-
var SubTitleSection = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n font-family: SFUIText-Regular;\n font-size: 16px;\n bottom: 20px;\n width: 100%;\n display: flex;\n justify-content: center;\n text-align: center;\n color: #ffffff;\n height: 90%;\n align-items: center;\n\n .subtitleContainer {\n border-radius: 4px;\n width: fit-content;\n background: #000000;\n opacity: 0.9;\n padding: ", ";\n line-height: 20px;\n position: absolute;\n }\n .longSubtitleStyles {\n overflow-y:
|
|
98
|
+
var SubTitleSection = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n font-family: SFUIText-Regular;\n font-size: 16px;\n bottom: 20px;\n width: 100%;\n display: flex;\n justify-content: center;\n text-align: center;\n color: #ffffff;\n height: 90%;\n align-items: center;\n\n .subtitleContainer {\n border-radius: 4px;\n width: fit-content;\n background: #000000;\n opacity: 0.9;\n padding: ", ";\n line-height: 20px;\n position: absolute;\n }\n .longSubtitleStyles {\n overflow-y: auto;\n height: fit-content;\n max-height: 70px;\n max-width: 75%;\n width: fit-content;\n }\n"])), function (props) {
|
|
99
99
|
return props.currentSubtitleObj && props.currentSubtitleObj.line1 ? '8px 10px' : '0px';
|
|
100
100
|
});
|
|
101
101
|
var VideoBlock = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n &.video-react-player-block {\n position: relative;\n transition: all 0.1s ease-in-out;\n -moz-transition: all 0.1s ease-in-out;\n -webkit-transition: all 0.1s ease-in-out;\n -ms-transition: all 0.1s ease-in-out;\n -o-transition: all 0.1s ease-in-out;\n video {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n right: 0;\n bottom: 0;\n }\n .audio-tracks {\n position: relative;\n display: flex;\n background: rgba(0, 0, 0, 0.5);\n color: #fff;\n z-index: 10;\n position: absolute;\n width: 100%;\n bottom: 0;\n p {\n cursor: pointer;\n padding: 10px;\n }\n }\n .loader-container {\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n z-index: 10;\n background: rgba(0, 0, 0, 0.5);\n }\n }\n &.ratio-border {\n border: 1px solid rgba(255, 255, 255, 0.5);\n &:after {\n content: '16:9 Safe Area';\n position: absolute;\n color: #fff;\n font-family: SFUIText-Regular;\n font-size: 12px;\n transform: rotate(-90deg);\n top: 20%;\n left: -50px;\n }\n }\n"])));
|
|
@@ -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, [{
|
|
@@ -474,6 +475,7 @@ var Video = /*#__PURE__*/function (_Component) {
|
|
|
474
475
|
var style = this.getSubtitleStyle(newProps.subtitleObj.field);
|
|
475
476
|
this.setState({
|
|
476
477
|
currentSubtitleObj: {
|
|
478
|
+
charactername: newProps.subtitleObj.field.charactername,
|
|
477
479
|
line1: newProps.subtitleObj.field.line1,
|
|
478
480
|
line2: newProps.subtitleObj.field.line2,
|
|
479
481
|
start_time: newProps.subtitleObj.field.in_time,
|
|
@@ -550,7 +552,8 @@ var Video = /*#__PURE__*/function (_Component) {
|
|
|
550
552
|
key: "seek",
|
|
551
553
|
value: function seek(time) {
|
|
552
554
|
try {
|
|
553
|
-
|
|
555
|
+
var updatedTime = this.handleAdjustingVideoAsPerFrame(time);
|
|
556
|
+
this.video.currentTime = updatedTime;
|
|
554
557
|
} catch (e) {
|
|
555
558
|
// console.log(e, 'Video is not ready.')
|
|
556
559
|
}
|
|
@@ -717,6 +720,23 @@ var Video = /*#__PURE__*/function (_Component) {
|
|
|
717
720
|
style.right = data && data.text_alignment === 'text_aligned_right' ? '0px' : '';
|
|
718
721
|
return style;
|
|
719
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
|
+
}
|
|
720
740
|
}, {
|
|
721
741
|
key: "displaySubtitle",
|
|
722
742
|
value: function displaySubtitle(marker) {
|
|
@@ -747,6 +767,7 @@ var Video = /*#__PURE__*/function (_Component) {
|
|
|
747
767
|
} else {
|
|
748
768
|
this.setState({
|
|
749
769
|
currentSubtitleObj: {
|
|
770
|
+
charactername: currentValue[0] && currentValue[0].charactername || '',
|
|
750
771
|
line1: currentValue[0] && currentValue[0].line1 || '',
|
|
751
772
|
line2: currentValue[0] && currentValue[0].line2 || '',
|
|
752
773
|
start_time: currentValue[0] && currentValue[0].start_time || 0,
|
|
@@ -1245,7 +1266,9 @@ var Video = /*#__PURE__*/function (_Component) {
|
|
|
1245
1266
|
},
|
|
1246
1267
|
className: "subtitleContainer longSubtitleStyles",
|
|
1247
1268
|
style: _objectSpread({}, currentSubtitleObj.style)
|
|
1248
|
-
}, currentSubtitleObj.
|
|
1269
|
+
}, currentSubtitleObj.charactername && /*#__PURE__*/_react["default"].createElement("p", {
|
|
1270
|
+
id: "charactername"
|
|
1271
|
+
}, " ", currentSubtitleObj.charactername, " ") || null, currentSubtitleObj.line1 && /*#__PURE__*/_react["default"].createElement("p", {
|
|
1249
1272
|
id: "subtitleLineOne"
|
|
1250
1273
|
}, " ", currentSubtitleObj.line1, " ") || null, currentSubtitleObj.line2 && /*#__PURE__*/_react["default"].createElement("p", {
|
|
1251
1274
|
id: "subtitleLineTwo"
|