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 14KB

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