mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-14 16:27:49 +00:00
When do we need tracks? - Welcome page (only the video track) - Conference (depends if starting with audio / video muted is requested) When do we need to destroy the tracks? - When we are not in a conference and there is no welcome page In order to accommodate all the above use cases, a new component is introduced: BlankWelcomePage. Its purpose is to take the place of the welcome page when it is disabled. When this component is mounted local tracks are destroyed. Analogously, a video track is created when the (real) welcome page is created, and all the desired tracks are created then the Conference component is created. What are desired tracks? These are the tracks we'd like to use for the conference that is about to happen. By default both audio and video are desired. It's possible, however, the user requested to start the call with no video/audio, in which case it's muted in base/media and a track is not created. The first time the app starts (with the welcome page) it will request permission for video only, since there is no need for audio in the welcome page. Later, when a conference is joined permission for audio will be requested when an audio track is to be created. The audio track is not destroyed when the conference ends. Yours truly thinks this is not needed since it's a stopped track which is not using system resources.
153 lines
4.7 KiB
JavaScript
153 lines
4.7 KiB
JavaScript
import React from 'react';
|
|
import { TextInput, TouchableHighlight, View } from 'react-native';
|
|
import { connect } from 'react-redux';
|
|
|
|
import { translate } from '../../base/i18n';
|
|
import { MEDIA_TYPE } from '../../base/media';
|
|
import { Link, Text } from '../../base/react';
|
|
import { ColorPalette } from '../../base/styles';
|
|
import { createLocalTracksA } from '../../base/tracks';
|
|
|
|
import { AbstractWelcomePage, _mapStateToProps } from './AbstractWelcomePage';
|
|
import styles from './styles';
|
|
|
|
/**
|
|
* The URL at which the privacy policy is available to the user.
|
|
*/
|
|
const PRIVACY_URL = 'https://jitsi.org/meet/privacy';
|
|
|
|
/**
|
|
* The URL at which the user may send feedback.
|
|
*/
|
|
const SEND_FEEDBACK_URL = 'mailto:support@jitsi.org';
|
|
|
|
/**
|
|
* The URL at which the terms (of service/use) are available to the user.
|
|
*/
|
|
const TERMS_URL = 'https://jitsi.org/meet/terms';
|
|
|
|
/**
|
|
* The native container rendering the welcome page.
|
|
*
|
|
* @extends AbstractWelcomePage
|
|
*/
|
|
class WelcomePage extends AbstractWelcomePage {
|
|
/**
|
|
* WelcomePage component's property types.
|
|
*
|
|
* @static
|
|
*/
|
|
static propTypes = AbstractWelcomePage.propTypes;
|
|
|
|
/**
|
|
* Creates a video track if not already available.
|
|
*
|
|
* @inheritdoc
|
|
* @returns {void}
|
|
*/
|
|
componentWillMount() {
|
|
const { dispatch, _localVideoTrack } = this.props;
|
|
|
|
(typeof _localVideoTrack === 'undefined')
|
|
&& dispatch(createLocalTracksA({ devices: [ MEDIA_TYPE.VIDEO ] }));
|
|
}
|
|
|
|
/**
|
|
* Renders a prompt for entering a room name.
|
|
*
|
|
* @returns {ReactElement}
|
|
*/
|
|
render() {
|
|
return (
|
|
<View style = { styles.container }>
|
|
{
|
|
this._renderLocalVideo()
|
|
}
|
|
{
|
|
this._renderLocalVideoOverlay()
|
|
}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Renders legal-related content such as Terms of service/use, Privacy
|
|
* policy, etc.
|
|
*
|
|
* @private
|
|
* @returns {ReactElement}
|
|
*/
|
|
_renderLegalese() {
|
|
const { t } = this.props;
|
|
|
|
return (
|
|
<View style = { styles.legaleseContainer }>
|
|
<Link
|
|
style = { styles.legaleseItem }
|
|
url = { TERMS_URL }>
|
|
{ t('welcomepage.terms') }
|
|
</Link>
|
|
<Link
|
|
style = { styles.legaleseItem }
|
|
url = { PRIVACY_URL }>
|
|
{ t('welcomepage.privacy') }
|
|
</Link>
|
|
<Link
|
|
style = { styles.legaleseItem }
|
|
url = { SEND_FEEDBACK_URL }>
|
|
{ t('welcomepage.sendFeedback') }
|
|
</Link>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Renders a View over the local video. The latter is thought of as the
|
|
* background (content) of this WelcomePage. The former is thought of as the
|
|
* foreground (content) of this WelcomePage such as the room name input, the
|
|
* button to initiate joining the specified room, etc.
|
|
*
|
|
* @private
|
|
* @returns {ReactElement}
|
|
*/
|
|
_renderLocalVideoOverlay() {
|
|
const { t } = this.props;
|
|
|
|
return (
|
|
<View style = { styles.localVideoOverlay }>
|
|
<View style = { styles.roomContainer }>
|
|
<Text style = { styles.title }>
|
|
{ t('welcomepage.roomname') }
|
|
</Text>
|
|
<TextInput
|
|
accessibilityLabel = { 'Input room name.' }
|
|
autoCapitalize = 'none'
|
|
autoComplete = { false }
|
|
autoCorrect = { false }
|
|
autoFocus = { false }
|
|
onChangeText = { this._onRoomChange }
|
|
placeholder = { t('welcomepage.roomnamePlaceHolder') }
|
|
style = { styles.textInput }
|
|
underlineColorAndroid = 'transparent'
|
|
value = { this.state.room } />
|
|
<TouchableHighlight
|
|
accessibilityLabel = { 'Tap to Join.' }
|
|
disabled = { this._isJoinDisabled() }
|
|
onPress = { this._onJoin }
|
|
style = { styles.button }
|
|
underlayColor = { ColorPalette.white }>
|
|
<Text style = { styles.buttonText }>
|
|
{ t('welcomepage.join') }
|
|
</Text>
|
|
</TouchableHighlight>
|
|
</View>
|
|
{
|
|
this._renderLegalese()
|
|
}
|
|
</View>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default translate(connect(_mapStateToProps)(WelcomePage));
|