sak1b

fixed 6

Dec 22nd, 2021
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.14 KB | None | 0 0
  1. diff --git a/src/components/VideoPlayer/VideoPlayer.tsx b/src/components/VideoPlayer/VideoPlayer.tsx
  2. index 64c2b12..f0ad0e0 100644
  3. --- a/src/components/VideoPlayer/VideoPlayer.tsx
  4. +++ b/src/components/VideoPlayer/VideoPlayer.tsx
  5. @@ -223,16 +223,7 @@ function VideoPlayer({id, videoRef, display, isLocalParticipant, audio, video}:
  6. }
  7.  
  8. useEffect(() => {
  9. - const videoElement = document.getElementById("publisher-video-"+id.toString());
  10. - if(isLocalParticipant && videoTrack){
  11. - const localStream = new MediaStream();
  12. - localStream.addTrack(videoTrack);
  13. - attachmediastream(videoElement, localStream);
  14. - }
  15. - else if(videoRef!==null)
  16. - {
  17. - attachmediastream(videoElement, videoRef);
  18. - }
  19. +
  20. });
  21.  
  22. return (
  23. diff --git a/src/components/VideoRoomPublishers/VideoRoomPublishers.tsx b/src/components/VideoRoomPublishers/VideoRoomPublishers.tsx
  24. index 186a1b4..8d4fdf0 100644
  25. --- a/src/components/VideoRoomPublishers/VideoRoomPublishers.tsx
  26. +++ b/src/components/VideoRoomPublishers/VideoRoomPublishers.tsx
  27. @@ -111,35 +111,20 @@ export default function VideoRoomPublishers(
  28. </div>
  29. }
  30. <div id="Dish">
  31. - {modifiedList.map((participant : Participant, index) => {
  32. - if(index >= current && index < current + itemsPerPage)
  33. - {
  34. - return (
  35. - <div key={participant.id} className="Camera">
  36. - {(participant.video && (participant.videoRef || (participant.id === localUser?.id))) ?
  37. - <VideoPlayer
  38. - id={participant.id}
  39. - videoRef={participant.videoRef}
  40. - display={participant.username}
  41. - muted={participant.audio}
  42. - isLocalParticipant={ participant.id === localUser?.id }
  43. - video={participant.video}
  44. - audio={participant.audio}
  45. - />
  46. - :
  47. - <Thumbnail
  48. - id={participant.id}
  49. - display={participant.username}
  50. - muted={participant.audio}
  51. - audio={participant.audio}
  52. - video={participant.video}
  53. - isLocalParticipant={ participant.id === localUser?.id }
  54. - />
  55. - }
  56. - </div>
  57. - );
  58. - }
  59. - else return null;
  60. + {[0,1,2,3,4,5].map((item,index)=>{
  61. + return (
  62. + <div key={index.toString()} className="Camera">
  63. + <VideoPlayer
  64. + id={index.toString()}
  65. + videoRef={null}
  66. + display={"fixed-"+index.toString()}
  67. + muted={false}
  68. + isLocalParticipant={ false }
  69. + video={true}
  70. + audio={true}
  71. + />
  72. + </div>
  73. + )
  74. })}
  75. </div>
  76. {modifiedList.length > 0 &&
  77. diff --git a/src/components/janus/videoroom/VideoRoomHybrid.tsx b/src/components/janus/videoroom/VideoRoomHybrid.tsx
  78. index 513e554..c97eb36 100644
  79. --- a/src/components/janus/videoroom/VideoRoomHybrid.tsx
  80. +++ b/src/components/janus/videoroom/VideoRoomHybrid.tsx
  81. @@ -12,7 +12,7 @@ import {useMediaQuery} from '@material-ui/core';
  82.  
  83. // import BottomNavBar from '../../BottomNavBar/BottomNavBar'
  84. import VideoRoomPublishers from "../../VideoRoomPublishers/VideoRoomPublishers";
  85. -import attachmediastream from "../../../../src/services/plugins/attachmediastream";
  86. +import attachmediastream from '../../../plugins/attachmediastream';
  87. import {useDispatch} from 'react-redux';
  88. import {
  89. ADD_PUBLISHER,
  90. @@ -127,6 +127,7 @@ export default function VideoRoomHybrid({
  91. const incomingAudioStream = useRef<any>();
  92. const roomObj = useRef<any>();
  93. const dispatch = useDispatch();
  94. + const vid = useRef<number>(0);
  95.  
  96. const [callId, setCallId] = useState(sessionStorage.getItem('call_id') || '');
  97. const isMobile = useMediaQuery('(max-width:480px)');
  98. @@ -245,7 +246,14 @@ export default function VideoRoomHybrid({
  99.  
  100. function addStreamToParticipant(publisher_id: number, stream: MediaStream | null) {
  101. publisherStreamMap.current?.set(publisher_id,stream);
  102. - updateMqttParticipantStreamActionCreator({publisher_id: publisher_id, stream: stream});
  103. + let videoElement: HTMLVideoElement = document.getElementById("publisher-video-"+vid.current.toString()) as HTMLVideoElement;
  104. + // if(stream && videoElement && !videoElement.srcObject){
  105. + if(stream && videoElement){
  106. + console.log('srcObject: ',videoElement.srcObject);
  107. + attachmediastream(videoElement,stream);
  108. + vid.current = (vid.current + 1 === 6)? 0 : vid.current + 1;
  109. + }
  110. + // updateMqttParticipantStreamActionCreator({publisher_id: publisher_id, stream: stream});
  111. }
  112.  
  113. function updatePublisherAudio(data: {id: number, muted: boolean}) {
  114. @@ -520,7 +528,7 @@ export default function VideoRoomHybrid({
  115. };
  116.  
  117. return (
  118. - <React.Fragment>(
  119. + <React.Fragment>
  120. {inRoom && <video
  121. id={"all-audio-player"}
  122. ref={incomingAudioStream}
  123. tigerit@tigerit-OptiPlex-7060:~/projects/javascript/janus-web$
  124.  
Advertisement
Add Comment
Please, Sign In to add comment