@desynova-digital/player 3.2.2 → 3.3.0

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.
@@ -451,21 +451,20 @@ var Video = function (_Component) {
451
451
  this.hls.audioTrack = newProps.player.activeAudio.id;
452
452
  }
453
453
  if (newProps.subtitleObj && newProps.subtitleObj.field && JSON.stringify(newProps.subtitleObj) !== JSON.stringify(currentSubtitleObj)) {
454
- // if(newProps.subtitleObj?.field){
455
- var style = this.getSubtitleStyle(newProps.subtitleObj.field);
456
- this.setState({
457
- currentSubtitleObj: {
458
- line1: newProps.subtitleObj.field.line1,
459
- line2: newProps.subtitleObj.field.line2,
460
- style: style
461
- }
462
- });
463
- // } else if (!newProps.subtitleObj?.field?.length) {
464
- // this.setState({
465
- // subtitleObj: {
466
- // }
467
- // })
468
- // }
454
+ if (newProps.subtitleObj && newProps.subtitleObj.field && !newProps.subtitleObj.field.line1) {
455
+ this.setState({
456
+ currentSubtitleObj: {}
457
+ });
458
+ } else if (newProps.subtitleObj && newProps.subtitleObj.field && newProps.subtitleObj.field.line1) {
459
+ var style = this.getSubtitleStyle(newProps.subtitleObj.field);
460
+ this.setState({
461
+ currentSubtitleObj: {
462
+ line1: newProps.subtitleObj.field.line1,
463
+ line2: newProps.subtitleObj.field.line2,
464
+ style: style
465
+ }
466
+ });
467
+ }
469
468
  }
