您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

defaultToolbarButtons.js 12KB

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