Skip to content
Snippets Groups Projects
Commit 298d2a2b authored by Anthony's avatar Anthony
Browse files

Merge annotation video into mui 5

parents afe3a3a6 6233d1d6
No related branches found
No related tags found
1 merge request!19Draft: Merge video support into mui5
Pipeline #1660 failed
......@@ -61,6 +61,7 @@ export function addWindow({ companionWindows, manifest, ...options }) {
}
const defaultOptions = {
autoScrollAnnotationList: true,
canvasId: undefined,
collectionIndex: 0,
companionAreaOpen: true,
......@@ -209,3 +210,69 @@ export function hideCollectionDialog(windowId) {
windowId,
};
}
/** */
export function setWindowCurrentTime(windowId, currentTime) {
return ((dispatch) => {
dispatch({
currentTime,
type: ActionTypes.SET_CURRENT_TIME,
windowId,
});
});
}
/** */
export function setWindowSeekTo(windowId, seekToTime) {
return ((dispatch) => {
dispatch({
seekToTime,
type: ActionTypes.SET_SEEK_TO_TIME,
windowId,
});
});
}
/** */
export function setWindowPaused(windowId, paused) {
return ((dispatch) => {
dispatch({
paused: (paused === undefined) ? true : paused,
type: ActionTypes.SET_VIDEO_PAUSED,
windowId,
});
});
}
/** */
export function setWindowMuted(windowId, muted) {
return ((dispatch) => {
dispatch({
muted: (muted === undefined) ? false : muted,
type: ActionTypes.SET_VIDEO_MUTED,
windowId,
});
});
}
/** */
export function setWindowTextTrackDisabled(windowId, disabled) {
return ((dispatch) => {
dispatch({
textTrackDisabled: (disabled === undefined) ? true : disabled,
type: ActionTypes.SET_VIDEO_TEXTTRACK_DISABLED,
windowId,
});
});
}
/** */
export function setWindowHasTextTrack(windowId, hasTextTrack) {
return ((dispatch) => {
dispatch({
hasTextTrack: (hasTextTrack === undefined) ? false : hasTextTrack,
type: ActionTypes.SET_VIDEO_HAS_TEXTTRACK,
windowId,
});
});
}
......@@ -140,6 +140,14 @@ export const windowsReducer = (state = {}, action) => {
highlightAllAnnotations: !state[action.windowId].highlightAllAnnotations,
},
};
case ActionTypes.TOGGLE_ANNOTATION_AUTOSCROLL:
return {
...state,
[action.windowId]: {
...state[action.windowId],
autoScrollAnnotationList: !state[action.windowId].autoScrollAnnotationList,
},
};
case ActionTypes.IMPORT_MIRADOR_STATE:
return action.state.windows || [];
case ActionTypes.REQUEST_SEARCH:
......@@ -168,6 +176,54 @@ export const windowsReducer = (state = {}, action) => {
collectionDialogOn: false,
},
};
case ActionTypes.SET_CURRENT_TIME:
return {
...state,
[action.windowId]: {
...state[action.windowId],
currentTime: action.currentTime,
},
};
case ActionTypes.SET_SEEK_TO_TIME:
return {
...state,
[action.windowId]: {
...state[action.windowId],
seekToTime: action.seekToTime,
},
};
case ActionTypes.SET_VIDEO_PAUSED:
return {
...state,
[action.windowId]: {
...state[action.windowId],
paused: !!action.paused,
},
};
case ActionTypes.SET_VIDEO_MUTED:
return {
...state,
[action.windowId]: {
...state[action.windowId],
muted: !!action.muted,
},
};
case ActionTypes.SET_VIDEO_TEXTTRACK_DISABLED:
return {
...state,
[action.windowId]: {
...state[action.windowId],
textTrackDisabled: !!action.textTrackDisabled,
},
};
case ActionTypes.SET_VIDEO_HAS_TEXTTRACK:
return {
...state,
[action.windowId]: {
...state[action.windowId],
hasTextTrack: !!action.hasTextTrack,
},
};
default:
return state;
}
......
......@@ -233,3 +233,15 @@ export const selectInfoResponse = createSelector(
&& infoResponses[iiifServiceId];
},
);
export const getCurrentCanvasDuration = createSelector(
[
getCurrentCanvas,
],
(canvas) => {
if (canvas && canvas.__jsonld && 'duration' in canvas.__jsonld) {
return canvas.__jsonld.duration;
}
return undefined;
},
);
......@@ -13,3 +13,4 @@ export * from './sequences';
export * from './auth';
export * from './utils';
export * from './viewer';
export * from './window';
......@@ -69,7 +69,10 @@ export const getSearchNumTotal = createSelector(
&& result.json
&& result.json.within
));
return resultWithWithin?.json?.within?.total;
if (resultWithWithin && resultWithWithin.json && resultWithWithin.json.within) {
return resultWithWithin.json.within.total;
}
return undefined;
},
);
......
import { createSelector } from 'reselect';
import { getWindow } from './getters';
export const getWindowCurrentTime = createSelector(
[
getWindow,
],
(window) => {
if (!window) return undefined;
return window.currentTime;
},
);
export const getWindowSeekToTime = createSelector(
[
getWindow,
],
(window) => {
if (!window) return undefined;
return window.seekToTime;
},
);
export const getWindowPausedStatus = createSelector(
[
getWindow,
],
(window) => {
if (!window) return undefined;
return window.paused;
},
);
export const getWindowMutedStatus = createSelector(
[
getWindow,
],
(window) => {
if (!window) return undefined;
return window.muted;
},
);
export const getWindowTextTrackDisabledStatus = createSelector(
[
getWindow,
],
(window) => {
if (!window) return undefined;
return window.textTrackDisabled;
},
);
export const getWindowHasTextTrack = createSelector(
[
getWindow,
],
(window) => {
if (!window) return undefined;
return window.hasTextTrack;
},
);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment