Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

[RN] Add display name to on-stage participant

Bettenbuk Zoltan63ff0c27a991
diff --git a/react/features/conference/components/Conference.native.js b/react/features/conference/components/Conference.native.js
index 652385e63f..bc9695d0a0 100644
--- a/react/features/conference/components/Conference.native.js
+++ b/react/features/conference/components/Conference.native.js
@@ -27,6 +27,7 @@ import { Captions } from '../../subtitles';
import { setToolboxVisible, Toolbox } from '../../toolbox';
import { shouldDisplayTileView } from '../../video-layout';
+import DisplayNameLabel from './DisplayNameLabel';
import styles from './styles';
/**
@@ -283,6 +284,8 @@ class Conference extends Component<Props> {
<Captions onPress = { this._onClick } />
+ <DisplayNameLabel />
+
{/*
* The Toolbox is in a stacking layer bellow the Filmstrip.
*/}
diff --git a/react/features/conference/components/DisplayNameLabel.native.js b/react/features/conference/components/DisplayNameLabel.native.js
new file mode 100644
index 0000000000..bb40328b06
--- /dev/null
+++ b/react/features/conference/components/DisplayNameLabel.native.js
@@ -0,0 +1,79 @@
+// @flow
+
+import React, { Component } from 'react';
+import { Text, View } from 'react-native';
+import { connect } from 'react-redux';
+
+import {
+ getLocalParticipant,
+ getParticipantDisplayName,
+ shouldRenderParticipantVideo
+} from '../../base/participants';
+
+import { shouldDisplayTileView } from '../../video-layout';
+
+import styles from './styles';
+
+type Props = {
+
+ /**
+ * The name of the participant to render.
+ */
+ _participantName: string,
+
+ /**
+ * True of the label needs to be rendered. False otherwise.
+ */
+ _render: boolean
+}
+
+/**
+ * Renders a label with the display name of the on-stage participant.
+ */
+class DisplayNameLabel extends Component<Props> {
+ /**
+ * Implements {@code Component#render}.
+ *
+ * @inheritdoc
+ */
+ render() {
+ if (!this.props._render) {
+ return null;
+ }
+
+ return (
+ <View style = { styles.displayNameBackdrop }>
+ <Text style = { styles.displayNameText }>
+ { this.props._participantName }
+ </Text>
+ </View>
+ );
+ }
+}
+
+/**
+ * Maps part of the Redux state to the props of this component.
+ *
+ * @param {Object} state - The Redux state.
+ * @returns {{
+ * }}
+ */
+function _mapStateToProps(state: Object) {
+ const largeVideoParticipantId = state['features/large-video'].participantId;
+ const localParticipant = getLocalParticipant(state);
+
+ // Currently we only render the display name if it's not the local
+ // participant, we're not in tile view and there is no video rendered for
+ // the on-stage participant.
+ const _render = localParticipant.id !== largeVideoParticipantId
+ && !shouldDisplayTileView(state)
+ && !shouldRenderParticipantVideo(state, largeVideoParticipantId);
+
+ return {
+ _participantName:
+ getParticipantDisplayName(state, largeVideoParticipantId),
+ _render
+ };
+}
+
+export default connect(_mapStateToProps)(DisplayNameLabel);
diff --git a/react/features/conference/components/DisplayNameLabel.web.js b/react/features/conference/components/DisplayNameLabel.web.js
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/react/features/conference/components/styles.js b/react/features/conference/components/styles.js
index 774044a5d4..2eebaaaaca 100644
--- a/react/features/conference/components/styles.js
+++ b/react/features/conference/components/styles.js
@@ -18,6 +18,20 @@ export default createStyleSheet({
flex: 1
}),
+ displayNameBackdrop: {
+ alignSelf: 'center',
+ backgroundColor: 'rgba(28, 32, 37, 0.6)',
+ borderRadius: 4,
+ margin: 16,
+ paddingHorizontal: 16,
+ paddingVertical: 4
+ },
+
+ displayNameText: {
+ color: ColorPalette.white,
+ fontSize: 14
+ },
+
/**
* The style of the {@link View} which expands over the whole
* {@link Conference} area and splits it between the {@link Filmstrip} and