mirador-annotation-editor-video 0.0.43 → 0.0.44

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.
@@ -10,10 +10,12 @@ var _canvases = require("mirador/dist/es/src/state/selectors/canvases");
10
10
  var _annotations = require("mirador/dist/es/src/state/selectors/annotations");
11
11
  var _AnnotationForm = _interopRequireDefault(require("mirador-annotations/src/annotationForm/AnnotationForm"));
12
12
  var _playerReferences = require("mirador-annotations/src/playerReferences");
13
+ var _AnnotationFormUtils = require("mirador-annotations/es/annotationForm/AnnotationFormUtils");
13
14
  var _OSDReferences = require("mirador/dist/es/src/plugins/OSDReferences");
14
15
  var _VideosReferences = require("mirador/dist/es/src/plugins/VideosReferences");
15
16
  var _reactI18next = require("react-i18next");
16
17
  var _locales = _interopRequireDefault(require("../locales"));
18
+ var _playerReferences2 = require("mirador-annotations/es/playerReferences");
17
19
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
19
21
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -44,16 +46,15 @@ function mapStateToProps(state, {
44
46
  const canvases = (0, _canvases.getVisibleCanvases)(state, {
45
47
  windowId
46
48
  });
47
- const videoResources = (0, _canvases.getVisibleCanvasVideoResources)(state, {
48
- windowId
49
- });
50
- // TODO add check on audioResources getVisibleCanvasAudioResources
51
-
52
- if (videoResources && videoResources.length > 0) {
53
- _playerReferences.playerReferences.init(state, windowId, _VideosReferences.VideosReferences, actions);
54
- } else {
55
- _playerReferences.playerReferences.init(state, windowId, _OSDReferences.OSDReferences, actions);
49
+ const mediaTypes = (0, _playerReferences.checkMediaType)(state, windowId);
50
+ let playerReferences;
51
+ if (mediaTypes === _AnnotationFormUtils.MEDIA_TYPES.IMAGE) {
52
+ playerReferences = new _playerReferences2.WindowPlayer(state, windowId, _OSDReferences.OSDReferences.get(windowId), actions);
53
+ }
54
+ if (mediaTypes === _AnnotationFormUtils.MEDIA_TYPES.VIDEO || mediaTypes === _AnnotationFormUtils.MEDIA_TYPES.AUDIO) {
55
+ playerReferences = new _playerReferences2.WindowPlayer(state, windowId, _VideosReferences.VideosReferences.get(windowId), actions);
56
56
  }
57
+
57
58
  // This could be removed but it's serve the useEffect in AnnotationForm for now.
58
59
  let annotation = (0, _annotations.getPresentAnnotationsOnSelectedCanvases)(state, {
59
60
  windowId
@@ -69,16 +70,14 @@ function mapStateToProps(state, {
69
70
  };
70
71
  }
71
72
  return {
72
- currentTime,
73
73
  annotation,
74
74
  canvases,
75
75
  config: {
76
76
  ...state.config,
77
77
  translations: _locales.default
78
78
  },
79
- getMediaAudio: (0, _canvases.getVisibleCanvasAudioResources)(state, {
80
- windowId
81
- })
79
+ currentTime,
80
+ playerReferences
82
81
  };
83
82
  }
84
83
  const AnnotationFormWithTranslation = (0, _reactI18next.withTranslation)()(_AnnotationForm.default);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mirador-annotation-editor-video",
3
- "version": "0.0.43",
3
+ "version": "0.0.44",
4
4
  "description": "Mirador 4 plugin wrapping Mirador Annotation Editor plugin and adding video annotation support",
5
5
  "main": "es/index.js",
6
6
  "module": "es/index.js",
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "@mui/icons-material": "^5.11.16",
26
26
  "mirador": "npm:mirador-video@1.0.14",
27
- "mirador-annotations": "npm:mirador-annotation-editor@1.0.68",
27
+ "mirador-annotations": "npm:mirador-annotation-editor@1.0.72",
28
28
  "react-i18next": "^15.4.0"
29
29
  },
30
30
  "peerDependencies": {
@@ -1,17 +1,17 @@
1
1
  import * as actions from 'mirador/dist/es/src/state/actions';
2
2
  import { getCompanionWindow } from 'mirador/dist/es/src/state/selectors/companionWindows';
3
3
  import {
4
- getVisibleCanvasAudioResources,
5
4
  getVisibleCanvases,
6
- getVisibleCanvasVideoResources
7
5
  } from 'mirador/dist/es/src/state/selectors/canvases';
8
6
  import { getPresentAnnotationsOnSelectedCanvases } from 'mirador/dist/es/src/state/selectors/annotations';
9
7
  import annotationForm from 'mirador-annotations/src/annotationForm/AnnotationForm';
10
- import { playerReferences } from 'mirador-annotations/src/playerReferences';
8
+ import { checkMediaType } from 'mirador-annotations/src/playerReferences'
9
+ import { MEDIA_TYPES} from "mirador-annotations/es/annotationForm/AnnotationFormUtils";
11
10
  import { OSDReferences } from 'mirador/dist/es/src/plugins/OSDReferences';
12
11
  import {VideosReferences} from "mirador/dist/es/src/plugins/VideosReferences";
13
12
  import { withTranslation } from 'react-i18next';
14
13
  import translations from '../locales';
14
+ import {WindowPlayer} from "mirador-annotations/es/playerReferences";
15
15
 
16
16
  /** */
17
17
  const mapDispatchToProps = (dispatch, { id, windowId }) => ({
@@ -32,14 +32,17 @@ function mapStateToProps(state, { id: companionWindowId, windowId }) {
32
32
  const { annotationid } = cw;
33
33
  const canvases = getVisibleCanvases(state, { windowId });
34
34
 
35
- const videoResources = getVisibleCanvasVideoResources(state, { windowId });
36
- // TODO add check on audioResources getVisibleCanvasAudioResources
35
+ const mediaTypes = checkMediaType(state, windowId);
36
+
37
+ let playerReferences;
38
+
39
+ if(mediaTypes === MEDIA_TYPES.IMAGE) {
40
+ playerReferences = new WindowPlayer(state, windowId,OSDReferences.get(windowId), actions);
41
+ }
42
+ if(mediaTypes === MEDIA_TYPES.VIDEO || mediaTypes === MEDIA_TYPES.AUDIO) {
43
+ playerReferences = new WindowPlayer(state, windowId,VideosReferences.get(windowId), actions);
44
+ }
37
45
 
38
- if(videoResources && videoResources.length > 0){
39
- playerReferences.init(state, windowId,VideosReferences, actions);
40
- }else{
41
- playerReferences.init(state, windowId,OSDReferences, actions);
42
- }
43
46
  // This could be removed but it's serve the useEffect in AnnotationForm for now.
44
47
  let annotation = getPresentAnnotationsOnSelectedCanvases(state, { windowId })
45
48
  .flatMap((annoPage) => annoPage.json.items || [])
@@ -56,11 +59,11 @@ function mapStateToProps(state, { id: companionWindowId, windowId }) {
56
59
  }
57
60
 
58
61
  return {
59
- currentTime,
60
62
  annotation,
61
63
  canvases,
62
64
  config: {...state.config, translations},
63
- getMediaAudio: getVisibleCanvasAudioResources(state, { windowId }),
65
+ currentTime,
66
+ playerReferences,
64
67
  };
65
68
  }
66
69