2018-05-16 14:00:16 +00:00
|
|
|
// @flow
|
|
|
|
|
2018-03-21 18:26:52 +00:00
|
|
|
import React, { Component } from 'react';
|
2018-05-16 14:00:16 +00:00
|
|
|
import { connect } from 'react-redux';
|
2018-03-21 18:26:52 +00:00
|
|
|
|
|
|
|
import { Dialog } from '../../../base/dialog';
|
|
|
|
import { translate } from '../../../base/i18n';
|
2018-05-16 14:00:16 +00:00
|
|
|
import {
|
|
|
|
createRecordingDialogEvent,
|
|
|
|
sendAnalytics
|
|
|
|
} from '../../../analytics';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of
|
|
|
|
* {@link StopLiveStreamDialog}.
|
|
|
|
*/
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The {@code JitsiConference} for the current conference.
|
|
|
|
*/
|
|
|
|
_conference: Object,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The redux representation of the live stremaing to be stopped.
|
|
|
|
*/
|
|
|
|
session: Object,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoked to obtain translated strings.
|
|
|
|
*/
|
|
|
|
t: Function
|
|
|
|
};
|
2018-03-21 18:26:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A React Component for confirming the participant wishes to stop the currently
|
|
|
|
* active live stream of the conference.
|
|
|
|
*
|
|
|
|
* @extends Component
|
|
|
|
*/
|
2018-05-16 14:00:16 +00:00
|
|
|
class StopLiveStreamDialog extends Component<Props> {
|
2018-03-21 18:26:52 +00:00
|
|
|
/**
|
|
|
|
* Initializes a new {@code StopLiveStreamDialog} instance.
|
|
|
|
*
|
|
|
|
* @param {Object} props - The read-only properties with which the new
|
|
|
|
* instance is to be initialized.
|
|
|
|
*/
|
2018-05-16 14:00:16 +00:00
|
|
|
constructor(props: Props) {
|
2018-03-21 18:26:52 +00:00
|
|
|
super(props);
|
|
|
|
|
|
|
|
// Bind event handler so it is only bound once for every instance.
|
|
|
|
this._onSubmit = this._onSubmit.bind(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<Dialog
|
|
|
|
okTitleKey = 'dialog.stopLiveStreaming'
|
|
|
|
onSubmit = { this._onSubmit }
|
|
|
|
titleKey = 'dialog.liveStreaming'
|
|
|
|
width = 'small'>
|
|
|
|
{ this.props.t('dialog.stopStreamingWarning') }
|
|
|
|
</Dialog>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-05-16 14:00:16 +00:00
|
|
|
_onSubmit: () => boolean;
|
2018-04-10 20:51:49 +00:00
|
|
|
|
2018-03-21 18:26:52 +00:00
|
|
|
/**
|
|
|
|
* Callback invoked when stopping of live streaming is confirmed.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {boolean} True to close the modal.
|
|
|
|
*/
|
|
|
|
_onSubmit() {
|
2018-05-16 14:00:16 +00:00
|
|
|
sendAnalytics(createRecordingDialogEvent('stop', 'confirm.button'));
|
|
|
|
|
|
|
|
const { session } = this.props;
|
|
|
|
|
|
|
|
if (session) {
|
|
|
|
this.props._conference.stopRecording(session.id);
|
|
|
|
}
|
2018-03-21 18:26:52 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-16 14:00:16 +00:00
|
|
|
/**
|
|
|
|
* Maps (parts of) the redux state to the React {@code Component} props of
|
|
|
|
* {@code StopLiveStreamDialog}.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The redux state.
|
|
|
|
* @private
|
|
|
|
* @returns {{
|
|
|
|
* _conference: Object
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
|
|
|
return {
|
|
|
|
_conference: state['features/base/conference'].conference
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default translate(connect(_mapStateToProps)(StopLiveStreamDialog));
|