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.

actions.js 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  1. // @flow
  2. import UIEvents from '../../../../service/UI/UIEvents';
  3. import {
  4. createStartMutedConfigurationEvent,
  5. sendAnalytics
  6. } from '../../analytics';
  7. import { getName } from '../../app';
  8. import { JitsiConferenceEvents } from '../lib-jitsi-meet';
  9. import { setAudioMuted, setVideoMuted } from '../media';
  10. import {
  11. MAX_DISPLAY_NAME_LENGTH,
  12. dominantSpeakerChanged,
  13. participantConnectionStatusChanged,
  14. participantPresenceChanged,
  15. participantRoleChanged,
  16. participantUpdated
  17. } from '../participants';
  18. import { getLocalTracks, trackAdded, trackRemoved } from '../tracks';
  19. import { getJitsiMeetGlobalNS } from '../util';
  20. import {
  21. AUTH_STATUS_CHANGED,
  22. CONFERENCE_FAILED,
  23. CONFERENCE_JOINED,
  24. CONFERENCE_LEFT,
  25. CONFERENCE_WILL_JOIN,
  26. CONFERENCE_WILL_LEAVE,
  27. DATA_CHANNEL_OPENED,
  28. KICKED_OUT,
  29. LOCK_STATE_CHANGED,
  30. P2P_STATUS_CHANGED,
  31. SET_AUDIO_ONLY,
  32. SET_DESKTOP_SHARING_ENABLED,
  33. SET_FOLLOW_ME,
  34. SET_LASTN,
  35. SET_MAX_RECEIVER_VIDEO_QUALITY,
  36. SET_PASSWORD,
  37. SET_PASSWORD_FAILED,
  38. SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
  39. SET_ROOM,
  40. SET_START_MUTED_POLICY
  41. } from './actionTypes';
  42. import {
  43. AVATAR_ID_COMMAND,
  44. AVATAR_URL_COMMAND,
  45. EMAIL_COMMAND,
  46. JITSI_CONFERENCE_URL_KEY
  47. } from './constants';
  48. import {
  49. _addLocalTracksToConference,
  50. commonUserJoinedHandling,
  51. commonUserLeftHandling,
  52. getCurrentConference,
  53. sendLocalParticipant
  54. } from './functions';
  55. import type { Dispatch } from 'redux';
  56. const logger = require('jitsi-meet-logger').getLogger(__filename);
  57. declare var APP: Object;
  58. /**
  59. * Adds conference (event) listeners.
  60. *
  61. * @param {JitsiConference} conference - The JitsiConference instance.
  62. * @param {Dispatch} dispatch - The Redux dispatch function.
  63. * @private
  64. * @returns {void}
  65. */
  66. function _addConferenceListeners(conference, dispatch) {
  67. // Dispatches into features/base/conference follow:
  68. conference.on(
  69. JitsiConferenceEvents.CONFERENCE_FAILED,
  70. (...args) => dispatch(conferenceFailed(conference, ...args)));
  71. conference.on(
  72. JitsiConferenceEvents.CONFERENCE_JOINED,
  73. (...args) => dispatch(conferenceJoined(conference, ...args)));
  74. conference.on(
  75. JitsiConferenceEvents.CONFERENCE_LEFT,
  76. (...args) => dispatch(conferenceLeft(conference, ...args)));
  77. conference.on(
  78. JitsiConferenceEvents.KICKED,
  79. () => dispatch(kickedOut(conference)));
  80. conference.on(
  81. JitsiConferenceEvents.LOCK_STATE_CHANGED,
  82. (...args) => dispatch(lockStateChanged(conference, ...args)));
  83. // Dispatches into features/base/media follow:
  84. conference.on(
  85. JitsiConferenceEvents.STARTED_MUTED,
  86. () => {
  87. const audioMuted = Boolean(conference.startAudioMuted);
  88. const videoMuted = Boolean(conference.startVideoMuted);
  89. sendAnalytics(createStartMutedConfigurationEvent(
  90. 'remote', audioMuted, videoMuted));
  91. logger.log(`Start muted: ${audioMuted ? 'audio, ' : ''}${
  92. videoMuted ? 'video' : ''}`);
  93. // XXX Jicofo tells lib-jitsi-meet to start with audio and/or video
  94. // muted i.e. Jicofo expresses an intent. Lib-jitsi-meet has turned
  95. // Jicofo's intent into reality by actually muting the respective
  96. // tracks. The reality is expressed in base/tracks already so what
  97. // is left is to express Jicofo's intent in base/media.
  98. // TODO Maybe the app needs to learn about Jicofo's intent and
  99. // transfer that intent to lib-jitsi-meet instead of lib-jitsi-meet
  100. // acting on Jicofo's intent without the app's knowledge.
  101. dispatch(setAudioMuted(audioMuted));
  102. dispatch(setVideoMuted(videoMuted));
  103. });
  104. // Dispatches into features/base/tracks follow:
  105. conference.on(
  106. JitsiConferenceEvents.TRACK_ADDED,
  107. t => t && !t.isLocal() && dispatch(trackAdded(t)));
  108. conference.on(
  109. JitsiConferenceEvents.TRACK_REMOVED,
  110. t => t && !t.isLocal() && dispatch(trackRemoved(t)));
  111. // Dispatches into features/base/participants follow:
  112. conference.on(
  113. JitsiConferenceEvents.DISPLAY_NAME_CHANGED,
  114. (id, displayName) => dispatch(participantUpdated({
  115. conference,
  116. id,
  117. name: displayName.substr(0, MAX_DISPLAY_NAME_LENGTH)
  118. })));
  119. conference.on(
  120. JitsiConferenceEvents.DOMINANT_SPEAKER_CHANGED,
  121. id => dispatch(dominantSpeakerChanged(id, conference)));
  122. conference.on(
  123. JitsiConferenceEvents.PARTICIPANT_CONN_STATUS_CHANGED,
  124. (...args) => dispatch(participantConnectionStatusChanged(...args)));
  125. conference.on(
  126. JitsiConferenceEvents.USER_JOINED,
  127. (id, user) => commonUserJoinedHandling({ dispatch }, conference, user));
  128. conference.on(
  129. JitsiConferenceEvents.USER_LEFT,
  130. (id, user) => commonUserLeftHandling({ dispatch }, conference, user));
  131. conference.on(
  132. JitsiConferenceEvents.USER_ROLE_CHANGED,
  133. (...args) => dispatch(participantRoleChanged(...args)));
  134. conference.on(
  135. JitsiConferenceEvents.USER_STATUS_CHANGED,
  136. (...args) => dispatch(participantPresenceChanged(...args)));
  137. conference.on(
  138. JitsiConferenceEvents.BOT_TYPE_CHANGED,
  139. (id, botType) => dispatch(participantUpdated({
  140. conference,
  141. id,
  142. botType
  143. })));
  144. conference.addCommandListener(
  145. AVATAR_ID_COMMAND,
  146. (data, id) => dispatch(participantUpdated({
  147. conference,
  148. id,
  149. avatarID: data.value
  150. })));
  151. conference.addCommandListener(
  152. AVATAR_URL_COMMAND,
  153. (data, id) => dispatch(participantUpdated({
  154. conference,
  155. id,
  156. avatarURL: data.value
  157. })));
  158. conference.addCommandListener(
  159. EMAIL_COMMAND,
  160. (data, id) => dispatch(participantUpdated({
  161. conference,
  162. id,
  163. email: data.value
  164. })));
  165. }
  166. /**
  167. * Updates the current known state of server-side authentication.
  168. *
  169. * @param {boolean} authEnabled - Whether or not server authentication is
  170. * enabled.
  171. * @param {string} authLogin - The current name of the logged in user, if any.
  172. * @returns {{
  173. * type: AUTH_STATUS_CHANGED,
  174. * authEnabled: boolean,
  175. * authLogin: string
  176. * }}
  177. */
  178. export function authStatusChanged(authEnabled: boolean, authLogin: string) {
  179. return {
  180. type: AUTH_STATUS_CHANGED,
  181. authEnabled,
  182. authLogin
  183. };
  184. }
  185. /**
  186. * Signals that a specific conference has failed.
  187. *
  188. * @param {JitsiConference} conference - The JitsiConference that has failed.
  189. * @param {string} error - The error describing/detailing the cause of the
  190. * failure.
  191. * @returns {{
  192. * type: CONFERENCE_FAILED,
  193. * conference: JitsiConference,
  194. * error: Error
  195. * }}
  196. * @public
  197. */
  198. export function conferenceFailed(conference: Object, error: string) {
  199. return {
  200. type: CONFERENCE_FAILED,
  201. conference,
  202. // Make the error resemble an Error instance (to the extent that
  203. // jitsi-meet needs it).
  204. error: {
  205. name: error,
  206. recoverable: undefined
  207. }
  208. };
  209. }
  210. /**
  211. * Signals that a specific conference has been joined.
  212. *
  213. * @param {JitsiConference} conference - The JitsiConference instance which was
  214. * joined by the local participant.
  215. * @returns {{
  216. * type: CONFERENCE_JOINED,
  217. * conference: JitsiConference
  218. * }}
  219. */
  220. export function conferenceJoined(conference: Object) {
  221. return {
  222. type: CONFERENCE_JOINED,
  223. conference
  224. };
  225. }
  226. /**
  227. * Signals that a specific conference has been left.
  228. *
  229. * @param {JitsiConference} conference - The JitsiConference instance which was
  230. * left by the local participant.
  231. * @returns {{
  232. * type: CONFERENCE_LEFT,
  233. * conference: JitsiConference
  234. * }}
  235. */
  236. export function conferenceLeft(conference: Object) {
  237. return {
  238. type: CONFERENCE_LEFT,
  239. conference
  240. };
  241. }
  242. /**
  243. * Adds any existing local tracks to a specific conference before the conference
  244. * is joined. Then signals the intention of the application to have the local
  245. * participant join the specified conference.
  246. *
  247. * @param {JitsiConference} conference - The {@code JitsiConference} instance
  248. * the local participant will (try to) join.
  249. * @returns {Function}
  250. */
  251. function _conferenceWillJoin(conference: Object) {
  252. return (dispatch: Dispatch<*>, getState: Function) => {
  253. const localTracks
  254. = getLocalTracks(getState()['features/base/tracks'])
  255. .map(t => t.jitsiTrack);
  256. if (localTracks.length) {
  257. _addLocalTracksToConference(conference, localTracks);
  258. }
  259. dispatch(conferenceWillJoin(conference));
  260. };
  261. }
  262. /**
  263. * Signals the intention of the application to have the local participant
  264. * join the specified conference.
  265. *
  266. * @param {JitsiConference} conference - The {@code JitsiConference} instance
  267. * the local participant will (try to) join.
  268. * @returns {{
  269. * type: CONFERENCE_WILL_JOIN,
  270. * conference: JitsiConference
  271. * }}
  272. */
  273. export function conferenceWillJoin(conference: Object) {
  274. return {
  275. type: CONFERENCE_WILL_JOIN,
  276. conference
  277. };
  278. }
  279. /**
  280. * Signals the intention of the application to have the local participant leave
  281. * a specific conference. Similar in fashion to CONFERENCE_LEFT. Contrary to it
  282. * though, it's not guaranteed because CONFERENCE_LEFT may be triggered by
  283. * lib-jitsi-meet and not the application.
  284. *
  285. * @param {JitsiConference} conference - The JitsiConference instance which will
  286. * be left by the local participant.
  287. * @returns {{
  288. * type: CONFERENCE_LEFT,
  289. * conference: JitsiConference
  290. * }}
  291. */
  292. export function conferenceWillLeave(conference: Object) {
  293. return {
  294. type: CONFERENCE_WILL_LEAVE,
  295. conference
  296. };
  297. }
  298. /**
  299. * Initializes a new conference.
  300. *
  301. * @returns {Function}
  302. */
  303. export function createConference() {
  304. return (dispatch: Function, getState: Function) => {
  305. const state = getState();
  306. const { connection, locationURL } = state['features/base/connection'];
  307. if (!connection) {
  308. throw new Error('Cannot create a conference without a connection!');
  309. }
  310. const { password, room } = state['features/base/conference'];
  311. if (!room) {
  312. throw new Error('Cannot join a conference without a room name!');
  313. }
  314. const conference
  315. = connection.initJitsiConference(
  316. // XXX Lib-jitsi-meet does not accept uppercase letters.
  317. room.toLowerCase(), {
  318. ...state['features/base/config'],
  319. applicationName: getName(),
  320. getWiFiStatsMethod: getJitsiMeetGlobalNS().getWiFiStats
  321. });
  322. conference[JITSI_CONFERENCE_URL_KEY] = locationURL;
  323. dispatch(_conferenceWillJoin(conference));
  324. _addConferenceListeners(conference, dispatch);
  325. sendLocalParticipant(state, conference);
  326. conference.join(password);
  327. };
  328. }
  329. /**
  330. * Will try to join the conference again in case it failed earlier with
  331. * {@link JitsiConferenceErrors.AUTHENTICATION_REQUIRED}. It means that Jicofo
  332. * did not allow to create new room from anonymous domain, but it can be tried
  333. * again later in case authenticated user created it in the meantime.
  334. *
  335. * @returns {Function}
  336. */
  337. export function checkIfCanJoin() {
  338. return (dispatch: Dispatch<*>, getState: Function) => {
  339. const { authRequired, password }
  340. = getState()['features/base/conference'];
  341. authRequired && authRequired.join(password);
  342. };
  343. }
  344. /**
  345. * Signals the data channel with the bridge has successfully opened.
  346. *
  347. * @returns {{
  348. * type: DATA_CHANNEL_OPENED
  349. * }}
  350. */
  351. export function dataChannelOpened() {
  352. return {
  353. type: DATA_CHANNEL_OPENED
  354. };
  355. }
  356. /**
  357. * Signals that we've been kicked out of the conference.
  358. *
  359. * @param {JitsiConference} conference - The {@link JitsiConference} instance
  360. * for which the event is being signaled.
  361. * @returns {{
  362. * type: KICKED_OUT,
  363. * conference: JitsiConference
  364. * }}
  365. */
  366. export function kickedOut(conference: Object) {
  367. return {
  368. type: KICKED_OUT,
  369. conference
  370. };
  371. }
  372. /**
  373. * Signals that the lock state of a specific JitsiConference changed.
  374. *
  375. * @param {JitsiConference} conference - The JitsiConference which had its lock
  376. * state changed.
  377. * @param {boolean} locked - If the specified conference became locked, true;
  378. * otherwise, false.
  379. * @returns {{
  380. * type: LOCK_STATE_CHANGED,
  381. * conference: JitsiConference,
  382. * locked: boolean
  383. * }}
  384. */
  385. export function lockStateChanged(conference: Object, locked: boolean) {
  386. return {
  387. type: LOCK_STATE_CHANGED,
  388. conference,
  389. locked
  390. };
  391. }
  392. /**
  393. * Updates the known state of start muted policies.
  394. *
  395. * @param {boolean} audioMuted - Whether or not members will join the conference
  396. * as audio muted.
  397. * @param {boolean} videoMuted - Whether or not members will join the conference
  398. * as video muted.
  399. * @returns {{
  400. * type: SET_START_MUTED_POLICY,
  401. * startAudioMutedPolicy: boolean,
  402. * startVideoMutedPolicy: boolean
  403. * }}
  404. */
  405. export function onStartMutedPolicyChanged(
  406. audioMuted: boolean, videoMuted: boolean) {
  407. return {
  408. type: SET_START_MUTED_POLICY,
  409. startAudioMutedPolicy: audioMuted,
  410. startVideoMutedPolicy: videoMuted
  411. };
  412. }
  413. /**
  414. * Sets whether or not peer2peer is currently enabled.
  415. *
  416. * @param {boolean} p2p - Whether or not peer2peer is currently active.
  417. * @returns {{
  418. * type: P2P_STATUS_CHANGED,
  419. * p2p: boolean
  420. * }}
  421. */
  422. export function p2pStatusChanged(p2p: boolean) {
  423. return {
  424. type: P2P_STATUS_CHANGED,
  425. p2p
  426. };
  427. }
  428. /**
  429. * Sets the audio-only flag for the current JitsiConference.
  430. *
  431. * @param {boolean} audioOnly - True if the conference should be audio only;
  432. * false, otherwise.
  433. * @param {boolean} ensureVideoTrack - Define if conference should ensure
  434. * to create a video track.
  435. * @returns {{
  436. * type: SET_AUDIO_ONLY,
  437. * audioOnly: boolean,
  438. * ensureVideoTrack: boolean
  439. * }}
  440. */
  441. export function setAudioOnly(
  442. audioOnly: boolean,
  443. ensureVideoTrack: boolean = false) {
  444. return {
  445. type: SET_AUDIO_ONLY,
  446. audioOnly,
  447. ensureVideoTrack
  448. };
  449. }
  450. /**
  451. * Sets the flag for indicating if desktop sharing is enabled.
  452. *
  453. * @param {boolean} desktopSharingEnabled - True if desktop sharing is enabled.
  454. * @returns {{
  455. * type: SET_DESKTOP_SHARING_ENABLED,
  456. * desktopSharingEnabled: boolean
  457. * }}
  458. */
  459. export function setDesktopSharingEnabled(desktopSharingEnabled: boolean) {
  460. return {
  461. type: SET_DESKTOP_SHARING_ENABLED,
  462. desktopSharingEnabled
  463. };
  464. }
  465. /**
  466. * Enables or disables the Follow Me feature.
  467. *
  468. * @param {boolean} enabled - Whether or not Follow Me should be enabled.
  469. * @returns {{
  470. * type: SET_FOLLOW_ME,
  471. * enabled: boolean
  472. * }}
  473. */
  474. export function setFollowMe(enabled: boolean) {
  475. if (typeof APP !== 'undefined') {
  476. APP.UI.emitEvent(UIEvents.FOLLOW_ME_ENABLED, enabled);
  477. }
  478. return {
  479. type: SET_FOLLOW_ME,
  480. enabled
  481. };
  482. }
  483. /**
  484. * Sets the video channel's last N (value) of the current conference. A value of
  485. * undefined shall be used to reset it to the default value.
  486. *
  487. * @param {(number|undefined)} lastN - The last N value to be set.
  488. * @returns {Function}
  489. */
  490. export function setLastN(lastN: ?number) {
  491. return (dispatch: Dispatch<*>, getState: Function) => {
  492. if (typeof lastN === 'undefined') {
  493. const config = getState()['features/base/config'];
  494. /* eslint-disable no-param-reassign */
  495. lastN = config.channelLastN;
  496. if (typeof lastN === 'undefined') {
  497. lastN = -1;
  498. }
  499. /* eslint-enable no-param-reassign */
  500. }
  501. dispatch({
  502. type: SET_LASTN,
  503. lastN
  504. });
  505. };
  506. }
  507. /**
  508. * Sets the max frame height that should be received from remote videos.
  509. *
  510. * @param {number} maxReceiverVideoQuality - The max video frame height to
  511. * receive.
  512. * @returns {{
  513. * type: SET_MAX_RECEIVER_VIDEO_QUALITY,
  514. * maxReceiverVideoQuality: number
  515. * }}
  516. */
  517. export function setMaxReceiverVideoQuality(maxReceiverVideoQuality: number) {
  518. return {
  519. type: SET_MAX_RECEIVER_VIDEO_QUALITY,
  520. maxReceiverVideoQuality
  521. };
  522. }
  523. /**
  524. * Sets the password to join or lock a specific JitsiConference.
  525. *
  526. * @param {JitsiConference} conference - The JitsiConference which requires a
  527. * password to join or is to be locked with the specified password.
  528. * @param {Function} method - The JitsiConference method of password protection
  529. * such as join or lock.
  530. * @param {string} password - The password with which the specified conference
  531. * is to be joined or locked.
  532. * @returns {Function}
  533. */
  534. export function setPassword(
  535. conference: Object,
  536. method: Function,
  537. password: string) {
  538. return (dispatch: Dispatch<*>, getState: Function): ?Promise<void> => {
  539. switch (method) {
  540. case conference.join: {
  541. let state = getState()['features/base/conference'];
  542. // Make sure that the action will set a password for a conference
  543. // that the application wants joined.
  544. if (state.passwordRequired === conference) {
  545. dispatch({
  546. type: SET_PASSWORD,
  547. conference,
  548. method,
  549. password
  550. });
  551. // Join the conference with the newly-set password.
  552. // Make sure that the action did set the password.
  553. state = getState()['features/base/conference'];
  554. if (state.password === password
  555. && !state.passwordRequired
  556. // Make sure that the application still wants the
  557. // conference joined.
  558. && !state.conference) {
  559. method.call(conference, password);
  560. }
  561. }
  562. break;
  563. }
  564. case conference.lock: {
  565. const state = getState()['features/base/conference'];
  566. if (state.conference === conference) {
  567. return (
  568. method.call(conference, password)
  569. .then(() => dispatch({
  570. type: SET_PASSWORD,
  571. conference,
  572. method,
  573. password
  574. }))
  575. .catch(error => dispatch({
  576. type: SET_PASSWORD_FAILED,
  577. error
  578. }))
  579. );
  580. }
  581. return Promise.reject();
  582. }
  583. }
  584. };
  585. }
  586. /**
  587. * Sets the max frame height the user prefers to receive from remote participant
  588. * videos.
  589. *
  590. * @param {number} preferredReceiverVideoQuality - The max video resolution to
  591. * receive.
  592. * @returns {{
  593. * type: SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
  594. * preferredReceiverVideoQuality: number
  595. * }}
  596. */
  597. export function setPreferredReceiverVideoQuality(
  598. preferredReceiverVideoQuality: number) {
  599. return {
  600. type: SET_PREFERRED_RECEIVER_VIDEO_QUALITY,
  601. preferredReceiverVideoQuality
  602. };
  603. }
  604. /**
  605. * Sets (the name of) the room of the conference to be joined.
  606. *
  607. * @param {(string|undefined)} room - The name of the room of the conference to
  608. * be joined.
  609. * @returns {{
  610. * type: SET_ROOM,
  611. * room: string
  612. * }}
  613. */
  614. export function setRoom(room: ?string) {
  615. return {
  616. type: SET_ROOM,
  617. room
  618. };
  619. }
  620. /**
  621. * Sets whether or not members should join audio and/or video muted.
  622. *
  623. * @param {boolean} startAudioMuted - Whether or not members will join the
  624. * conference as audio muted.
  625. * @param {boolean} startVideoMuted - Whether or not members will join the
  626. * conference as video muted.
  627. * @returns {Function}
  628. */
  629. export function setStartMutedPolicy(
  630. startAudioMuted: boolean, startVideoMuted: boolean) {
  631. return (dispatch: Dispatch<*>, getState: Function) => {
  632. const conference = getCurrentConference(getState());
  633. conference && conference.setStartMutedPolicy({
  634. audio: startAudioMuted,
  635. video: startVideoMuted
  636. });
  637. return dispatch(
  638. onStartMutedPolicyChanged(startAudioMuted, startVideoMuted));
  639. };
  640. }
  641. /**
  642. * Toggles the audio-only flag for the current JitsiConference.
  643. *
  644. * @returns {Function}
  645. */
  646. export function toggleAudioOnly() {
  647. return (dispatch: Dispatch<*>, getState: Function) => {
  648. const { audioOnly } = getState()['features/base/conference'];
  649. return dispatch(setAudioOnly(!audioOnly, true));
  650. };
  651. }