You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

defaultToolbarButtons.js 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. /* @flow */
  2. import React from 'react';
  3. import UIEvents from '../../../service/UI/UIEvents';
  4. import { openInviteDialog } from '../invite';
  5. import { AudioOnlyButton } from './components';
  6. declare var APP: Object;
  7. declare var config: Object;
  8. declare var JitsiMeetJS: Object;
  9. /**
  10. * Shows SIP number dialog.
  11. *
  12. * @returns {void}
  13. */
  14. function _showSIPNumberInput() {
  15. const defaultNumber = config.defaultSipNumber || '';
  16. const msgString
  17. = `<input class="input-control" name="sipNumber" type="text" value="${
  18. defaultNumber}" autofocus>`;
  19. APP.UI.messageHandler.openTwoButtonDialog({
  20. focus: ':input:first',
  21. leftButtonKey: 'dialog.Dial',
  22. msgString,
  23. titleKey: 'dialog.sipMsg',
  24. // eslint-disable-next-line max-params
  25. submitFunction(event, value, message, formValues) {
  26. const { sipNumber } = formValues;
  27. if (value && sipNumber) {
  28. APP.UI.emitEvent(UIEvents.SIP_DIAL, sipNumber);
  29. }
  30. }
  31. });
  32. }
  33. /**
  34. * All toolbar buttons' descriptors.
  35. */
  36. export default {
  37. /**
  38. * The descriptor of the audio only toolbar button. Defers actual
  39. * descriptor implementation to the {@code AudioOnlyButton} component.
  40. */
  41. audioonly: {
  42. component: AudioOnlyButton
  43. },
  44. /**
  45. * The descriptor of the camera toolbar button.
  46. */
  47. camera: {
  48. classNames: [ 'button', 'icon-camera' ],
  49. enabled: true,
  50. filmstripOnlyEnabled: true,
  51. id: 'toolbar_button_camera',
  52. onClick() {
  53. if (APP.conference.videoMuted) {
  54. JitsiMeetJS.analytics.sendEvent('toolbar.video.enabled');
  55. APP.UI.emitEvent(UIEvents.VIDEO_MUTED, false);
  56. } else {
  57. JitsiMeetJS.analytics.sendEvent('toolbar.video.disabled');
  58. APP.UI.emitEvent(UIEvents.VIDEO_MUTED, true);
  59. }
  60. },
  61. popups: [
  62. {
  63. className: 'loginmenu',
  64. dataAttr: 'audioOnly.featureToggleDisabled',
  65. dataInterpolate: { feature: 'video mute' },
  66. id: 'unmuteWhileAudioOnly'
  67. }
  68. ],
  69. shortcut: 'V',
  70. shortcutAttr: 'toggleVideoPopover',
  71. shortcutFunc() {
  72. if (APP.conference.isAudioOnly()) {
  73. APP.UI.emitEvent(UIEvents.VIDEO_UNMUTING_WHILE_AUDIO_ONLY);
  74. return;
  75. }
  76. JitsiMeetJS.analytics.sendEvent('shortcut.videomute.toggled');
  77. APP.conference.toggleVideoMuted();
  78. },
  79. shortcutDescription: 'keyboardShortcuts.videoMute',
  80. tooltipKey: 'toolbar.videomute'
  81. },
  82. /**
  83. * The descriptor of the chat toolbar button.
  84. */
  85. chat: {
  86. classNames: [ 'button', 'icon-chat' ],
  87. enabled: true,
  88. html: <span className = 'badge-round'>
  89. <span id = 'unreadMessages' />
  90. </span>,
  91. id: 'toolbar_button_chat',
  92. onClick() {
  93. JitsiMeetJS.analytics.sendEvent('toolbar.chat.toggled');
  94. APP.UI.emitEvent(UIEvents.TOGGLE_CHAT);
  95. },
  96. shortcut: 'C',
  97. shortcutAttr: 'toggleChatPopover',
  98. shortcutFunc() {
  99. JitsiMeetJS.analytics.sendEvent('shortcut.chat.toggled');
  100. APP.UI.toggleChat();
  101. },
  102. shortcutDescription: 'keyboardShortcuts.toggleChat',
  103. sideContainerId: 'chat_container',
  104. tooltipKey: 'toolbar.chat'
  105. },
  106. /**
  107. * The descriptor of the contact list toolbar button.
  108. */
  109. contacts: {
  110. classNames: [ 'button', 'icon-contactList' ],
  111. enabled: true,
  112. // XXX: Hotfix to solve race condition between toolbox rendering and
  113. // contact list view that updates the number of active participants
  114. // via jQuery. There is case when contact list view updates number of
  115. // participants but toolbox has not been rendered yet. Since this issue
  116. // is reproducible only for conferences with the only participant let's
  117. // use 1 participant as a default value for this badge. Later after
  118. // reactification of contact list let's use the value of active
  119. // paricipants from Redux store.
  120. html: <span className = 'badge-round'>
  121. <span id = 'numberOfParticipants'>1</span>
  122. </span>,
  123. id: 'toolbar_contact_list',
  124. onClick() {
  125. JitsiMeetJS.analytics.sendEvent(
  126. 'toolbar.contacts.toggled');
  127. APP.UI.emitEvent(UIEvents.TOGGLE_CONTACT_LIST);
  128. },
  129. sideContainerId: 'contacts_container',
  130. tooltipKey: 'bottomtoolbar.contactlist'
  131. },
  132. /**
  133. * The descriptor of the desktop sharing toolbar button.
  134. */
  135. desktop: {
  136. classNames: [ 'button', 'icon-share-desktop' ],
  137. enabled: true,
  138. id: 'toolbar_button_desktopsharing',
  139. onClick() {
  140. if (APP.conference.isSharingScreen) {
  141. JitsiMeetJS.analytics.sendEvent('toolbar.screen.disabled');
  142. } else {
  143. JitsiMeetJS.analytics.sendEvent('toolbar.screen.enabled');
  144. }
  145. APP.UI.emitEvent(UIEvents.TOGGLE_SCREENSHARING);
  146. },
  147. popups: [
  148. {
  149. className: 'loginmenu',
  150. dataAttr: 'audioOnly.featureToggleDisabled',
  151. dataInterpolate: { feature: 'screen sharing' },
  152. id: 'screenshareWhileAudioOnly'
  153. }
  154. ],
  155. shortcut: 'D',
  156. shortcutAttr: 'toggleDesktopSharingPopover',
  157. shortcutFunc() {
  158. JitsiMeetJS.analytics.sendEvent('shortcut.screen.toggled');
  159. APP.conference.toggleScreenSharing();
  160. },
  161. shortcutDescription: 'keyboardShortcuts.toggleScreensharing',
  162. tooltipKey: 'toolbar.sharescreen'
  163. },
  164. /**
  165. * The descriptor of the dialpad toolbar button.
  166. */
  167. dialpad: {
  168. classNames: [ 'button', 'icon-dialpad' ],
  169. enabled: true,
  170. // TODO: remove it after UI.updateDTMFSupport fix
  171. hidden: true,
  172. id: 'toolbar_button_dialpad',
  173. onClick() {
  174. JitsiMeetJS.analytics.sendEvent('toolbar.sip.dialpad.clicked');
  175. },
  176. tooltipKey: 'toolbar.dialpad'
  177. },
  178. /**
  179. * The descriptor of the etherpad toolbar button.
  180. */
  181. etherpad: {
  182. classNames: [ 'button', 'icon-share-doc' ],
  183. enabled: true,
  184. hidden: true,
  185. id: 'toolbar_button_etherpad',
  186. onClick() {
  187. JitsiMeetJS.analytics.sendEvent('toolbar.etherpad.clicked');
  188. APP.UI.emitEvent(UIEvents.ETHERPAD_CLICKED);
  189. },
  190. tooltipKey: 'toolbar.etherpad'
  191. },
  192. /**
  193. * The descriptor of the toolbar button which toggles full-screen mode.
  194. */
  195. fullscreen: {
  196. classNames: [ 'button', 'icon-full-screen' ],
  197. enabled: true,
  198. id: 'toolbar_button_fullScreen',
  199. onClick() {
  200. JitsiMeetJS.analytics.sendEvent('toolbar.fullscreen.enabled');
  201. APP.UI.emitEvent(UIEvents.TOGGLE_FULLSCREEN);
  202. },
  203. shortcut: 'S',
  204. shortcutAttr: 'toggleFullscreenPopover',
  205. shortcutDescription: 'keyboardShortcuts.fullScreen',
  206. shortcutFunc() {
  207. JitsiMeetJS.analytics.sendEvent('shortcut.fullscreen.toggled');
  208. APP.UI.toggleFullScreen();
  209. },
  210. tooltipKey: 'toolbar.fullscreen'
  211. },
  212. /**
  213. * The descriptor of the toolbar button which hangs up the call/conference.
  214. */
  215. hangup: {
  216. classNames: [ 'button', 'icon-hangup', 'button_hangup' ],
  217. enabled: true,
  218. filmstripOnlyEnabled: true,
  219. id: 'toolbar_button_hangup',
  220. onClick() {
  221. JitsiMeetJS.analytics.sendEvent('toolbar.hangup');
  222. APP.UI.emitEvent(UIEvents.HANGUP);
  223. },
  224. tooltipKey: 'toolbar.hangup'
  225. },
  226. /**
  227. * The descriptor of the toolbar button which shows the invite user dialog.
  228. */
  229. invite: {
  230. classNames: [ 'button', 'icon-link' ],
  231. enabled: true,
  232. id: 'toolbar_button_link',
  233. onClick() {
  234. JitsiMeetJS.analytics.sendEvent('toolbar.invite.clicked');
  235. APP.store.dispatch(openInviteDialog());
  236. },
  237. tooltipKey: 'toolbar.invite'
  238. },
  239. /**
  240. * The descriptor of the microphone toolbar button.
  241. */
  242. microphone: {
  243. classNames: [ 'button', 'icon-microphone' ],
  244. enabled: true,
  245. filmstripOnlyEnabled: true,
  246. id: 'toolbar_button_mute',
  247. onClick() {
  248. const sharedVideoManager = APP.UI.getSharedVideoManager();
  249. if (APP.conference.audioMuted) {
  250. // If there's a shared video with the volume "on" and we aren't
  251. // the video owner, we warn the user
  252. // that currently it's not possible to unmute.
  253. if (sharedVideoManager
  254. && sharedVideoManager.isSharedVideoVolumeOn()
  255. && !sharedVideoManager.isSharedVideoOwner()) {
  256. APP.UI.showCustomToolbarPopup(
  257. '#unableToUnmutePopup', true, 5000);
  258. } else {
  259. JitsiMeetJS.analytics.sendEvent('toolbar.audio.unmuted');
  260. APP.UI.emitEvent(UIEvents.AUDIO_MUTED, false, true);
  261. }
  262. } else {
  263. JitsiMeetJS.analytics.sendEvent('toolbar.audio.muted');
  264. APP.UI.emitEvent(UIEvents.AUDIO_MUTED, true, true);
  265. }
  266. },
  267. popups: [
  268. {
  269. className: 'loginmenu',
  270. dataAttr: 'toolbar.micMutedPopup',
  271. id: 'micMutedPopup'
  272. },
  273. {
  274. className: 'loginmenu',
  275. dataAttr: 'toolbar.unableToUnmutePopup',
  276. id: 'unableToUnmutePopup'
  277. },
  278. {
  279. className: 'loginmenu',
  280. dataAttr: 'toolbar.talkWhileMutedPopup',
  281. id: 'talkWhileMutedPopup'
  282. }
  283. ],
  284. shortcut: 'M',
  285. shortcutAttr: 'mutePopover',
  286. shortcutFunc() {
  287. JitsiMeetJS.analytics.sendEvent('shortcut.audiomute.toggled');
  288. APP.conference.toggleAudioMuted();
  289. },
  290. shortcutDescription: 'keyboardShortcuts.mute',
  291. tooltipKey: 'toolbar.mute'
  292. },
  293. /**
  294. * The descriptor of the profile toolbar button.
  295. */
  296. profile: {
  297. classNames: [ 'button' ],
  298. enabled: true,
  299. html: <img
  300. id = 'avatar'
  301. src = 'images/avatar2.png' />,
  302. id: 'toolbar_button_profile',
  303. onClick() {
  304. JitsiMeetJS.analytics.sendEvent('toolbar.profile.toggled');
  305. APP.UI.emitEvent(UIEvents.TOGGLE_PROFILE);
  306. },
  307. sideContainerId: 'profile_container',
  308. tooltipKey: 'profile.setDisplayNameLabel'
  309. },
  310. /**
  311. * The descriptor of the "Raise hand" toolbar button.
  312. */
  313. raisehand: {
  314. classNames: [ 'button', 'icon-raised-hand' ],
  315. enabled: true,
  316. id: 'toolbar_button_raisehand',
  317. onClick() {
  318. JitsiMeetJS.analytics.sendEvent('toolbar.raiseHand.clicked');
  319. APP.conference.maybeToggleRaisedHand();
  320. },
  321. shortcut: 'R',
  322. shortcutAttr: 'raiseHandPopover',
  323. shortcutDescription: 'keyboardShortcuts.raiseHand',
  324. shortcutFunc() {
  325. JitsiMeetJS.analytics.sendEvent('shortcut.raisehand.clicked');
  326. APP.conference.maybeToggleRaisedHand();
  327. },
  328. tooltipKey: 'toolbar.raiseHand'
  329. },
  330. /**
  331. * The descriptor of the recording toolbar button. Requires additional
  332. * initialization in the recording module.
  333. */
  334. recording: {
  335. classNames: [ 'button' ],
  336. enabled: true,
  337. // will be displayed once the recording functionality is detected
  338. hidden: true,
  339. id: 'toolbar_button_record',
  340. tooltipKey: 'liveStreaming.buttonTooltip'
  341. },
  342. /**
  343. * The descriptor of the settings toolbar button.
  344. */
  345. settings: {
  346. classNames: [ 'button', 'icon-settings' ],
  347. enabled: true,
  348. id: 'toolbar_button_settings',
  349. onClick() {
  350. JitsiMeetJS.analytics.sendEvent('toolbar.settings.toggled');
  351. APP.UI.emitEvent(UIEvents.TOGGLE_SETTINGS);
  352. },
  353. sideContainerId: 'settings_container',
  354. tooltipKey: 'toolbar.Settings'
  355. },
  356. /**
  357. * The descriptor of the "Share YouTube video" toolbar button.
  358. */
  359. sharedvideo: {
  360. classNames: [ 'button', 'icon-shared-video' ],
  361. enabled: true,
  362. id: 'toolbar_button_sharedvideo',
  363. onClick() {
  364. JitsiMeetJS.analytics.sendEvent('toolbar.sharedvideo.clicked');
  365. APP.UI.emitEvent(UIEvents.SHARED_VIDEO_CLICKED);
  366. },
  367. popups: [
  368. {
  369. className: 'loginmenu extendedToolbarPopup',
  370. dataAttr: 'toolbar.sharedVideoMutedPopup',
  371. dataAttrPosition: 'w',
  372. id: 'sharedVideoMutedPopup'
  373. }
  374. ],
  375. tooltipKey: 'toolbar.sharedvideo'
  376. },
  377. /**
  378. * The descriptor of the SIP call toolbar button.
  379. */
  380. sip: {
  381. classNames: [ 'button', 'icon-telephone' ],
  382. enabled: true,
  383. // Will be displayed once the SIP calls functionality is detected.
  384. hidden: true,
  385. id: 'toolbar_button_sip',
  386. onClick() {
  387. JitsiMeetJS.analytics.sendEvent('toolbar.sip.clicked');
  388. _showSIPNumberInput();
  389. },
  390. tooltipKey: 'toolbar.sip'
  391. }
  392. };