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

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