Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

defaultToolbarButtons.js 12KB

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