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 12KB

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