Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800
  1. /* global APP, $, interfaceConfig */
  2. import Logger from 'jitsi-meet-logger';
  3. import { MEDIA_TYPE, VIDEO_TYPE } from '../../../react/features/base/media';
  4. import {
  5. getLocalParticipant as getLocalParticipantFromStore,
  6. getPinnedParticipant,
  7. getParticipantById,
  8. pinParticipant
  9. } from '../../../react/features/base/participants';
  10. import { getTrackByMediaTypeAndParticipant } from '../../../react/features/base/tracks';
  11. import UIEvents from '../../../service/UI/UIEvents';
  12. import { SHARED_VIDEO_CONTAINER_TYPE } from '../shared_video/SharedVideo';
  13. import SharedVideoThumb from '../shared_video/SharedVideoThumb';
  14. import LargeVideoManager from './LargeVideoManager';
  15. import LocalVideo from './LocalVideo';
  16. import RemoteVideo from './RemoteVideo';
  17. import { VIDEO_CONTAINER_TYPE } from './VideoContainer';
  18. const logger = Logger.getLogger(__filename);
  19. const remoteVideos = {};
  20. let localVideoThumbnail = null;
  21. let eventEmitter = null;
  22. let largeVideo;
  23. /**
  24. * flipX state of the localVideo
  25. */
  26. let localFlipX = null;
  27. /**
  28. * Handler for local flip X changed event.
  29. * @param {Object} val
  30. */
  31. function onLocalFlipXChanged(val) {
  32. localFlipX = val;
  33. if (largeVideo) {
  34. largeVideo.onLocalFlipXChange(val);
  35. }
  36. }
  37. /**
  38. * Returns an array of all thumbnails in the filmstrip.
  39. *
  40. * @private
  41. * @returns {Array}
  42. */
  43. function getAllThumbnails() {
  44. return [
  45. ...localVideoThumbnail ? [ localVideoThumbnail ] : [],
  46. ...Object.values(remoteVideos)
  47. ];
  48. }
  49. /**
  50. * Private helper to get the redux representation of the local participant.
  51. *
  52. * @private
  53. * @returns {Object}
  54. */
  55. function getLocalParticipant() {
  56. return getLocalParticipantFromStore(APP.store.getState());
  57. }
  58. const VideoLayout = {
  59. init(emitter) {
  60. eventEmitter = emitter;
  61. localVideoThumbnail = new LocalVideo(
  62. VideoLayout,
  63. emitter,
  64. this._updateLargeVideoIfDisplayed.bind(this));
  65. this.registerListeners();
  66. },
  67. /**
  68. * Registering listeners for UI events in Video layout component.
  69. *
  70. * @returns {void}
  71. */
  72. registerListeners() {
  73. eventEmitter.addListener(UIEvents.LOCAL_FLIPX_CHANGED,
  74. onLocalFlipXChanged);
  75. },
  76. /**
  77. * Cleans up state of this singleton {@code VideoLayout}.
  78. *
  79. * @returns {void}
  80. */
  81. reset() {
  82. this._resetLargeVideo();
  83. this._resetFilmstrip();
  84. },
  85. initLargeVideo() {
  86. this._resetLargeVideo();
  87. largeVideo = new LargeVideoManager(eventEmitter);
  88. if (localFlipX) {
  89. largeVideo.onLocalFlipXChange(localFlipX);
  90. }
  91. largeVideo.updateContainerSize();
  92. },
  93. /**
  94. * Sets the audio level of the video elements associated to the given id.
  95. *
  96. * @param id the video identifier in the form it comes from the library
  97. * @param lvl the new audio level to update to
  98. */
  99. setAudioLevel(id, lvl) {
  100. const smallVideo = this.getSmallVideo(id);
  101. if (smallVideo) {
  102. smallVideo.updateAudioLevelIndicator(lvl);
  103. }
  104. if (largeVideo && id === largeVideo.id) {
  105. largeVideo.updateLargeVideoAudioLevel(lvl);
  106. }
  107. },
  108. changeLocalVideo(stream) {
  109. const localId = getLocalParticipant().id;
  110. this.onVideoTypeChanged(localId, stream.videoType);
  111. localVideoThumbnail.changeVideo(stream);
  112. this._updateLargeVideoIfDisplayed(localId);
  113. },
  114. /**
  115. * Get's the localID of the conference and set it to the local video
  116. * (small one). This needs to be called as early as possible, when muc is
  117. * actually joined. Otherwise events can come with information like email
  118. * and setting them assume the id is already set.
  119. */
  120. mucJoined() {
  121. // FIXME: replace this call with a generic update call once SmallVideo
  122. // only contains a ReactElement. Then remove this call once the
  123. // Filmstrip is fully in React.
  124. localVideoThumbnail.updateIndicators();
  125. },
  126. /**
  127. * Shows/hides local video.
  128. * @param {boolean} true to make the local video visible, false - otherwise
  129. */
  130. setLocalVideoVisible(visible) {
  131. localVideoThumbnail.setVisible(visible);
  132. },
  133. onRemoteStreamAdded(stream) {
  134. const id = stream.getParticipantId();
  135. const remoteVideo = remoteVideos[id];
  136. logger.debug(`Received a new ${stream.getType()} stream for ${id}`);
  137. if (!remoteVideo) {
  138. logger.debug('No remote video element to add stream');
  139. return;
  140. }
  141. remoteVideo.addRemoteStreamElement(stream);
  142. // Make sure track's muted state is reflected
  143. if (stream.getType() !== 'audio') {
  144. this.onVideoMute(id);
  145. remoteVideo.updateView();
  146. }
  147. },
  148. onRemoteStreamRemoved(stream) {
  149. const id = stream.getParticipantId();
  150. const remoteVideo = remoteVideos[id];
  151. // Remote stream may be removed after participant left the conference.
  152. if (remoteVideo) {
  153. remoteVideo.removeRemoteStreamElement(stream);
  154. remoteVideo.updateView();
  155. }
  156. this.updateMutedForNoTracks(id, stream.getType());
  157. },
  158. /**
  159. * FIXME get rid of this method once muted indicator are reactified (by
  160. * making sure that user with no tracks is displayed as muted )
  161. *
  162. * If participant has no tracks will make the UI display muted status.
  163. * @param {string} participantId
  164. * @param {string} mediaType 'audio' or 'video'
  165. */
  166. updateMutedForNoTracks(participantId, mediaType) {
  167. const participant = APP.conference.getParticipantById(participantId);
  168. if (participant && !participant.getTracksByMediaType(mediaType).length) {
  169. if (mediaType === 'audio') {
  170. APP.UI.setAudioMuted(participantId, true);
  171. } else if (mediaType === 'video') {
  172. APP.UI.setVideoMuted(participantId);
  173. } else {
  174. logger.error(`Unsupported media type: ${mediaType}`);
  175. }
  176. }
  177. },
  178. /**
  179. * Return the type of the remote video.
  180. * @param id the id for the remote video
  181. * @returns {String} the video type video or screen.
  182. */
  183. getRemoteVideoType(id) {
  184. const state = APP.store.getState();
  185. const participant = getParticipantById(state, id);
  186. if (participant?.isFakeParticipant) {
  187. return SHARED_VIDEO_CONTAINER_TYPE;
  188. }
  189. const videoTrack = getTrackByMediaTypeAndParticipant(state['features/base/tracks'], MEDIA_TYPE.VIDEO, id);
  190. return videoTrack?.videoType;
  191. },
  192. isPinned(id) {
  193. return id === this.getPinnedId();
  194. },
  195. getPinnedId() {
  196. const { id } = getPinnedParticipant(APP.store.getState()) || {};
  197. return id || null;
  198. },
  199. /**
  200. * Triggers a thumbnail to pin or unpin itself.
  201. *
  202. * @param {number} videoNumber - The index of the video to toggle pin on.
  203. * @private
  204. */
  205. togglePin(videoNumber) {
  206. const videos = getAllThumbnails();
  207. const videoView = videos[videoNumber];
  208. videoView && videoView.togglePin();
  209. },
  210. /**
  211. * Callback invoked to update display when the pin participant has changed.
  212. *
  213. * @paramn {string|null} pinnedParticipantID - The participant ID of the
  214. * participant that is pinned or null if no one is pinned.
  215. * @returns {void}
  216. */
  217. onPinChange(pinnedParticipantID) {
  218. if (interfaceConfig.filmStripOnly) {
  219. return;
  220. }
  221. getAllThumbnails().forEach(thumbnail =>
  222. thumbnail.focus(pinnedParticipantID === thumbnail.getId()));
  223. },
  224. /**
  225. * Creates a participant container for the given id.
  226. *
  227. * @param {Object} participant - The redux representation of a remote
  228. * participant.
  229. * @returns {void}
  230. */
  231. addRemoteParticipantContainer(participant) {
  232. if (!participant || participant.local) {
  233. return;
  234. } else if (participant.isFakeParticipant) {
  235. const sharedVideoThumb = new SharedVideoThumb(
  236. participant,
  237. SHARED_VIDEO_CONTAINER_TYPE,
  238. VideoLayout);
  239. this.addRemoteVideoContainer(participant.id, sharedVideoThumb);
  240. return;
  241. }
  242. const id = participant.id;
  243. const jitsiParticipant = APP.conference.getParticipantById(id);
  244. const remoteVideo = new RemoteVideo(jitsiParticipant, VideoLayout);
  245. this._setRemoteControlProperties(jitsiParticipant, remoteVideo);
  246. this.addRemoteVideoContainer(id, remoteVideo);
  247. this.updateMutedForNoTracks(id, 'audio');
  248. this.updateMutedForNoTracks(id, 'video');
  249. },
  250. /**
  251. * Adds remote video container for the given id and <tt>SmallVideo</tt>.
  252. *
  253. * @param {string} the id of the video to add
  254. * @param {SmallVideo} smallVideo the small video instance to add as a
  255. * remote video
  256. */
  257. addRemoteVideoContainer(id, remoteVideo) {
  258. remoteVideos[id] = remoteVideo;
  259. // Initialize the view
  260. remoteVideo.updateView();
  261. },
  262. // FIXME: what does this do???
  263. remoteVideoActive(videoElement, resourceJid) {
  264. logger.info(`${resourceJid} video is now active`, videoElement);
  265. if (videoElement) {
  266. $(videoElement).show();
  267. }
  268. this._updateLargeVideoIfDisplayed(resourceJid, true);
  269. },
  270. /**
  271. * On video muted event.
  272. */
  273. onVideoMute(id) {
  274. if (APP.conference.isLocalId(id)) {
  275. localVideoThumbnail && localVideoThumbnail.updateView();
  276. } else {
  277. const remoteVideo = remoteVideos[id];
  278. if (remoteVideo) {
  279. remoteVideo.updateView();
  280. }
  281. }
  282. // large video will show avatar instead of muted stream
  283. this._updateLargeVideoIfDisplayed(id, true);
  284. },
  285. /**
  286. * Display name changed.
  287. */
  288. onDisplayNameChanged(id) {
  289. if (id === 'localVideoContainer'
  290. || APP.conference.isLocalId(id)) {
  291. localVideoThumbnail.updateDisplayName();
  292. } else {
  293. const remoteVideo = remoteVideos[id];
  294. if (remoteVideo) {
  295. remoteVideo.updateDisplayName();
  296. }
  297. }
  298. },
  299. /**
  300. * On dominant speaker changed event.
  301. *
  302. * @param {string} id - The participant ID of the new dominant speaker.
  303. * @returns {void}
  304. */
  305. onDominantSpeakerChanged(id) {
  306. getAllThumbnails().forEach(thumbnail =>
  307. thumbnail.showDominantSpeakerIndicator(id === thumbnail.getId()));
  308. },
  309. /**
  310. * Shows/hides warning about a user's connectivity issues.
  311. *
  312. * @param {string} id - The ID of the remote participant(MUC nickname).
  313. * @returns {void}
  314. */
  315. onParticipantConnectionStatusChanged(id) {
  316. if (APP.conference.isLocalId(id)) {
  317. return;
  318. }
  319. // We have to trigger full large video update to transition from
  320. // avatar to video on connectivity restored.
  321. this._updateLargeVideoIfDisplayed(id, true);
  322. const remoteVideo = remoteVideos[id];
  323. if (remoteVideo) {
  324. remoteVideo.updateView();
  325. }
  326. },
  327. /**
  328. * On last N change event.
  329. *
  330. * @param endpointsLeavingLastN the list currently leaving last N
  331. * endpoints
  332. * @param endpointsEnteringLastN the list currently entering last N
  333. * endpoints
  334. */
  335. onLastNEndpointsChanged(endpointsLeavingLastN, endpointsEnteringLastN) {
  336. if (endpointsLeavingLastN) {
  337. endpointsLeavingLastN.forEach(this._updateRemoteVideo, this);
  338. }
  339. if (endpointsEnteringLastN) {
  340. endpointsEnteringLastN.forEach(this._updateRemoteVideo, this);
  341. }
  342. },
  343. /**
  344. * Updates remote video by id if it exists.
  345. * @param {string} id of the remote video
  346. * @private
  347. */
  348. _updateRemoteVideo(id) {
  349. const remoteVideo = remoteVideos[id];
  350. if (remoteVideo) {
  351. remoteVideo.updateView();
  352. this._updateLargeVideoIfDisplayed(id);
  353. }
  354. },
  355. /**
  356. * Hides all the indicators
  357. */
  358. hideStats() {
  359. for (const video in remoteVideos) { // eslint-disable-line guard-for-in
  360. const remoteVideo = remoteVideos[video];
  361. if (remoteVideo) {
  362. remoteVideo.removeConnectionIndicator();
  363. }
  364. }
  365. localVideoThumbnail.removeConnectionIndicator();
  366. },
  367. removeParticipantContainer(id) {
  368. // Unlock large video
  369. if (this.getPinnedId() === id) {
  370. logger.info('Focused video owner has left the conference');
  371. APP.store.dispatch(pinParticipant(null));
  372. }
  373. const remoteVideo = remoteVideos[id];
  374. if (remoteVideo) {
  375. // Remove remote video
  376. logger.info(`Removing remote video: ${id}`);
  377. delete remoteVideos[id];
  378. remoteVideo.remove();
  379. } else {
  380. logger.warn(`No remote video for ${id}`);
  381. }
  382. },
  383. onVideoTypeChanged(id, newVideoType) {
  384. const remoteVideo = remoteVideos[id];
  385. if (!remoteVideo) {
  386. return;
  387. }
  388. logger.info('Peer video type changed: ', id, newVideoType);
  389. remoteVideo.updateView();
  390. },
  391. /**
  392. * Resizes the video area.
  393. */
  394. resizeVideoArea() {
  395. if (largeVideo) {
  396. largeVideo.updateContainerSize();
  397. largeVideo.resize(false);
  398. }
  399. },
  400. getSmallVideo(id) {
  401. if (APP.conference.isLocalId(id)) {
  402. return localVideoThumbnail;
  403. }
  404. return remoteVideos[id];
  405. },
  406. changeUserAvatar(id, avatarUrl) {
  407. const smallVideo = VideoLayout.getSmallVideo(id);
  408. if (smallVideo) {
  409. smallVideo.initializeAvatar();
  410. } else {
  411. logger.warn(
  412. `Missed avatar update - no small video yet for ${id}`
  413. );
  414. }
  415. if (this.isCurrentlyOnLarge(id)) {
  416. largeVideo.updateAvatar(avatarUrl);
  417. }
  418. },
  419. isLargeVideoVisible() {
  420. return this.isLargeContainerTypeVisible(VIDEO_CONTAINER_TYPE);
  421. },
  422. /**
  423. * @return {LargeContainer} the currently displayed container on large
  424. * video.
  425. */
  426. getCurrentlyOnLargeContainer() {
  427. return largeVideo.getCurrentContainer();
  428. },
  429. isCurrentlyOnLarge(id) {
  430. return largeVideo && largeVideo.id === id;
  431. },
  432. /**
  433. * Triggers an update of remote video and large video displays so they may
  434. * pick up any state changes that have occurred elsewhere.
  435. *
  436. * @returns {void}
  437. */
  438. updateAllVideos() {
  439. const displayedUserId = this.getLargeVideoID();
  440. if (displayedUserId) {
  441. this.updateLargeVideo(displayedUserId, true);
  442. }
  443. Object.keys(remoteVideos).forEach(video => {
  444. remoteVideos[video].updateView();
  445. });
  446. },
  447. updateLargeVideo(id, forceUpdate) {
  448. if (!largeVideo) {
  449. return;
  450. }
  451. const currentContainer = largeVideo.getCurrentContainer();
  452. const currentContainerType = largeVideo.getCurrentContainerType();
  453. const isOnLarge = this.isCurrentlyOnLarge(id);
  454. const state = APP.store.getState();
  455. const videoTrack = getTrackByMediaTypeAndParticipant(state['features/base/tracks'], MEDIA_TYPE.VIDEO, id);
  456. const videoStream = videoTrack?.jitsiTrack;
  457. if (isOnLarge && !forceUpdate
  458. && LargeVideoManager.isVideoContainer(currentContainerType)
  459. && videoStream) {
  460. const currentStreamId = currentContainer.getStreamID();
  461. const newStreamId = videoStream?.getId() || null;
  462. // FIXME it might be possible to get rid of 'forceUpdate' argument
  463. if (currentStreamId !== newStreamId) {
  464. logger.debug('Enforcing large video update for stream change');
  465. forceUpdate = true; // eslint-disable-line no-param-reassign
  466. }
  467. }
  468. if (!isOnLarge || forceUpdate) {
  469. const videoType = this.getRemoteVideoType(id);
  470. largeVideo.updateLargeVideo(
  471. id,
  472. videoStream,
  473. videoType || VIDEO_TYPE.CAMERA
  474. ).catch(() => {
  475. // do nothing
  476. });
  477. }
  478. },
  479. addLargeVideoContainer(type, container) {
  480. largeVideo && largeVideo.addContainer(type, container);
  481. },
  482. removeLargeVideoContainer(type) {
  483. largeVideo && largeVideo.removeContainer(type);
  484. },
  485. /**
  486. * @returns Promise
  487. */
  488. showLargeVideoContainer(type, show) {
  489. if (!largeVideo) {
  490. return Promise.reject();
  491. }
  492. const isVisible = this.isLargeContainerTypeVisible(type);
  493. if (isVisible === show) {
  494. return Promise.resolve();
  495. }
  496. const currentId = largeVideo.id;
  497. let oldSmallVideo;
  498. if (currentId) {
  499. oldSmallVideo = this.getSmallVideo(currentId);
  500. }
  501. let containerTypeToShow = type;
  502. // if we are hiding a container and there is focusedVideo
  503. // (pinned remote video) use its video type,
  504. // if not then use default type - large video
  505. if (!show) {
  506. const pinnedId = this.getPinnedId();
  507. if (pinnedId) {
  508. containerTypeToShow = this.getRemoteVideoType(pinnedId);
  509. } else {
  510. containerTypeToShow = VIDEO_CONTAINER_TYPE;
  511. }
  512. }
  513. return largeVideo.showContainer(containerTypeToShow)
  514. .then(() => {
  515. if (oldSmallVideo) {
  516. oldSmallVideo && oldSmallVideo.updateView();
  517. }
  518. });
  519. },
  520. isLargeContainerTypeVisible(type) {
  521. return largeVideo && largeVideo.state === type;
  522. },
  523. /**
  524. * Returns the id of the current video shown on large.
  525. * Currently used by tests (torture).
  526. */
  527. getLargeVideoID() {
  528. return largeVideo && largeVideo.id;
  529. },
  530. /**
  531. * Returns the the current video shown on large.
  532. * Currently used by tests (torture).
  533. */
  534. getLargeVideo() {
  535. return largeVideo;
  536. },
  537. /**
  538. * Sets the flipX state of the local video.
  539. * @param {boolean} true for flipped otherwise false;
  540. */
  541. setLocalFlipX(val) {
  542. this.localFlipX = val;
  543. },
  544. /**
  545. * Handles user's features changes.
  546. */
  547. onUserFeaturesChanged(user) {
  548. const video = this.getSmallVideo(user.getId());
  549. if (!video) {
  550. return;
  551. }
  552. this._setRemoteControlProperties(user, video);
  553. },
  554. /**
  555. * Sets the remote control properties (checks whether remote control
  556. * is supported and executes remoteVideo.setRemoteControlSupport).
  557. * @param {JitsiParticipant} user the user that will be checked for remote
  558. * control support.
  559. * @param {RemoteVideo} remoteVideo the remoteVideo on which the properties
  560. * will be set.
  561. */
  562. _setRemoteControlProperties(user, remoteVideo) {
  563. APP.remoteControl.checkUserRemoteControlSupport(user)
  564. .then(result => remoteVideo.setRemoteControlSupport(result))
  565. .catch(error =>
  566. logger.warn(`could not get remote control properties for: ${user.getJid()}`, error));
  567. },
  568. /**
  569. * Returns the wrapper jquery selector for the largeVideo
  570. * @returns {JQuerySelector} the wrapper jquery selector for the largeVideo
  571. */
  572. getLargeVideoWrapper() {
  573. return this.getCurrentlyOnLargeContainer().$wrapper;
  574. },
  575. /**
  576. * Returns the number of remove video ids.
  577. *
  578. * @returns {number} The number of remote videos.
  579. */
  580. getRemoteVideosCount() {
  581. return Object.keys(remoteVideos).length;
  582. },
  583. /**
  584. * Sets the remote control active status for a remote participant.
  585. *
  586. * @param {string} participantID - The id of the remote participant.
  587. * @param {boolean} isActive - The new remote control active status.
  588. * @returns {void}
  589. */
  590. setRemoteControlActiveStatus(participantID, isActive) {
  591. remoteVideos[participantID].setRemoteControlActiveStatus(isActive);
  592. },
  593. /**
  594. * Sets the remote control active status for the local participant.
  595. *
  596. * @returns {void}
  597. */
  598. setLocalRemoteControlActiveChanged() {
  599. Object.values(remoteVideos).forEach(
  600. remoteVideo => remoteVideo.updateRemoteVideoMenu()
  601. );
  602. },
  603. /**
  604. * Helper method to invoke when the video layout has changed and elements
  605. * have to be re-arranged and resized.
  606. *
  607. * @returns {void}
  608. */
  609. refreshLayout() {
  610. localVideoThumbnail && localVideoThumbnail.updateDOMLocation();
  611. VideoLayout.resizeVideoArea();
  612. // Rerender the thumbnails since they are dependant on the layout because of the tooltip positioning.
  613. localVideoThumbnail && localVideoThumbnail.rerender();
  614. Object.values(remoteVideos).forEach(remoteVideoThumbnail => remoteVideoThumbnail.rerender());
  615. },
  616. /**
  617. * Cleans up any existing largeVideo instance.
  618. *
  619. * @private
  620. * @returns {void}
  621. */
  622. _resetLargeVideo() {
  623. if (largeVideo) {
  624. largeVideo.destroy();
  625. }
  626. largeVideo = null;
  627. },
  628. /**
  629. * Cleans up filmstrip state. While a separate {@code Filmstrip} exists, its
  630. * implementation is mainly for querying and manipulating the DOM while
  631. * state mostly remains in {@code VideoLayout}.
  632. *
  633. * @private
  634. * @returns {void}
  635. */
  636. _resetFilmstrip() {
  637. Object.keys(remoteVideos).forEach(remoteVideoId => {
  638. this.removeParticipantContainer(remoteVideoId);
  639. delete remoteVideos[remoteVideoId];
  640. });
  641. if (localVideoThumbnail) {
  642. localVideoThumbnail.remove();
  643. localVideoThumbnail = null;
  644. }
  645. },
  646. /**
  647. * Triggers an update of large video if the passed in participant is
  648. * currently displayed on large video.
  649. *
  650. * @param {string} participantId - The participant ID that should trigger an
  651. * update of large video if displayed.
  652. * @param {boolean} force - Whether or not the large video update should
  653. * happen no matter what.
  654. * @returns {void}
  655. */
  656. _updateLargeVideoIfDisplayed(participantId, force = false) {
  657. if (this.isCurrentlyOnLarge(participantId)) {
  658. this.updateLargeVideo(participantId, force);
  659. }
  660. },
  661. /**
  662. * Handles window resizes.
  663. */
  664. onResize() {
  665. VideoLayout.resizeVideoArea();
  666. }
  667. };
  668. export default VideoLayout;