470
469
  if (newProps.markers.length && markers.length && newProps.markers[0].values.length !== markers[0].values.length) {
471
470
  this.displaySubtitle(newProps.markers);
@@ -745,9 +744,13 @@ var Video = function (_Component) {
745
744
  key: 'displaySubtitle',
746
745
  value: function displaySubtitle(marker) {
747
746
  var _props14 = this.props,
748
- currentTime = _props14.player.currentTime,
749
- markers = _props14.markers;
747
+ markers = _props14.markers,
748
+ resetSubtitleData = _props14.resetSubtitleData;
750
749
 
750
+ if (resetSubtitleData) {
751
+ resetSubtitleData();
752
+ }
753
+ var currentTime = this.video.currentTime;
751
754
  var currentMarker = marker || markers;
752
755
  if (currentMarker && currentMarker[0] && currentMarker[0].name === "Subtitle") {
753
756
  var values = currentMarker[0].values;
@@ -988,6 +991,7 @@ var Video = function (_Component) {
988
991
  if (onTimeUpdate) {
989
992
  onTimeUpdate.apply(undefined, arguments);
990
993
  }
994
+ this.displaySubtitle();
991
995
  }
992
996
 
993
997
  /**
@@ -1141,22 +1145,36 @@ var Video = function (_Component) {
1141
1145
  return _react2.default.cloneElement(c, cprops);
1142
1146
  });
1143
1147
  }
1148
+ }, {
1149
+ key: 'handleClick',
1150
+ value: function handleClick() {
1151
+ var _props29 = this.props,
1152
+ actions = _props29.actions,
1153
+ player = _props29.player;
1154
+
1155
+ if (player.paused) {
1156
+ actions.play();
1157
+ } else {
1158
+ actions.pause();
1159
+ }
1160
+ actions.handleVideoRewind(false);
1161
+ }
1144
1162
  }, {
1145
1163
  key: 'render',
1146
1164
  value: function render() {
1147
1165
  var _this5 = this;
1148
1166
 
1149
- var _props29 = this.props,
1150
- loop = _props29.loop,
1151
- poster = _props29.poster,
1152
- preload = _props29.preload,
1153
- autoPlay = _props29.autoPlay,
1154
- playsInline = _props29.playsInline,
1155
- muted = _props29.muted,
1156
- crossOrigin = _props29.crossOrigin,
1157
- videoId = _props29.videoId,
1158
- fileType = _props29.fileType,
1159
- userEmail = _props29.userEmail;
1167
+ var _props30 = this.props,
1168
+ loop = _props30.loop,
1169
+ poster = _props30.poster,
1170
+ preload = _props30.preload,
1171
+ autoPlay = _props30.autoPlay,
1172
+ playsInline = _props30.playsInline,
1173
+ muted = _props30.muted,
1174
+ crossOrigin = _props30.crossOrigin,
1175
+ videoId = _props30.videoId,
1176
+ fileType = _props30.fileType,
1177
+ userEmail = _props30.userEmail;
1160
1178
  var _state2 = this.state,
1161
1179
  isBuffering = _state2.isBuffering,
1162
1180
  watermark = _state2.watermark,
@@ -1286,12 +1304,7 @@ var Video = function (_Component) {
1286
1304
  SubTitleSection,
1287
1305
  {
1288
1306
  onClick: function onClick() {
1289
- if (player.paused) {
1290
- actions.play();
1291
- } else {
1292
- actions.pause();
1293
- }
1294
- actions.handleVideoRewind(false);
1307
+ return _this5.handleClick();
1295
1308
  }
1296
1309
  },
1297
1310
  _react2.default.createElement(
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8
+
9
+ var _react = require("react");
10
+
11
+ var _react2 = _interopRequireDefault(_react);
12
+
13
+ var _propTypes = require("prop-types");
14
+
15
+ var _styledComponents = require("styled-components");
16
+
17
+ var _styledComponents2 = _interopRequireDefault(_styledComponents);
18
+
19
+ var _components = require("@desynova-digital/components");
20
+
21
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
+
23
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
24
+
25
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
26
+
27
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
28
+
29
+ var CameraButtonIcon = (0, _styledComponents2.default)(_components.Button).withConfig({
30
+ displayName: "CameraButton__CameraButtonIcon",
31
+ componentId: "sc-1iapkc3-0"
32
+ })(["background:transparent;border:none;margin:0px;margin-right:10px;&:hover,&:focus{background:transparent;}"]);
33
+
34
+ var propTypes = {
35
+ actions: _propTypes.PropTypes.instanceOf(Object),
36
+ player: _propTypes.PropTypes.instanceOf(Object),
37
+ handleClick: _propTypes.PropTypes.func
38
+ };
39
+
40
+ var CameraButton = function (_Component) {
41
+ _inherits(CameraButton, _Component);
42
+
43
+ function CameraButton(props, context) {
44
+ _classCallCheck(this, CameraButton);
45
+
46
+ return _possibleConstructorReturn(this, (CameraButton.__proto__ || Object.getPrototypeOf(CameraButton)).call(this, props, context));
47
+ }
48
+
49
+ _createClass(CameraButton, [{
50
+ key: "handleClick",
51
+ value: function handleClick() {
52
+ var _props = this.props,
53
+ onTakeSnapshot = _props.onTakeSnapshot,
54
+ video = _props.video;
55
+
56
+ onTakeSnapshot(video.currentTime);
57
+ }
58
+ }, {
59
+ key: "render",
60
+ value: function render() {
61
+ var playerType = this.props.playerType;
62
+
63
+ return playerType === 'tagging' && _react2.default.createElement(CameraButtonIcon, {
64
+ display: "rounded",
65
+ appearance: "cta",
66
+ icon: "camera",
67
+ iconWidth: 18,
68
+ iconHeight: 18,
69
+ width: 20,
70
+ height: 20,
71
+ onClick: this.handleClick
72
+ });
73
+ }
74
+ }]);
75
+
76
+ return CameraButton;
77
+ }(_react.Component);
78
+
79
+ exports.default = CameraButton;
@@ -72,6 +72,10 @@ var _SubtitleLanguagesMenuButton = require('./SubtitleLanguagesMenuButton');
72
72
 
73
73
  var _SubtitleLanguagesMenuButton2 = _interopRequireDefault(_SubtitleLanguagesMenuButton);
74
74
 
75
+ var _CameraButton = require('./CameraButton');
76
+
77
+ var _CameraButton2 = _interopRequireDefault(_CameraButton);
78
+
75
79
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
76
80
 
77
81
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -187,7 +191,10 @@ var ControlBar = function (_Component) {
187
191
  }, this.props, {
188
192
  key: 'volume-menu-button',
189
193
  order: 8
190
- })), _react2.default.createElement(_AudioTracksMenuButton2.default, _extends({}, this.props, {
194
+ })), _react2.default.createElement(_CameraButton2.default, {
195
+ order: 9,
196
+ playerType: playerType
197
+ }), _react2.default.createElement(_AudioTracksMenuButton2.default, _extends({}, this.props, {
191
198
  key: 'audio-tracks-menu-button',
192
199
  order: 9
193
200
  })), _react2.default.createElement(_SettingsMenuButton2.default, _extends({}, this.props, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@desynova-digital/player",
3
- "version": "3.2.2",
3
+ "version": "3.3.0",
4
4
  "description": "Video Player Package for Contido Application",
5
5
  "main": "index.js",
6
6
  "scripts": {