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

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