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

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