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.

VirtualScreenshareParticipant.js 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. // @flow
  2. import clsx from 'clsx';
  3. import React from 'react';
  4. import { useSelector } from 'react-redux';
  5. import { VideoTrack } from '../../../base/media';
  6. import { LAYOUTS, getCurrentLayout } from '../../../video-layout';
  7. import ThumbnailBottomIndicators from './ThumbnailBottomIndicators';
  8. import ThumbnailTopIndicators from './ThumbnailTopIndicators';
  9. type Props = {
  10. /**
  11. * An object containing the CSS classes.
  12. */
  13. classes: Object,
  14. /**
  15. * The class name that will be used for the container.
  16. */
  17. containerClassName: string,
  18. /**
  19. * Indicates whether the thumbnail is hovered or not.
  20. */
  21. isHovered: boolean,
  22. /**
  23. * Indicates whether the thumbnail is for local screenshare or not.
  24. */
  25. isLocal: boolean,
  26. /**
  27. * Indicates whether we are currently running in a mobile browser.
  28. */
  29. isMobile: boolean,
  30. /**
  31. * Click handler.
  32. */
  33. onClick: Function,
  34. /**
  35. * Mouse enter handler.
  36. */
  37. onMouseEnter: Function,
  38. /**
  39. * Mouse leave handler.
  40. */
  41. onMouseLeave: Function,
  42. /**
  43. * Mouse move handler.
  44. */
  45. onMouseMove: Function,
  46. /**
  47. * Touch end handler.
  48. */
  49. onTouchEnd: Function,
  50. /**
  51. * Touch move handler.
  52. */
  53. onTouchMove: Function,
  54. /**
  55. * Touch start handler.
  56. */
  57. onTouchStart: Function,
  58. /**
  59. * The ID of the virtual screen share participant.
  60. */
  61. participantId: string,
  62. /**
  63. * An object with the styles for thumbnail.
  64. */
  65. styles: Object,
  66. /**
  67. * The type of thumbnail.
  68. */
  69. thumbnailType: string,
  70. /**
  71. * JitsiTrack instance.
  72. */
  73. videoTrack: Object
  74. }
  75. const VirtualScreenshareParticipant = ({
  76. classes,
  77. containerClassName,
  78. isHovered,
  79. isLocal,
  80. isMobile,
  81. onClick,
  82. onMouseEnter,
  83. onMouseLeave,
  84. onMouseMove,
  85. onTouchEnd,
  86. onTouchMove,
  87. onTouchStart,
  88. participantId,
  89. styles,
  90. videoTrack,
  91. thumbnailType
  92. }: Props) => {
  93. const currentLayout = useSelector(getCurrentLayout);
  94. const videoTrackId = videoTrack?.jitsiTrack?.getId();
  95. const video = videoTrack && <VideoTrack
  96. id = { isLocal ? 'localScreenshare_container' : `remoteVideo_${videoTrackId || ''}` }
  97. muted = { true }
  98. style = { styles.video }
  99. videoTrack = { videoTrack } />;
  100. return (
  101. <span
  102. className = { containerClassName }
  103. id = { `participant_${participantId}` }
  104. { ...(isMobile
  105. ? {
  106. onTouchEnd,
  107. onTouchMove,
  108. onTouchStart
  109. }
  110. : {
  111. onClick,
  112. onMouseEnter,
  113. onMouseMove,
  114. onMouseLeave
  115. }
  116. ) }
  117. style = { styles.thumbnail }>
  118. {video}
  119. <div className = { classes.containerBackground } />
  120. <div
  121. className = { clsx(classes.indicatorsContainer,
  122. classes.indicatorsTopContainer,
  123. currentLayout === LAYOUTS.TILE_VIEW && 'tile-view-mode'
  124. ) }>
  125. <ThumbnailTopIndicators
  126. currentLayout = { currentLayout }
  127. isHovered = { isHovered }
  128. participantId = { participantId }
  129. thumbnailType = { thumbnailType } />
  130. </div>
  131. <div
  132. className = { clsx(classes.indicatorsContainer,
  133. classes.indicatorsBottomContainer,
  134. currentLayout === LAYOUTS.TILE_VIEW && 'tile-view-mode'
  135. ) }>
  136. <ThumbnailBottomIndicators
  137. className = { classes.indicatorsBackground }
  138. currentLayout = { currentLayout }
  139. local = { false }
  140. participantId = { participantId }
  141. showStatusIndicators = { true } />
  142. </div>
  143. </span>);
  144. };
  145. export default VirtualScreenshareParticipant;