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

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