Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/components/VideoPlayer/VideoPlayer.tsx b/src/components/VideoPlayer/VideoPlayer.tsx
- index 64c2b12..f0ad0e0 100644
- --- a/src/components/VideoPlayer/VideoPlayer.tsx
- +++ b/src/components/VideoPlayer/VideoPlayer.tsx
- @@ -223,16 +223,7 @@ function VideoPlayer({id, videoRef, display, isLocalParticipant, audio, video}:
- }
- useEffect(() => {
- - const videoElement = document.getElementById("publisher-video-"+id.toString());
- - if(isLocalParticipant && videoTrack){
- - const localStream = new MediaStream();
- - localStream.addTrack(videoTrack);
- - attachmediastream(videoElement, localStream);
- - }
- - else if(videoRef!==null)
- - {
- - attachmediastream(videoElement, videoRef);
- - }
- +
- });
- return (
- diff --git a/src/components/VideoRoomPublishers/VideoRoomPublishers.tsx b/src/components/VideoRoomPublishers/VideoRoomPublishers.tsx
- index 186a1b4..8d4fdf0 100644
- --- a/src/components/VideoRoomPublishers/VideoRoomPublishers.tsx
- +++ b/src/components/VideoRoomPublishers/VideoRoomPublishers.tsx
- @@ -111,35 +111,20 @@ export default function VideoRoomPublishers(
- </div>
- }
- <div id="Dish">
- - {modifiedList.map((participant : Participant, index) => {
- - if(index >= current && index < current + itemsPerPage)
- - {
- - return (
- - <div key={participant.id} className="Camera">
- - {(participant.video && (participant.videoRef || (participant.id === localUser?.id))) ?
- - <VideoPlayer
- - id={participant.id}
- - videoRef={participant.videoRef}
- - display={participant.username}
- - muted={participant.audio}
- - isLocalParticipant={ participant.id === localUser?.id }
- - video={participant.video}
- - audio={participant.audio}
- - />
- - :
- - <Thumbnail
- - id={participant.id}
- - display={participant.username}
- - muted={participant.audio}
- - audio={participant.audio}
- - video={participant.video}
- - isLocalParticipant={ participant.id === localUser?.id }
- - />
- - }
- - </div>
- - );
- - }
- - else return null;
- + {[0,1,2,3,4,5].map((item,index)=>{
- + return (
- + <div key={index.toString()} className="Camera">
- + <VideoPlayer
- + id={index.toString()}
- + videoRef={null}
- + display={"fixed-"+index.toString()}
- + muted={false}
- + isLocalParticipant={ false }
- + video={true}
- + audio={true}
- + />
- + </div>
- + )
- })}
- </div>
- {modifiedList.length > 0 &&
- diff --git a/src/components/janus/videoroom/VideoRoomHybrid.tsx b/src/components/janus/videoroom/VideoRoomHybrid.tsx
- index 513e554..c97eb36 100644
- --- a/src/components/janus/videoroom/VideoRoomHybrid.tsx
- +++ b/src/components/janus/videoroom/VideoRoomHybrid.tsx
- @@ -12,7 +12,7 @@ import {useMediaQuery} from '@material-ui/core';
- // import BottomNavBar from '../../BottomNavBar/BottomNavBar'
- import VideoRoomPublishers from "../../VideoRoomPublishers/VideoRoomPublishers";
- -import attachmediastream from "../../../../src/services/plugins/attachmediastream";
- +import attachmediastream from '../../../plugins/attachmediastream';
- import {useDispatch} from 'react-redux';
- import {
- ADD_PUBLISHER,
- @@ -127,6 +127,7 @@ export default function VideoRoomHybrid({
- const incomingAudioStream = useRef<any>();
- const roomObj = useRef<any>();
- const dispatch = useDispatch();
- + const vid = useRef<number>(0);
- const [callId, setCallId] = useState(sessionStorage.getItem('call_id') || '');
- const isMobile = useMediaQuery('(max-width:480px)');
- @@ -245,7 +246,14 @@ export default function VideoRoomHybrid({
- function addStreamToParticipant(publisher_id: number, stream: MediaStream | null) {
- publisherStreamMap.current?.set(publisher_id,stream);
- - updateMqttParticipantStreamActionCreator({publisher_id: publisher_id, stream: stream});
- + let videoElement: HTMLVideoElement = document.getElementById("publisher-video-"+vid.current.toString()) as HTMLVideoElement;
- + // if(stream && videoElement && !videoElement.srcObject){
- + if(stream && videoElement){
- + console.log('srcObject: ',videoElement.srcObject);
- + attachmediastream(videoElement,stream);
- + vid.current = (vid.current + 1 === 6)? 0 : vid.current + 1;
- + }
- + // updateMqttParticipantStreamActionCreator({publisher_id: publisher_id, stream: stream});
- }
- function updatePublisherAudio(data: {id: number, muted: boolean}) {
- @@ -520,7 +528,7 @@ export default function VideoRoomHybrid({
- };
- return (
- - <React.Fragment>(
- + <React.Fragment>
- {inRoom && <video
- id={"all-audio-player"}
- ref={incomingAudioStream}
- tigerit@tigerit-OptiPlex-7060:~/projects/javascript/janus-web$
Advertisement
Add Comment
Please, Sign In to add comment