* feat(local-video): convert to react - Create a VideoTrack component for displaying a video element. This mirrors native also having a VideoTrack component. - The VideoTrack component does not let React update it to prevent the video element from re-rendering, which could cause flickers and would not work with temasys's overriding of the video element. - VideoTrack extends AbstractVideoTrack to mirror native implementation and to get the dispatch of the onplaying event. - Remove the onclick handler on the video element. Honestly, I didn't get it to work, and did not try, but it is also unnecessary because another handler already exists on the video wrapper. * ref(device-selection): VideoInputPreview uses VideoTrack to show video * squash into conversion: change css selectors * squash into conversion: mix in abstract props * squash into conversion: change shouldComponentUpdate check * squash: update comment about why triggerOnPlayingUpdate is used
58 lines
1.5 KiB
JavaScript
58 lines
1.5 KiB
JavaScript
import React, { Component } from 'react';
|
|
|
|
import { VideoTrack } from '../../base/media';
|
|
|
|
const VIDEO_ERROR_CLASS = 'video-preview-has-error';
|
|
|
|
/**
|
|
* React component for displaying video. This component defers to lib-jitsi-meet
|
|
* logic for rendering the video.
|
|
*
|
|
* @extends Component
|
|
*/
|
|
class VideoInputPreview extends Component {
|
|
/**
|
|
* VideoInputPreview component's property types.
|
|
*
|
|
* @static
|
|
*/
|
|
static propTypes = {
|
|
/**
|
|
* An error message to display instead of a preview. Displaying an error
|
|
* will take priority over displaying a video preview.
|
|
*/
|
|
error: React.PropTypes.string,
|
|
|
|
/**
|
|
* The JitsiLocalTrack to display.
|
|
*/
|
|
track: React.PropTypes.object
|
|
};
|
|
|
|
/**
|
|
* Implements React's {@link Component#render()}.
|
|
*
|
|
* @inheritdoc
|
|
* @returns {ReactElement}
|
|
*/
|
|
render() {
|
|
const { error } = this.props;
|
|
const errorClass = error ? VIDEO_ERROR_CLASS : '';
|
|
const className = `video-input-preview ${errorClass}`;
|
|
|
|
return (
|
|
<div className = { className }>
|
|
<VideoTrack
|
|
className = 'video-input-preview-display flipVideoX'
|
|
triggerOnPlayingUpdate = { false }
|
|
videoTrack = {{ jitsiTrack: this.props.track }} />
|
|
<div className = 'video-input-preview-error'>
|
|
{ error || '' }
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default VideoInputPreview;
|