|  | @@ -1,6 +1,7 @@
 | 
		
	
		
			
			| 1 | 1 |  import PropTypes from 'prop-types';
 | 
		
	
		
			
			| 2 | 2 |  import React, { Component } from 'react';
 | 
		
	
		
			
			| 3 | 3 |  
 | 
		
	
		
			
			|  | 4 | +import JitsiMeetJS from '../../base/lib-jitsi-meet';
 | 
		
	
		
			
			| 4 | 5 |  import { translate } from '../../base/i18n';
 | 
		
	
		
			
			| 5 | 6 |  
 | 
		
	
		
			
			| 6 | 7 |  import RemoteVideoMenuButton from './RemoteVideoMenuButton';
 | 
		
	
	
		
			
			|  | @@ -50,6 +51,19 @@ class RemoteControlButton extends Component {
 | 
		
	
		
			
			| 50 | 51 |          t: PropTypes.func
 | 
		
	
		
			
			| 51 | 52 |      };
 | 
		
	
		
			
			| 52 | 53 |  
 | 
		
	
		
			
			|  | 54 | +    /**
 | 
		
	
		
			
			|  | 55 | +     * Initializes a new {@code RemoteControlButton} instance.
 | 
		
	
		
			
			|  | 56 | +     *
 | 
		
	
		
			
			|  | 57 | +     * @param {Object} props - The read-only React Component props with which
 | 
		
	
		
			
			|  | 58 | +     * the new instance is to be initialized.
 | 
		
	
		
			
			|  | 59 | +     */
 | 
		
	
		
			
			|  | 60 | +    constructor(props) {
 | 
		
	
		
			
			|  | 61 | +        super(props);
 | 
		
	
		
			
			|  | 62 | +
 | 
		
	
		
			
			|  | 63 | +        // Bind event handlers so they are only bound once for every instance.
 | 
		
	
		
			
			|  | 64 | +        this._onClick = this._onClick.bind(this);
 | 
		
	
		
			
			|  | 65 | +    }
 | 
		
	
		
			
			|  | 66 | +
 | 
		
	
		
			
			| 53 | 67 |      /**
 | 
		
	
		
			
			| 54 | 68 |       * Implements React's {@link Component#render()}.
 | 
		
	
		
			
			| 55 | 69 |       *
 | 
		
	
	
		
			
			|  | @@ -58,7 +72,6 @@ class RemoteControlButton extends Component {
 | 
		
	
		
			
			| 58 | 72 |       */
 | 
		
	
		
			
			| 59 | 73 |      render() {
 | 
		
	
		
			
			| 60 | 74 |          const {
 | 
		
	
		
			
			| 61 |  | -            onClick,
 | 
		
	
		
			
			| 62 | 75 |              participantID,
 | 
		
	
		
			
			| 63 | 76 |              remoteControlState,
 | 
		
	
		
			
			| 64 | 77 |              t
 | 
		
	
	
		
			
			|  | @@ -92,9 +105,44 @@ class RemoteControlButton extends Component {
 | 
		
	
		
			
			| 92 | 105 |                  displayClass = { className }
 | 
		
	
		
			
			| 93 | 106 |                  iconClass = { icon }
 | 
		
	
		
			
			| 94 | 107 |                  id = { `remoteControl_${participantID}` }
 | 
		
	
		
			
			| 95 |  | -                onClick = { onClick } />
 | 
		
	
		
			
			|  | 108 | +                onClick = { this._onClick } />
 | 
		
	
		
			
			| 96 | 109 |          );
 | 
		
	
		
			
			| 97 | 110 |      }
 | 
		
	
		
			
			|  | 111 | +
 | 
		
	
		
			
			|  | 112 | +    /**
 | 
		
	
		
			
			|  | 113 | +     * Sends analytics event for pressing the button and executes the passed
 | 
		
	
		
			
			|  | 114 | +     * onClick handler.
 | 
		
	
		
			
			|  | 115 | +     *
 | 
		
	
		
			
			|  | 116 | +     * @private
 | 
		
	
		
			
			|  | 117 | +     * @returns {void}
 | 
		
	
		
			
			|  | 118 | +     */
 | 
		
	
		
			
			|  | 119 | +    _onClick() {
 | 
		
	
		
			
			|  | 120 | +        const { onClick, participantID, remoteControlState } = this.props;
 | 
		
	
		
			
			|  | 121 | +
 | 
		
	
		
			
			|  | 122 | +        let eventName;
 | 
		
	
		
			
			|  | 123 | +
 | 
		
	
		
			
			|  | 124 | +        if (remoteControlState === REMOTE_CONTROL_MENU_STATES.STARTED) {
 | 
		
	
		
			
			|  | 125 | +            eventName = 'stop';
 | 
		
	
		
			
			|  | 126 | +        }
 | 
		
	
		
			
			|  | 127 | +
 | 
		
	
		
			
			|  | 128 | +        if (remoteControlState === REMOTE_CONTROL_MENU_STATES.NOT_STARTED) {
 | 
		
	
		
			
			|  | 129 | +            eventName = 'start';
 | 
		
	
		
			
			|  | 130 | +        }
 | 
		
	
		
			
			|  | 131 | +
 | 
		
	
		
			
			|  | 132 | +        if (eventName) {
 | 
		
	
		
			
			|  | 133 | +            JitsiMeetJS.analytics.sendEvent(
 | 
		
	
		
			
			|  | 134 | +                `remotevideomenu.remotecontrol.${eventName}`,
 | 
		
	
		
			
			|  | 135 | +                {
 | 
		
	
		
			
			|  | 136 | +                    value: 1,
 | 
		
	
		
			
			|  | 137 | +                    label: participantID
 | 
		
	
		
			
			|  | 138 | +                }
 | 
		
	
		
			
			|  | 139 | +            );
 | 
		
	
		
			
			|  | 140 | +        }
 | 
		
	
		
			
			|  | 141 | +
 | 
		
	
		
			
			|  | 142 | +        if (onClick) {
 | 
		
	
		
			
			|  | 143 | +            onClick();
 | 
		
	
		
			
			|  | 144 | +        }
 | 
		
	
		
			
			|  | 145 | +    }
 | 
		
	
		
			
			| 98 | 146 |  }
 | 
		
	
		
			
			| 99 | 147 |  
 | 
		
	
		
			
			| 100 | 148 |  export default translate(RemoteControlButton);
 |