Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

defaultToolbarButtons.web.js 13KB

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