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

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