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.

VideoLayout.js 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796
  1. /* global APP, $ */
  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. getAllThumbnails().forEach(thumbnail =>
  219. thumbnail.focus(pinnedParticipantID === thumbnail.getId()));
  220. },
  221. /**
  222. * Creates a participant container for the given id.
  223. *
  224. * @param {Object} participant - The redux representation of a remote
  225. * participant.
  226. * @returns {void}
  227. */
  228. addRemoteParticipantContainer(participant) {
  229. if (!participant || participant.local) {
  230. return;
  231. } else if (participant.isFakeParticipant) {
  232. const sharedVideoThumb = new SharedVideoThumb(
  233. participant,
  234. SHARED_VIDEO_CONTAINER_TYPE,
  235. VideoLayout);
  236. this.addRemoteVideoContainer(participant.id, sharedVideoThumb);
  237. return;
  238. }
  239. const id = participant.id;
  240. const jitsiParticipant = APP.conference.getParticipantById(id);
  241. const remoteVideo = new RemoteVideo(jitsiParticipant, VideoLayout);
  242. this._setRemoteControlProperties(jitsiParticipant, remoteVideo);
  243. this.addRemoteVideoContainer(id, remoteVideo);
  244. this.updateMutedForNoTracks(id, 'audio');
  245. this.updateMutedForNoTracks(id, 'video');
  246. },
  247. /**
  248. * Adds remote video container for the given id and <tt>SmallVideo</tt>.
  249. *
  250. * @param {string} the id of the video to add
  251. * @param {SmallVideo} smallVideo the small video instance to add as a
  252. * remote video
  253. */
  254. addRemoteVideoContainer(id, remoteVideo) {
  255. remoteVideos[id] = remoteVideo;
  256. // Initialize the view
  257. remoteVideo.updateView();
  258. },
  259. // FIXME: what does this do???
  260. remoteVideoActive(videoElement, resourceJid) {
  261. logger.info(`${resourceJid} video is now active`, videoElement);
  262. if (videoElement) {
  263. $(videoElement).show();
  264. }
  265. this._updateLargeVideoIfDisplayed(resourceJid, true);
  266. },
  267. /**
  268. * On video muted event.
  269. */
  270. onVideoMute(id) {
  271. if (APP.conference.isLocalId(id)) {
  272. localVideoThumbnail && localVideoThumbnail.updateView();
  273. } else {
  274. const remoteVideo = remoteVideos[id];
  275. if (remoteVideo) {
  276. remoteVideo.updateView();
  277. }
  278. }
  279. // large video will show avatar instead of muted stream
  280. this._updateLargeVideoIfDisplayed(id, true);
  281. },
  282. /**
  283. * Display name changed.
  284. */
  285. onDisplayNameChanged(id) {
  286. if (id === 'localVideoContainer'
  287. || APP.conference.isLocalId(id)) {
  288. localVideoThumbnail.updateDisplayName();
  289. } else {
  290. const remoteVideo = remoteVideos[id];
  291. if (remoteVideo) {
  292. remoteVideo.updateDisplayName();
  293. }
  294. }
  295. },
  296. /**
  297. * On dominant speaker changed event.
  298. *
  299. * @param {string} id - The participant ID of the new dominant speaker.
  300. * @returns {void}
  301. */
  302. onDominantSpeakerChanged(id) {
  303. getAllThumbnails().forEach(thumbnail =>
  304. thumbnail.showDominantSpeakerIndicator(id === thumbnail.getId()));
  305. },
  306. /**
  307. * Shows/hides warning about a user's connectivity issues.
  308. *
  309. * @param {string} id - The ID of the remote participant(MUC nickname).
  310. * @returns {void}
  311. */
  312. onParticipantConnectionStatusChanged(id) {
  313. if (APP.conference.isLocalId(id)) {
  314. return;
  315. }
  316. // We have to trigger full large video update to transition from
  317. // avatar to video on connectivity restored.
  318. this._updateLargeVideoIfDisplayed(id, true);
  319. const remoteVideo = remoteVideos[id];
  320. if (remoteVideo) {
  321. remoteVideo.updateView();
  322. }
  323. },
  324. /**
  325. * On last N change event.
  326. *
  327. * @param endpointsLeavingLastN the list currently leaving last N
  328. * endpoints
  329. * @param endpointsEnteringLastN the list currently entering last N
  330. * endpoints
  331. */
  332. onLastNEndpointsChanged(endpointsLeavingLastN, endpointsEnteringLastN) {
  333. if (endpointsLeavingLastN) {
  334. endpointsLeavingLastN.forEach(this._updateRemoteVideo, this);
  335. }
  336. if (endpointsEnteringLastN) {
  337. endpointsEnteringLastN.forEach(this._updateRemoteVideo, this);
  338. }
  339. },
  340. /**
  341. * Updates remote video by id if it exists.
  342. * @param {string} id of the remote video
  343. * @private
  344. */
  345. _updateRemoteVideo(id) {
  346. const remoteVideo = remoteVideos[id];
  347. if (remoteVideo) {
  348. remoteVideo.updateView();
  349. this._updateLargeVideoIfDisplayed(id);
  350. }
  351. },
  352. /**
  353. * Hides all the indicators
  354. */
  355. hideStats() {
  356. for (const video in remoteVideos) { // eslint-disable-line guard-for-in
  357. const remoteVideo = remoteVideos[video];
  358. if (remoteVideo) {
  359. remoteVideo.removeConnectionIndicator();
  360. }
  361. }
  362. localVideoThumbnail.removeConnectionIndicator();
  363. },
  364. removeParticipantContainer(id) {
  365. // Unlock large video
  366. if (this.getPinnedId() === id) {
  367. logger.info('Focused video owner has left the conference');
  368. APP.store.dispatch(pinParticipant(null));
  369. }
  370. const remoteVideo = remoteVideos[id];
  371. if (remoteVideo) {
  372. // Remove remote video
  373. logger.info(`Removing remote video: ${id}`);
  374. delete remoteVideos[id];
  375. remoteVideo.remove();
  376. } else {
  377. logger.warn(`No remote video for ${id}`);
  378. }
  379. },
  380. onVideoTypeChanged(id, newVideoType) {
  381. const remoteVideo = remoteVideos[id];
  382. if (!remoteVideo) {
  383. return;
  384. }
  385. logger.info('Peer video type changed: ', id, newVideoType);
  386. remoteVideo.updateView();
  387. },
  388. /**
  389. * Resizes the video area.
  390. */
  391. resizeVideoArea() {
  392. if (largeVideo) {
  393. largeVideo.updateContainerSize();
  394. largeVideo.resize(false);
  395. }
  396. },
  397. getSmallVideo(id) {
  398. if (APP.conference.isLocalId(id)) {
  399. return localVideoThumbnail;
  400. }
  401. return remoteVideos[id];
  402. },
  403. changeUserAvatar(id, avatarUrl) {
  404. const smallVideo = VideoLayout.getSmallVideo(id);
  405. if (smallVideo) {
  406. smallVideo.initializeAvatar();
  407. } else {
  408. logger.warn(
  409. `Missed avatar update - no small video yet for ${id}`
  410. );
  411. }
  412. if (this.isCurrentlyOnLarge(id)) {
  413. largeVideo.updateAvatar(avatarUrl);
  414. }
  415. },
  416. isLargeVideoVisible() {
  417. return this.isLargeContainerTypeVisible(VIDEO_CONTAINER_TYPE);
  418. },
  419. /**
  420. * @return {LargeContainer} the currently displayed container on large
  421. * video.
  422. */
  423. getCurrentlyOnLargeContainer() {
  424. return largeVideo.getCurrentContainer();
  425. },
  426. isCurrentlyOnLarge(id) {
  427. return largeVideo && largeVideo.id === id;
  428. },
  429. /**
  430. * Triggers an update of remote video and large video displays so they may
  431. * pick up any state changes that have occurred elsewhere.
  432. *
  433. * @returns {void}
  434. */
  435. updateAllVideos() {
  436. const displayedUserId = this.getLargeVideoID();
  437. if (displayedUserId) {
  438. this.updateLargeVideo(displayedUserId, true);
  439. }
  440. Object.keys(remoteVideos).forEach(video => {
  441. remoteVideos[video].updateView();
  442. });
  443. },
  444. updateLargeVideo(id, forceUpdate) {
  445. if (!largeVideo) {
  446. return;
  447. }
  448. const currentContainer = largeVideo.getCurrentContainer();
  449. const currentContainerType = largeVideo.getCurrentContainerType();
  450. const isOnLarge = this.isCurrentlyOnLarge(id);
  451. const state = APP.store.getState();
  452. const videoTrack = getTrackByMediaTypeAndParticipant(state['features/base/tracks'], MEDIA_TYPE.VIDEO, id);
  453. const videoStream = videoTrack?.jitsiTrack;
  454. if (isOnLarge && !forceUpdate
  455. && LargeVideoManager.isVideoContainer(currentContainerType)
  456. && videoStream) {
  457. const currentStreamId = currentContainer.getStreamID();
  458. const newStreamId = videoStream?.getId() || null;
  459. // FIXME it might be possible to get rid of 'forceUpdate' argument
  460. if (currentStreamId !== newStreamId) {
  461. logger.debug('Enforcing large video update for stream change');
  462. forceUpdate = true; // eslint-disable-line no-param-reassign
  463. }
  464. }
  465. if (!isOnLarge || forceUpdate) {
  466. const videoType = this.getRemoteVideoType(id);
  467. largeVideo.updateLargeVideo(
  468. id,
  469. videoStream,
  470. videoType || VIDEO_TYPE.CAMERA
  471. ).catch(() => {
  472. // do nothing
  473. });
  474. }
  475. },
  476. addLargeVideoContainer(type, container) {
  477. largeVideo && largeVideo.addContainer(type, container);
  478. },
  479. removeLargeVideoContainer(type) {
  480. largeVideo && largeVideo.removeContainer(type);
  481. },
  482. /**
  483. * @returns Promise
  484. */
  485. showLargeVideoContainer(type, show) {
  486. if (!largeVideo) {
  487. return Promise.reject();
  488. }
  489. const isVisible = this.isLargeContainerTypeVisible(type);
  490. if (isVisible === show) {
  491. return Promise.resolve();
  492. }
  493. const currentId = largeVideo.id;
  494. let oldSmallVideo;
  495. if (currentId) {
  496. oldSmallVideo = this.getSmallVideo(currentId);
  497. }
  498. let containerTypeToShow = type;
  499. // if we are hiding a container and there is focusedVideo
  500. // (pinned remote video) use its video type,
  501. // if not then use default type - large video
  502. if (!show) {
  503. const pinnedId = this.getPinnedId();
  504. if (pinnedId) {
  505. containerTypeToShow = this.getRemoteVideoType(pinnedId);
  506. } else {
  507. containerTypeToShow = VIDEO_CONTAINER_TYPE;
  508. }
  509. }
  510. return largeVideo.showContainer(containerTypeToShow)
  511. .then(() => {
  512. if (oldSmallVideo) {
  513. oldSmallVideo && oldSmallVideo.updateView();
  514. }
  515. });
  516. },
  517. isLargeContainerTypeVisible(type) {
  518. return largeVideo && largeVideo.state === type;
  519. },
  520. /**
  521. * Returns the id of the current video shown on large.
  522. * Currently used by tests (torture).
  523. */
  524. getLargeVideoID() {
  525. return largeVideo && largeVideo.id;
  526. },
  527. /**
  528. * Returns the the current video shown on large.
  529. * Currently used by tests (torture).
  530. */
  531. getLargeVideo() {
  532. return largeVideo;
  533. },
  534. /**
  535. * Sets the flipX state of the local video.
  536. * @param {boolean} true for flipped otherwise false;
  537. */
  538. setLocalFlipX(val) {
  539. this.localFlipX = val;
  540. },
  541. /**
  542. * Handles user's features changes.
  543. */
  544. onUserFeaturesChanged(user) {
  545. const video = this.getSmallVideo(user.getId());
  546. if (!video) {
  547. return;
  548. }
  549. this._setRemoteControlProperties(user, video);
  550. },
  551. /**
  552. * Sets the remote control properties (checks whether remote control
  553. * is supported and executes remoteVideo.setRemoteControlSupport).
  554. * @param {JitsiParticipant} user the user that will be checked for remote
  555. * control support.
  556. * @param {RemoteVideo} remoteVideo the remoteVideo on which the properties
  557. * will be set.
  558. */
  559. _setRemoteControlProperties(user, remoteVideo) {
  560. APP.remoteControl.checkUserRemoteControlSupport(user)
  561. .then(result => remoteVideo.setRemoteControlSupport(result))
  562. .catch(error =>
  563. logger.warn(`could not get remote control properties for: ${user.getJid()}`, error));
  564. },
  565. /**
  566. * Returns the wrapper jquery selector for the largeVideo
  567. * @returns {JQuerySelector} the wrapper jquery selector for the largeVideo
  568. */
  569. getLargeVideoWrapper() {
  570. return this.getCurrentlyOnLargeContainer().$wrapper;
  571. },
  572. /**
  573. * Returns the number of remove video ids.
  574. *
  575. * @returns {number} The number of remote videos.
  576. */
  577. getRemoteVideosCount() {
  578. return Object.keys(remoteVideos).length;
  579. },
  580. /**
  581. * Sets the remote control active status for a remote participant.
  582. *
  583. * @param {string} participantID - The id of the remote participant.
  584. * @param {boolean} isActive - The new remote control active status.
  585. * @returns {void}
  586. */
  587. setRemoteControlActiveStatus(participantID, isActive) {
  588. remoteVideos[participantID].setRemoteControlActiveStatus(isActive);
  589. },
  590. /**
  591. * Sets the remote control active status for the local participant.
  592. *
  593. * @returns {void}
  594. */
  595. setLocalRemoteControlActiveChanged() {
  596. Object.values(remoteVideos).forEach(
  597. remoteVideo => remoteVideo.updateRemoteVideoMenu()
  598. );
  599. },
  600. /**
  601. * Helper method to invoke when the video layout has changed and elements
  602. * have to be re-arranged and resized.
  603. *
  604. * @returns {void}
  605. */
  606. refreshLayout() {
  607. localVideoThumbnail && localVideoThumbnail.updateDOMLocation();
  608. VideoLayout.resizeVideoArea();
  609. // Rerender the thumbnails since they are dependant on the layout because of the tooltip positioning.
  610. localVideoThumbnail && localVideoThumbnail.rerender();
  611. Object.values(remoteVideos).forEach(remoteVideoThumbnail => remoteVideoThumbnail.rerender());
  612. },
  613. /**
  614. * Cleans up any existing largeVideo instance.
  615. *
  616. * @private
  617. * @returns {void}
  618. */
  619. _resetLargeVideo() {
  620. if (largeVideo) {
  621. largeVideo.destroy();
  622. }
  623. largeVideo = null;
  624. },
  625. /**
  626. * Cleans up filmstrip state. While a separate {@code Filmstrip} exists, its
  627. * implementation is mainly for querying and manipulating the DOM while
  628. * state mostly remains in {@code VideoLayout}.
  629. *
  630. * @private
  631. * @returns {void}
  632. */
  633. _resetFilmstrip() {
  634. Object.keys(remoteVideos).forEach(remoteVideoId => {
  635. this.removeParticipantContainer(remoteVideoId);
  636. delete remoteVideos[remoteVideoId];
  637. });
  638. if (localVideoThumbnail) {
  639. localVideoThumbnail.remove();
  640. localVideoThumbnail = null;
  641. }
  642. },
  643. /**
  644. * Triggers an update of large video if the passed in participant is
  645. * currently displayed on large video.
  646. *
  647. * @param {string} participantId - The participant ID that should trigger an
  648. * update of large video if displayed.
  649. * @param {boolean} force - Whether or not the large video update should
  650. * happen no matter what.
  651. * @returns {void}
  652. */
  653. _updateLargeVideoIfDisplayed(participantId, force = false) {
  654. if (this.isCurrentlyOnLarge(participantId)) {
  655. this.updateLargeVideo(participantId, force);
  656. }
  657. },
  658. /**
  659. * Handles window resizes.
  660. */
  661. onResize() {
  662. VideoLayout.resizeVideoArea();
  663. }
  664. };
  665. export default VideoLayout;