@desynova-digital/player 4.2.2 → 4.2.3

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.
@@ -456,7 +456,10 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
456
456
  key: "componentDidMount",
457
457
  value: function componentDidMount() {
458
458
  var _this2 = this;
459
- var src = this.props.src;
459
+ var _this$props4 = this.props,
460
+ src = _this$props4.src,
461
+ dubbedTracks = _this$props4.dubbedTracks,
462
+ additionalTracks = _this$props4.additionalTracks;
460
463
  var isM3U8 = src.split('.').pop() === 'm3u8';
461
464
  this.setState({
462
465
  isM3U8: isM3U8
@@ -465,7 +468,7 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
465
468
  var _this$manager$getStat = this.manager.getState(),
466
469
  HLSConfig = _this$manager$getStat.player.HLSConfig;
467
470
  this.hls = new _hls["default"](HLSConfig);
468
- this.setupHLS(src);
471
+ this.setupHLS(src, dubbedTracks, additionalTracks);
469
472
  } else {
470
473
  this.video.src = src;
471
474
  }
@@ -494,12 +497,12 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
494
497
  value: function componentDidUpdate(prevProps) {
495
498
  var _this3 = this,
496
499
  _prevProps$player;
497
- var _this$props4 = this.props,
498
- parentAnnotations = _this$props4.parentAnnotations,
499
- inTime = _this$props4.inTime,
500
- outTime = _this$props4.outTime,
501
- isRightMenuVisible = _this$props4.isRightMenuVisible,
502
- player = _this$props4.player;
500
+ var _this$props5 = this.props,
501
+ parentAnnotations = _this$props5.parentAnnotations,
502
+ inTime = _this$props5.inTime,
503
+ outTime = _this$props5.outTime,
504
+ isRightMenuVisible = _this$props5.isRightMenuVisible,
505
+ player = _this$props5.player;
503
506
  var hasNewAnnotations = JSON.stringify(parentAnnotations) !== JSON.stringify(prevProps.parentAnnotations);
504
507
  if (hasNewAnnotations) {
505
508
  Promise.resolve().then(function () {
@@ -556,9 +559,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
556
559
  */
557
560
  function checkWatermark() {
558
561
  var watermark = this.state.watermark;
559
- var _this$props5 = this.props,
560
- onPlayerClose = _this$props5.onPlayerClose,
561
- userEmail = _this$props5.userEmail;
562
+ var _this$props6 = this.props,
563
+ onPlayerClose = _this$props6.onPlayerClose,
564
+ userEmail = _this$props6.userEmail;
562
565
  var watermark_text = document.querySelector('#watermark-text');
563
566
  var video_player = null;
564
567
  var watermark_dimension = null;
@@ -593,9 +596,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
593
596
  var _this4 = this;
594
597
  var dubbedTracksOverride = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
595
598
  var additionalTracksOverride = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
596
- var _this$props6 = this.props,
597
- actions = _this$props6.actions,
598
- activeTrackIndex = _this$props6.activeTrackIndex;
599
+ var _this$props7 = this.props,
600
+ actions = _this$props7.actions,
601
+ activeTrackIndex = _this$props7.activeTrackIndex;
599
602
  var self = this;
600
603
  var effectiveDubbedTracks = dubbedTracksOverride !== undefined ? dubbedTracksOverride : this.props.dubbedTracks;
601
604
  var effectiveAdditionalTracks = additionalTracksOverride !== undefined ? additionalTracksOverride : this.props.additionalTracks;
@@ -608,6 +611,14 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
608
611
  };
609
612
  var hasDubbed = effectiveDubbedTracks && effectiveDubbedTracks.trim() !== '';
610
613
  var hasAdditionalTracks = effectiveAdditionalTracks && effectiveAdditionalTracks.trim() !== '';
614
+ if (this.combinedManifestUrl) {
615
+ try {
616
+ URL.revokeObjectURL(this.combinedManifestUrl);
617
+ } catch (e) {
618
+ console.warn('Error revoking blob URL in setupHLS:', e);
619
+ }
620
+ this.combinedManifestUrl = null;
621
+ }
611
622
  if (hasDubbed || hasAdditionalTracks) {
612
623
  this.combineM3U8Manifests(originalSrc, hasDubbed ? effectiveDubbedTracks : null, hasAdditionalTracks ? effectiveAdditionalTracks : null).then(function (_ref2) {
613
624
  var combinedManifest = _ref2.combinedManifest,
@@ -692,7 +703,12 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
692
703
  self.hls.off(_hls["default"].Events.AUDIO_TRACK_SWITCHED, _onTrackSwitched);
693
704
  };
694
705
  self.hls.on(_hls["default"].Events.AUDIO_TRACK_SWITCHED, _onTrackSwitched);
695
- self.hls.audioTrack = defaultIndex;
706
+ var maxTrackIndex = audioTracksWithFlags.length - 1;
707
+ var safeTrackIndex = Math.min(defaultIndex, maxTrackIndex);
708
+ if (safeTrackIndex !== defaultIndex) {
709
+ console.warn("[Video] Clamping audio track from ".concat(defaultIndex, " to ").concat(safeTrackIndex, " (max: ").concat(maxTrackIndex, ")"));
710
+ }
711
+ self.hls.audioTrack = safeTrackIndex;
696
712
  });
697
713
  this.hls.on(_hls["default"].Events.ERROR, function (event, data) {
698
714
  console.log('HLS.Events.ERROR: ', event, data);
@@ -799,16 +815,16 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
799
815
  }, {
800
816
  key: "getStyle",
801
817
  value: function getStyle() {
802
- var _this$props7 = this.props,
803
- fluid = _this$props7.fluid,
804
- noRightComponent = _this$props7.noRightComponent;
818
+ var _this$props8 = this.props,
819
+ fluid = _this$props8.fluid,
820
+ noRightComponent = _this$props8.noRightComponent;
805
821
  var _this$manager$getStat2 = this.manager.getState(),
806
822
  player = _this$manager$getStat2.player;
807
823
  var style = {};
808
- var _this$props8 = this.props,
809
- aspectRatio = _this$props8.aspectRatio,
810
- width = _this$props8.width,
811
- height = _this$props8.height;
824
+ var _this$props9 = this.props,
825
+ aspectRatio = _this$props9.aspectRatio,
826
+ width = _this$props9.width,
827
+ height = _this$props9.height;
812
828
  /*
813
829
  * The aspect ratio is either used directly
814
830
  * or to calculate width and height.
@@ -912,33 +928,39 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
912
928
  }, {
913
929
  key: "UNSAFE_componentWillReceiveProps",
914
930
  value: function UNSAFE_componentWillReceiveProps(newProps) {
915
- var _this$props9 = this.props,
916
- src = _this$props9.src,
917
- dubbedTracks = _this$props9.dubbedTracks,
918
- additionalTracks = _this$props9.additionalTracks,
919
- activeAudio = _this$props9.player.activeAudio,
920
- currentSubtitleObj = _this$props9.currentSubtitleObj,
921
- markers = _this$props9.markers,
922
- playerType = _this$props9.playerType;
931
+ var _this$props10 = this.props,
932
+ src = _this$props10.src,
933
+ dubbedTracks = _this$props10.dubbedTracks,
934
+ additionalTracks = _this$props10.additionalTracks,
935
+ activeAudio = _this$props10.player.activeAudio,
936
+ currentSubtitleObj = _this$props10.currentSubtitleObj,
937
+ markers = _this$props10.markers,
938
+ playerType = _this$props10.playerType;
923
939
  if (markers && markers !== newProps.markers && newProps.markers) {
924
940
  this.displaySubtitle(newProps.markers);
925
941
  }
926
942
  if (newProps.src !== src || newProps.dubbedTracks !== dubbedTracks || newProps.additionalTracks !== additionalTracks) {
927
943
  var isM3U8 = this.state.isM3U8;
944
+ var oldCombinedUrl = this.combinedManifestUrl;
928
945
  if (_hls["default"].isSupported() && isM3U8) {
929
946
  if (this.hls) {
930
947
  this.hls.detachMedia();
931
948
  this.hls.destroy();
949
+ this.hls = null;
932
950
  }
933
951
  } else if (this.video) {
934
952
  this.video.src = '';
935
953
  }
936
- if (this.combinedManifestUrl) {
937
- URL.revokeObjectURL(this.combinedManifestUrl);
938
- this.combinedManifestUrl = null;
939
- }
940
954
  this.dubbedTrackInfo = [];
941
955
  this.additionalTrackInfo = [];
956
+ if (oldCombinedUrl) {
957
+ try {
958
+ URL.revokeObjectURL(oldCombinedUrl);
959
+ } catch (e) {
960
+ console.warn('Error revoking blob URL:', e);
961
+ }
962
+ this.combinedManifestUrl = null;
963
+ }
942
964
  var m3u8 = newProps.src.split('.').pop() === 'm3u8';
943
965
  this.setState({
944
966
  isM3U8: m3u8
@@ -1089,9 +1111,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1089
1111
  }, {
1090
1112
  key: "toggleFullscreen",
1091
1113
  value: function toggleFullscreen() {
1092
- var _this$props10 = this.props,
1093
- player = _this$props10.player,
1094
- actions = _this$props10.actions;
1114
+ var _this$props11 = this.props,
1115
+ player = _this$props11.player,
1116
+ actions = _this$props11.actions;
1095
1117
  actions.toggleFullscreen(player);
1096
1118
  }
1097
1119
 
@@ -1102,10 +1124,10 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1102
1124
  }, {
1103
1125
  key: "handleLoadStart",
1104
1126
  value: function handleLoadStart() {
1105
- var _this$props11 = this.props,
1106
- actions = _this$props11.actions,
1107
- onLoadStart = _this$props11.onLoadStart,
1108
- fileType = _this$props11.fileType;
1127
+ var _this$props12 = this.props,
1128
+ actions = _this$props12.actions,
1129
+ onLoadStart = _this$props12.onLoadStart,
1130
+ fileType = _this$props12.fileType;
1109
1131
  if (fileType === 'audio') {
1110
1132
  this.audioVisualizer();
1111
1133
  }
@@ -1122,9 +1144,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1122
1144
  }, {
1123
1145
  key: "handleCanPlay",
1124
1146
  value: function handleCanPlay() {
1125
- var _this$props12 = this.props,
1126
- actions = _this$props12.actions,
1127
- onCanPlay = _this$props12.onCanPlay;
1147
+ var _this$props13 = this.props,
1148
+ actions = _this$props13.actions,
1149
+ onCanPlay = _this$props13.onCanPlay;
1128
1150
  actions.handleCanPlay(this.getProperties());
1129
1151
  if (onCanPlay) {
1130
1152
  onCanPlay.apply(void 0, arguments);
@@ -1138,9 +1160,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1138
1160
  }, {
1139
1161
  key: "handleCanPlayThrough",
1140
1162
  value: function handleCanPlayThrough() {
1141
- var _this$props13 = this.props,
1142
- actions = _this$props13.actions,
1143
- onCanPlayThrough = _this$props13.onCanPlayThrough;
1163
+ var _this$props14 = this.props,
1164
+ actions = _this$props14.actions,
1165
+ onCanPlayThrough = _this$props14.onCanPlayThrough;
1144
1166
  actions.handleCanPlayThrough(this.getProperties());
1145
1167
  if (onCanPlayThrough) {
1146
1168
  onCanPlayThrough.apply(void 0, arguments);
@@ -1154,9 +1176,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1154
1176
  }, {
1155
1177
  key: "handlePlaying",
1156
1178
  value: function handlePlaying() {
1157
- var _this$props14 = this.props,
1158
- actions = _this$props14.actions,
1159
- onPlaying = _this$props14.onPlaying;
1179
+ var _this$props15 = this.props,
1180
+ actions = _this$props15.actions,
1181
+ onPlaying = _this$props15.onPlaying;
1160
1182
  actions.handlePlaying(this.getProperties());
1161
1183
  if (onPlaying) {
1162
1184
  onPlaying.apply(void 0, arguments);
@@ -1167,9 +1189,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1167
1189
  }, {
1168
1190
  key: "handlePlay",
1169
1191
  value: function handlePlay() {
1170
- var _this$props15 = this.props,
1171
- actions = _this$props15.actions,
1172
- onPlay = _this$props15.onPlay;
1192
+ var _this$props16 = this.props,
1193
+ actions = _this$props16.actions,
1194
+ onPlay = _this$props16.onPlay;
1173
1195
  actions.handlePlay(this.getProperties());
1174
1196
  if (onPlay) {
1175
1197
  onPlay.apply(void 0, arguments);
@@ -1180,9 +1202,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1180
1202
  }, {
1181
1203
  key: "handlePause",
1182
1204
  value: function handlePause() {
1183
- var _this$props16 = this.props,
1184
- actions = _this$props16.actions,
1185
- onPause = _this$props16.onPause;
1205
+ var _this$props17 = this.props,
1206
+ actions = _this$props17.actions,
1207
+ onPause = _this$props17.onPause;
1186
1208
  actions.handlePause(this.getProperties());
1187
1209
  if (onPause) {
1188
1210
  onPause.apply(void 0, arguments);
@@ -1196,9 +1218,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1196
1218
  }, {
1197
1219
  key: "handleDurationChange",
1198
1220
  value: function handleDurationChange() {
1199
- var _this$props17 = this.props,
1200
- actions = _this$props17.actions,
1201
- onDurationChange = _this$props17.onDurationChange;
1221
+ var _this$props18 = this.props,
1222
+ actions = _this$props18.actions,
1223
+ onDurationChange = _this$props18.onDurationChange;
1202
1224
  actions.handleDurationChange(this.getProperties());
1203
1225
  if (onDurationChange) {
1204
1226
  onDurationChange.apply(void 0, arguments);
@@ -1212,9 +1234,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1212
1234
  }, {
1213
1235
  key: "handleProgress",
1214
1236
  value: function handleProgress() {
1215
- var _this$props18 = this.props,
1216
- actions = _this$props18.actions,
1217
- onProgress = _this$props18.onProgress;
1237
+ var _this$props19 = this.props,
1238
+ actions = _this$props19.actions,
1239
+ onProgress = _this$props19.onProgress;
1218
1240
  if (this.video) {
1219
1241
  actions.handleProgressChange(this.getProperties());
1220
1242
  }
@@ -1235,11 +1257,11 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1235
1257
  }, {
1236
1258
  key: "displaySubtitle",
1237
1259
  value: function displaySubtitle(marker) {
1238
- var _this$props19 = this.props,
1239
- markers = _this$props19.markers,
1240
- resetSubtitleData = _this$props19.resetSubtitleData,
1241
- subtitleReadOnly = _this$props19.subtitleReadOnly,
1242
- subtitleDataList = _this$props19.subtitleDataList;
1260
+ var _this$props20 = this.props,
1261
+ markers = _this$props20.markers,
1262
+ resetSubtitleData = _this$props20.resetSubtitleData,
1263
+ subtitleReadOnly = _this$props20.subtitleReadOnly,
1264
+ subtitleDataList = _this$props20.subtitleDataList;
1243
1265
  var currentSubtitleObj = this.state.currentSubtitleObj;
1244
1266
  if (resetSubtitleData) {
1245
1267
  resetSubtitleData();
@@ -1281,11 +1303,11 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1281
1303
  }, {
1282
1304
  key: "handleEnded",
1283
1305
  value: function handleEnded() {
1284
- var _this$props20 = this.props,
1285
- loop = _this$props20.loop,
1286
- player = _this$props20.player,
1287
- actions = _this$props20.actions,
1288
- onEnded = _this$props20.onEnded;
1306
+ var _this$props21 = this.props,
1307
+ loop = _this$props21.loop,
1308
+ player = _this$props21.player,
1309
+ actions = _this$props21.actions,
1310
+ onEnded = _this$props21.onEnded;
1289
1311
  if (loop) {
1290
1312
  this.seek(0);
1291
1313
  this.play();
@@ -1302,9 +1324,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1302
1324
  }, {
1303
1325
  key: "handleWaiting",
1304
1326
  value: function handleWaiting() {
1305
- var _this$props21 = this.props,
1306
- actions = _this$props21.actions,
1307
- onWaiting = _this$props21.onWaiting;
1327
+ var _this$props22 = this.props,
1328
+ actions = _this$props22.actions,
1329
+ onWaiting = _this$props22.onWaiting;
1308
1330
  actions.handleWaiting(this.getProperties());
1309
1331
  if (onWaiting) {
1310
1332
  onWaiting.apply(void 0, arguments);
@@ -1318,9 +1340,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1318
1340
  }, {
1319
1341
  key: "handleSeeking",
1320
1342
  value: function handleSeeking() {
1321
- var _this$props22 = this.props,
1322
- actions = _this$props22.actions,
1323
- onSeeking = _this$props22.onSeeking;
1343
+ var _this$props23 = this.props,
1344
+ actions = _this$props23.actions,
1345
+ onSeeking = _this$props23.onSeeking;
1324
1346
  actions.handleSeeking(this.getProperties());
1325
1347
  if (onSeeking) {
1326
1348
  onSeeking.apply(void 0, arguments);
@@ -1334,9 +1356,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1334
1356
  }, {
1335
1357
  key: "handleSeeked",
1336
1358
  value: function handleSeeked() {
1337
- var _this$props23 = this.props,
1338
- actions = _this$props23.actions,
1339
- onSeeked = _this$props23.onSeeked;
1359
+ var _this$props24 = this.props,
1360
+ actions = _this$props24.actions,
1361
+ onSeeked = _this$props24.onSeeked;
1340
1362
  actions.handleSeeked(this.getProperties());
1341
1363
  if (onSeeked) {
1342
1364
  onSeeked.apply(void 0, arguments);
@@ -1355,9 +1377,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1355
1377
  }, {
1356
1378
  key: "handleSuspend",
1357
1379
  value: function handleSuspend() {
1358
- var _this$props24 = this.props,
1359
- actions = _this$props24.actions,
1360
- onSuspend = _this$props24.onSuspend;
1380
+ var _this$props25 = this.props,
1381
+ actions = _this$props25.actions,
1382
+ onSuspend = _this$props25.onSuspend;
1361
1383
  actions.handleSuspend(this.getProperties());
1362
1384
  if (onSuspend) {
1363
1385
  onSuspend.apply(void 0, arguments);
@@ -1368,9 +1390,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1368
1390
  }, {
1369
1391
  key: "handleAbort",
1370
1392
  value: function handleAbort() {
1371
- var _this$props25 = this.props,
1372
- actions = _this$props25.actions,
1373
- onAbort = _this$props25.onAbort;
1393
+ var _this$props26 = this.props,
1394
+ actions = _this$props26.actions,
1395
+ onAbort = _this$props26.onAbort;
1374
1396
  actions.handleAbort(this.getProperties());
1375
1397
  if (onAbort) {
1376
1398
  onAbort.apply(void 0, arguments);
@@ -1381,9 +1403,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1381
1403
  }, {
1382
1404
  key: "handleEmptied",
1383
1405
  value: function handleEmptied() {
1384
- var _this$props26 = this.props,
1385
- actions = _this$props26.actions,
1386
- onEmptied = _this$props26.onEmptied;
1406
+ var _this$props27 = this.props,
1407
+ actions = _this$props27.actions,
1408
+ onEmptied = _this$props27.onEmptied;
1387
1409
  actions.handleEmptied(this.getProperties());
1388
1410
  if (onEmptied) {
1389
1411
  onEmptied.apply(void 0, arguments);
@@ -1397,9 +1419,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1397
1419
  }, {
1398
1420
  key: "handleStalled",
1399
1421
  value: function handleStalled() {
1400
- var _this$props27 = this.props,
1401
- actions = _this$props27.actions,
1402
- onStalled = _this$props27.onStalled;
1422
+ var _this$props28 = this.props,
1423
+ actions = _this$props28.actions,
1424
+ onStalled = _this$props28.onStalled;
1403
1425
  actions.handleStalled(this.getProperties());
1404
1426
  if (onStalled) {
1405
1427
  onStalled.apply(void 0, arguments);
@@ -1413,10 +1435,10 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1413
1435
  }, {
1414
1436
  key: "handleLoadedMetaData",
1415
1437
  value: function handleLoadedMetaData() {
1416
- var _this$props28 = this.props,
1417
- actions = _this$props28.actions,
1418
- onLoadedMetadata = _this$props28.onLoadedMetadata,
1419
- startTime = _this$props28.startTime;
1438
+ var _this$props29 = this.props,
1439
+ actions = _this$props29.actions,
1440
+ onLoadedMetadata = _this$props29.onLoadedMetadata,
1441
+ startTime = _this$props29.startTime;
1420
1442
  if (startTime && startTime > 0) {
1421
1443
  this.video.currentTime = startTime;
1422
1444
  }
@@ -1433,9 +1455,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1433
1455
  }, {
1434
1456
  key: "handleLoadedData",
1435
1457
  value: function handleLoadedData() {
1436
- var _this$props29 = this.props,
1437
- actions = _this$props29.actions,
1438
- onLoadedData = _this$props29.onLoadedData;
1458
+ var _this$props30 = this.props,
1459
+ actions = _this$props30.actions,
1460
+ onLoadedData = _this$props30.onLoadedData;
1439
1461
  actions.handleLoadedData(this.getProperties());
1440
1462
  if (onLoadedData) {
1441
1463
  onLoadedData.apply(void 0, arguments);
@@ -1449,11 +1471,11 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1449
1471
  }, {
1450
1472
  key: "handleTimeUpdate",
1451
1473
  value: function handleTimeUpdate() {
1452
- var _this$props30 = this.props,
1453
- previewActive = _this$props30.player.previewActive,
1454
- actions = _this$props30.actions,
1455
- onTimeUpdate = _this$props30.onTimeUpdate,
1456
- rightMarker = _this$props30.playerSelectedMarker.rightMarker;
1474
+ var _this$props31 = this.props,
1475
+ previewActive = _this$props31.player.previewActive,
1476
+ actions = _this$props31.actions,
1477
+ onTimeUpdate = _this$props31.onTimeUpdate,
1478
+ rightMarker = _this$props31.playerSelectedMarker.rightMarker;
1457
1479
 
1458
1480
  //for annotation time updataton for svg
1459
1481
  var _this$getTimeData3 = this.getTimeData(this.video.currentTime),
@@ -1481,9 +1503,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1481
1503
  }, {
1482
1504
  key: "handleRateChange",
1483
1505
  value: function handleRateChange() {
1484
- var _this$props31 = this.props,
1485
- actions = _this$props31.actions,
1486
- onRateChange = _this$props31.onRateChange;
1506
+ var _this$props32 = this.props,
1507
+ actions = _this$props32.actions,
1508
+ onRateChange = _this$props32.onRateChange;
1487
1509
  actions.handleRateChange(this.getProperties());
1488
1510
  if (onRateChange) {
1489
1511
  onRateChange.apply(void 0, arguments);
@@ -1494,9 +1516,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1494
1516
  }, {
1495
1517
  key: "handleVolumeChange",
1496
1518
  value: function handleVolumeChange() {
1497
- var _this$props32 = this.props,
1498
- actions = _this$props32.actions,
1499
- onVolumeChange = _this$props32.onVolumeChange;
1519
+ var _this$props33 = this.props,
1520
+ actions = _this$props33.actions,
1521
+ onVolumeChange = _this$props33.onVolumeChange;
1500
1522
  actions.handleVolumeChange(this.getProperties());
1501
1523
  if (onVolumeChange) {
1502
1524
  onVolumeChange.apply(void 0, arguments);
@@ -1510,9 +1532,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1510
1532
  }, {
1511
1533
  key: "handleError",
1512
1534
  value: function handleError() {
1513
- var _this$props33 = this.props,
1514
- actions = _this$props33.actions,
1515
- onError = _this$props33.onError;
1535
+ var _this$props34 = this.props,
1536
+ actions = _this$props34.actions,
1537
+ onError = _this$props34.onError;
1516
1538
  actions.handleError(this.getProperties());
1517
1539
  if (onError) {
1518
1540
  onError.apply(void 0, arguments);
@@ -1541,10 +1563,10 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1541
1563
  }, {
1542
1564
  key: "calculateHeightBasedOnResolution",
1543
1565
  value: function calculateHeightBasedOnResolution() {
1544
- var _this$props34 = this.props,
1545
- player = _this$props34.player,
1546
- isRightMenuVisible = _this$props34.isRightMenuVisible,
1547
- heightRatio = _this$props34.heightRatio;
1566
+ var _this$props35 = this.props,
1567
+ player = _this$props35.player,
1568
+ isRightMenuVisible = _this$props35.isRightMenuVisible,
1569
+ heightRatio = _this$props35.heightRatio;
1548
1570
  var ratio = typeof heightRatio === 'number' ? heightRatio : 1;
1549
1571
  if (!(player !== null && player !== void 0 && player.isFullscreen) || !isRightMenuVisible) {
1550
1572
  if (this.state.calculatedHeight !== null) {
@@ -1674,9 +1696,9 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1674
1696
  }, {
1675
1697
  key: "handleSubtitleContainerClick",
1676
1698
  value: function handleSubtitleContainerClick() {
1677
- var _this$props35 = this.props,
1678
- actions = _this$props35.actions,
1679
- player = _this$props35.player;
1699
+ var _this$props36 = this.props,
1700
+ actions = _this$props36.actions,
1701
+ player = _this$props36.player;
1680
1702
  if (player.paused) {
1681
1703
  actions.play();
1682
1704
  } else {
@@ -1686,11 +1708,11 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1686
1708
  }, {
1687
1709
  key: "handleSubtitleClick",
1688
1710
  value: function handleSubtitleClick(e) {
1689
- var _this$props36 = this.props,
1690
- actions = _this$props36.actions,
1691
- player = _this$props36.player,
1692
- onScreenSubtitleClick = _this$props36.onScreenSubtitleClick,
1693
- controlType = _this$props36.controlType;
1711
+ var _this$props37 = this.props,
1712
+ actions = _this$props37.actions,
1713
+ player = _this$props37.player,
1714
+ onScreenSubtitleClick = _this$props37.onScreenSubtitleClick,
1715
+ controlType = _this$props37.controlType;
1694
1716
  var currentSubtitleObj = this.state.currentSubtitleObj;
1695
1717
  if (controlType === 'advanced') {
1696
1718
  if (onScreenSubtitleClick) {
@@ -1715,22 +1737,22 @@ var Video = exports["default"] = /*#__PURE__*/function (_Component) {
1715
1737
  _this$props$parentAnn2,
1716
1738
  _this$props$parentAnn3,
1717
1739
  _this$props$parentAnn4;
1718
- var _this$props37 = this.props,
1719
- loop = _this$props37.loop,
1720
- poster = _this$props37.poster,
1721
- preload = _this$props37.preload,
1722
- autoPlay = _this$props37.autoPlay,
1723
- playsInline = _this$props37.playsInline,
1724
- muted = _this$props37.muted,
1725
- crossOrigin = _this$props37.crossOrigin,
1726
- videoId = _this$props37.videoId,
1727
- fileType = _this$props37.fileType,
1728
- userEmail = _this$props37.userEmail,
1729
- theme = _this$props37.theme,
1730
- player = _this$props37.player,
1731
- playerType = _this$props37.playerType,
1732
- markers = _this$props37.markers,
1733
- isRightMenuVisible = _this$props37.isRightMenuVisible;
1740
+ var _this$props38 = this.props,
1741
+ loop = _this$props38.loop,
1742
+ poster = _this$props38.poster,
1743
+ preload = _this$props38.preload,
1744
+ autoPlay = _this$props38.autoPlay,
1745
+ playsInline = _this$props38.playsInline,
1746
+ muted = _this$props38.muted,
1747
+ crossOrigin = _this$props38.crossOrigin,
1748
+ videoId = _this$props38.videoId,
1749
+ fileType = _this$props38.fileType,
1750
+ userEmail = _this$props38.userEmail,
1751
+ theme = _this$props38.theme,
1752
+ player = _this$props38.player,
1753
+ playerType = _this$props38.playerType,
1754
+ markers = _this$props38.markers,
1755
+ isRightMenuVisible = _this$props38.isRightMenuVisible;
1734
1756
  var _this$state2 = this.state,
1735
1757
  isBuffering = _this$state2.isBuffering,
1736
1758
  watermark = _this$state2.watermark,
@@ -109,9 +109,67 @@ var AudioTracksMenuButton = /*#__PURE__*/function (_Component) {
109
109
  }, {
110
110
  key: "ensureValidAudioTrack",
111
111
  value: function ensureValidAudioTrack() {
112
- var player = this.props.player;
112
+ var _this$props = this.props,
113
+ player = _this$props.player,
114
+ additionalTrackQuality = _this$props.additionalTrackQuality;
113
115
  var allTracks = player.audioTracksArr || [];
114
- if (allTracks.length === 0) return;
116
+ var activeAudio = player.activeAudio;
117
+ if (allTracks.length === 0 || !activeAudio) {
118
+ var dubbedTracks = allTracks.filter(function (track) {
119
+ return track.isDubbedTrack === true;
120
+ });
121
+ if (dubbedTracks.length) {
122
+ this.setState({
123
+ openAccordion: 'dubbed'
124
+ });
125
+ } else {
126
+ this.setState({
127
+ openAccordion: 'original'
128
+ });
129
+ }
130
+ return;
131
+ }
132
+ var hasDubbed = allTracks.some(function (track) {
133
+ return track.isDubbedTrack === true;
134
+ });
135
+ var hasOriginal = allTracks.some(function (track) {
136
+ return !track.isDubbedTrack && !track.isAdditionalTrack;
137
+ });
138
+ var hasAdditional = allTracks.some(function (track) {
139
+ return track.isAdditionalTrack === true;
140
+ });
141
+ var categoriesPresent = [hasDubbed, hasOriginal, hasAdditional].filter(Boolean).length;
142
+ if (categoriesPresent === 1) {
143
+ if (hasDubbed) {
144
+ this.setState({
145
+ openAccordion: 'dubbed'
146
+ });
147
+ } else if (hasAdditional) {
148
+ this.setState({
149
+ openAccordion: additionalTrackQuality || 'additional'
150
+ });
151
+ } else if (hasOriginal) {
152
+ this.setState({
153
+ openAccordion: 'original'
154
+ });
155
+ }
156
+ return;
157
+ }
158
+ var isDubbed = activeAudio.isDubbedTrack === true;
159
+ var isAdditional = activeAudio.isAdditionalTrack === true;
160
+ if (isDubbed) {
161
+ this.setState({
162
+ openAccordion: 'dubbed'
163
+ });
164
+ } else if (isAdditional) {
165
+ this.setState({
166
+ openAccordion: additionalTrackQuality || 'additional'
167
+ });
168
+ } else {
169
+ this.setState({
170
+ openAccordion: 'original'
171
+ });
172
+ }
115
173
  }
116
174
  }, {
117
175
  key: "changeTrack",
@@ -124,12 +182,12 @@ var AudioTracksMenuButton = /*#__PURE__*/function (_Component) {
124
182
  value: function render() {
125
183
  var _player$activeAudio,
126
184
  _this2 = this;
127
- var _this$props = this.props,
128
- player = _this$props.player,
129
- actions = _this$props.actions,
130
- theme = _this$props.theme,
131
- activeVersion = _this$props.activeVersion,
132
- additionalTrackQuality = _this$props.additionalTrackQuality;
185
+ var _this$props2 = this.props,
186
+ player = _this$props2.player,
187
+ actions = _this$props2.actions,
188
+ theme = _this$props2.theme,
189
+ activeVersion = _this$props2.activeVersion,
190
+ additionalTrackQuality = _this$props2.additionalTrackQuality;
133
191
  var openAccordion = this.state.openAccordion;
134
192
  var allTracks = player.audioTracksArr || [];
135
193
  var originalTracks = allTracks.filter(function (track) {
@@ -159,19 +217,19 @@ var AudioTracksMenuButton = /*#__PURE__*/function (_Component) {
159
217
  position: "left"
160
218
  }, /*#__PURE__*/_react["default"].createElement("div", {
161
219
  className: "menu-container"
162
- }, (hasDubbedTracks || hasAdditionalTracks) && /*#__PURE__*/_react["default"].createElement(NowPlayingContainer, null, /*#__PURE__*/_react["default"].createElement(NowPlayingLabel, null, "Now playing"), /*#__PURE__*/_react["default"].createElement(NowPlayingTrackName, {
220
+ }, (hasDubbedTracks || hasAdditionalTracks || hasOriginalTracks) && /*#__PURE__*/_react["default"].createElement(NowPlayingContainer, null, /*#__PURE__*/_react["default"].createElement(NowPlayingLabel, null, "Now playing"), /*#__PURE__*/_react["default"].createElement(NowPlayingTrackName, {
163
221
  theme: theme
164
- }, currentTrackName)), hasDubbedTracks && /*#__PURE__*/_react["default"].createElement(AccordionContainer, null, /*#__PURE__*/_react["default"].createElement(AccordionHeader, {
222
+ }, currentTrackName)), hasAdditionalTracks && /*#__PURE__*/_react["default"].createElement(AccordionContainer, null, /*#__PURE__*/_react["default"].createElement(AccordionHeader, {
165
223
  theme: theme,
166
- onClick: this.toggleDubbedAccordion
167
- }, /*#__PURE__*/_react["default"].createElement(HeaderTitle, null, "Dubbed tracks"), /*#__PURE__*/_react["default"].createElement(HeaderIcon, {
168
- isOpen: openAccordion === 'dubbed'
224
+ onClick: this.toggleAdditionalAccordion
225
+ }, /*#__PURE__*/_react["default"].createElement(HeaderTitle, null, activeVersion.category, " ", additionalTrackQuality), /*#__PURE__*/_react["default"].createElement(HeaderIcon, {
226
+ isOpen: openAccordion === additionalTrackQuality
169
227
  }, /*#__PURE__*/_react["default"].createElement(_components.Icon, {
170
228
  color: "#999999",
171
229
  name: "dropdown_more_icon"
172
230
  }))), /*#__PURE__*/_react["default"].createElement(AccordionContent, {
173
- isOpen: openAccordion === 'dubbed'
174
- }, dubbedTracks.map(function (track, index) {
231
+ isOpen: openAccordion === additionalTrackQuality
232
+ }, additionalTrack.map(function (track, index) {
175
233
  return /*#__PURE__*/_react["default"].createElement(AudioTrackBlock, {
176
234
  theme: theme,
177
235
  onClick: function onClick() {
@@ -189,18 +247,18 @@ var AudioTracksMenuButton = /*#__PURE__*/function (_Component) {
189
247
  } : {
190
248
  color: '#333333'
191
249
  }
192
- }, track.name || "Dubbed Track ".concat(index + 1)));
193
- }))), hasAdditionalTracks && /*#__PURE__*/_react["default"].createElement(AccordionContainer, null, /*#__PURE__*/_react["default"].createElement(AccordionHeader, {
250
+ }, track.name || "Track ".concat(index + 1)));
251
+ }))), hasDubbedTracks && /*#__PURE__*/_react["default"].createElement(AccordionContainer, null, /*#__PURE__*/_react["default"].createElement(AccordionHeader, {
194
252
  theme: theme,
195
- onClick: this.toggleAdditionalAccordion
196
- }, /*#__PURE__*/_react["default"].createElement(HeaderTitle, null, activeVersion.category, " ", additionalTrackQuality), /*#__PURE__*/_react["default"].createElement(HeaderIcon, {
197
- isOpen: openAccordion === additionalTrackQuality
253
+ onClick: this.toggleDubbedAccordion
254
+ }, /*#__PURE__*/_react["default"].createElement(HeaderTitle, null, "Dubbed tracks"), /*#__PURE__*/_react["default"].createElement(HeaderIcon, {
255
+ isOpen: openAccordion === 'dubbed'
198
256
  }, /*#__PURE__*/_react["default"].createElement(_components.Icon, {
199
257
  color: "#999999",
200
258
  name: "dropdown_more_icon"
201
259
  }))), /*#__PURE__*/_react["default"].createElement(AccordionContent, {
202
- isOpen: openAccordion === additionalTrackQuality
203
- }, additionalTrack.map(function (track, index) {
260
+ isOpen: openAccordion === 'dubbed'
261
+ }, dubbedTracks.map(function (track, index) {
204
262
  return /*#__PURE__*/_react["default"].createElement(AudioTrackBlock, {
205
263
  theme: theme,
206
264
  onClick: function onClick() {
@@ -218,7 +276,7 @@ var AudioTracksMenuButton = /*#__PURE__*/function (_Component) {
218
276
  } : {
219
277
  color: '#333333'
220
278
  }
221
- }, track.name || "Track ".concat(index + 1)));
279
+ }, track.name || "Dubbed Track ".concat(index + 1)));
222
280
  }))), hasOriginalTracks && /*#__PURE__*/_react["default"].createElement(AccordionContainer, null, (hasDubbedTracks || hasAdditionalTracks) && /*#__PURE__*/_react["default"].createElement(AccordionHeader, {
223
281
  theme: theme,
224
282
  onClick: this.toggleOriginalAccordion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@desynova-digital/player",
3
- "version": "4.2.2",
3
+ "version": "4.2.3",
4
4
  "description": "Video Player Package for Contido Application",
5
5
  "main": "index.js",
6
6
  "scripts": {