Skip to content
Snippets Groups Projects
Verified Commit 55350dc3 authored by Loïs Poujade's avatar Loïs Poujade
Browse files

Change video player reference

For a ref to video size/position, use AnnotationsOverlayVideo canvas instead
of video element
+ always show this overlay, even if there is no annotations to display
parent 8d142157
Branches
Tags
1 merge request!8Adapt API for edition of annotations on Video
Pipeline #1233 failed
...@@ -5,7 +5,7 @@ import SyncDisabledIcon from '@material-ui/icons/SyncDisabled'; ...@@ -5,7 +5,7 @@ import SyncDisabledIcon from '@material-ui/icons/SyncDisabled';
import VisibilityIcon from '@material-ui/icons/VisibilitySharp'; import VisibilityIcon from '@material-ui/icons/VisibilitySharp';
import VisibilityOffIcon from '@material-ui/icons/VisibilityOffSharp'; import VisibilityOffIcon from '@material-ui/icons/VisibilityOffSharp';
import MiradorMenuButton from '../containers/MiradorMenuButton'; import MiradorMenuButton from '../containers/MiradorMenuButton';
import { VideoViewersReferences } from '../plugins/VideoViewersReferences'; import { VideosReferences } from '../plugins/VideosReferences';
/** /**
* AnnotationSettings is a component to handle various annotation * AnnotationSettings is a component to handle various annotation
...@@ -21,7 +21,7 @@ export class AnnotationSettings extends Component { ...@@ -21,7 +21,7 @@ export class AnnotationSettings extends Component {
displayAll, displayAllDisabled, t, toggleAnnotationAutoScroll, toggleAnnotationDisplay, displayAll, displayAllDisabled, t, toggleAnnotationAutoScroll, toggleAnnotationDisplay,
} = this.props; } = this.props;
const mediaIsVideo = typeof VideoViewersReferences.get(windowId) !== 'undefined'; const mediaIsVideo = typeof VideosReferences.get(windowId) !== 'undefined';
return ( return (
<> <>
......
...@@ -10,6 +10,7 @@ import CircularProgress from '@material-ui/core/CircularProgress'; ...@@ -10,6 +10,7 @@ import CircularProgress from '@material-ui/core/CircularProgress';
import CanvasOverlayVideo from '../lib/CanvasOverlayVideo'; import CanvasOverlayVideo from '../lib/CanvasOverlayVideo';
import CanvasWorld from '../lib/CanvasWorld'; import CanvasWorld from '../lib/CanvasWorld';
import CanvasAnnotationDisplay from '../lib/CanvasAnnotationDisplay'; import CanvasAnnotationDisplay from '../lib/CanvasAnnotationDisplay';
import { VideosReferences } from '../plugins/VideosReferences';
/** AnnotationsOverlayVideo - based on AnnotationsOverlay */ /** AnnotationsOverlayVideo - based on AnnotationsOverlay */
export class AnnotationsOverlayVideo extends Component { export class AnnotationsOverlayVideo extends Component {
...@@ -64,6 +65,7 @@ export class AnnotationsOverlayVideo extends Component { ...@@ -64,6 +65,7 @@ export class AnnotationsOverlayVideo extends Component {
super(props); super(props);
this.ref = React.createRef(); this.ref = React.createRef();
VideosReferences.set(props.windowId, this);
this.canvasOverlay = null; this.canvasOverlay = null;
// An initial value for the updateCanvas method // An initial value for the updateCanvas method
this.updateCanvas = () => {}; this.updateCanvas = () => {};
...@@ -621,12 +623,8 @@ export class AnnotationsOverlayVideo extends Component { ...@@ -621,12 +623,8 @@ export class AnnotationsOverlayVideo extends Component {
* Renders things * Renders things
*/ */
render() { render() {
const { annotations, searchAnnotations } = this.props;
const { showProgress } = this.state; const { showProgress } = this.state;
const circularProgress = (<CircularProgress style={{ left: '50%', position: 'absolute', top: '50%' }} />); const circularProgress = (<CircularProgress style={{ left: '50%', position: 'absolute', top: '50%' }} />);
if (annotations.length === 0 && searchAnnotations.length === 0) {
return (<>{ showProgress && circularProgress }</>);
}
return ( return (
<> <>
<canvas ref={this.ref} style={{ left: 0, position: 'absolute', top: 0 }} /> <canvas ref={this.ref} style={{ left: 0, position: 'absolute', top: 0 }} />
......
...@@ -5,7 +5,6 @@ import PropTypes from 'prop-types'; ...@@ -5,7 +5,6 @@ import PropTypes from 'prop-types';
import AnnotationItem from '../lib/AnnotationItem'; import AnnotationItem from '../lib/AnnotationItem';
import AnnotationsOverlayVideo from '../containers/AnnotationsOverlayVideo'; import AnnotationsOverlayVideo from '../containers/AnnotationsOverlayVideo';
import WindowCanvasNavigationControlsVideo from '../containers/WindowCanvasNavigationControlsVideo'; import WindowCanvasNavigationControlsVideo from '../containers/WindowCanvasNavigationControlsVideo';
import { VideoViewersReferences } from '../plugins/VideoViewersReferences';
/** */ /** */
export class VideoViewer extends Component { export class VideoViewer extends Component {
...@@ -13,8 +12,6 @@ export class VideoViewer extends Component { ...@@ -13,8 +12,6 @@ export class VideoViewer extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.videoRef = React.createRef(); this.videoRef = React.createRef();
this.apiRef = React.createRef();
VideoViewersReferences.set(props.windowId, this);
this.state = { this.state = {
start: 0, start: 0,
...@@ -159,7 +156,7 @@ export class VideoViewer extends Component { ...@@ -159,7 +156,7 @@ export class VideoViewer extends Component {
}; };
} }
return ( return (
<div className={classes.flexContainer} ref={this.apiRef}> <div className={classes.flexContainer}>
<div className={classes.flexFill}> <div className={classes.flexFill}>
{ video && ( { video && (
<> <>
......
export const VideoViewersReferences = { export const VideosReferences = {
/** */ /** */
get(windowId) { get(windowId) {
return this.refs[windowId]; return this.refs[windowId];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment