video sort of working, only master seeing it or pre-xisting users seeing new user stream
This commit is contained in:
@@ -198,7 +198,7 @@ function StreamRoom({
|
|||||||
if (userDetails) {
|
if (userDetails) {
|
||||||
navigator.mediaDevices
|
navigator.mediaDevices
|
||||||
.getUserMedia({
|
.getUserMedia({
|
||||||
video: false,
|
video: true,
|
||||||
audio: {
|
audio: {
|
||||||
echoCancellation: true,
|
echoCancellation: true,
|
||||||
autoGainControl: true,
|
autoGainControl: true,
|
||||||
@@ -207,24 +207,25 @@ function StreamRoom({
|
|||||||
.then((userStream) => {
|
.then((userStream) => {
|
||||||
setLocalStream(userStream);
|
setLocalStream(userStream);
|
||||||
|
|
||||||
// if (userStreamTagRef?.current)
|
if (userStreamTagRef?.current)
|
||||||
// userStreamTagRef.current.srcObject = userStream;
|
userStreamTagRef.current.srcObject = userStream;
|
||||||
|
|
||||||
// alternative to dom element
|
// alternative to dom element
|
||||||
// const audio = new Audio();
|
// const audio = new Audio();
|
||||||
// audio.autoplay = true;
|
// audio.autoplay = true;
|
||||||
// audio.srcObject = userStream;
|
// audio.srcObject = userStream;
|
||||||
|
|
||||||
|
// !TEST STUFF
|
||||||
// test distortion to go away on disabling audio
|
// test distortion to go away on disabling audio
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
console.log("stopping audio stream ");
|
// console.log("stopping audio stream ");
|
||||||
|
|
||||||
userStream.getTracks().forEach((track) => {
|
// userStream.getTracks().forEach((track) => {
|
||||||
track.enabled = !track.enabled;
|
// track.enabled = !track.enabled;
|
||||||
|
|
||||||
track.stop();
|
// track.stop();
|
||||||
});
|
// });
|
||||||
}, 2000);
|
// }, 2000);
|
||||||
|
|
||||||
// take the initial list of tunedInUsers without my own id
|
// take the initial list of tunedInUsers without my own id
|
||||||
const everyOtherTunedUserId = tunedInUsers.filter(
|
const everyOtherTunedUserId = tunedInUsers.filter(
|
||||||
@@ -367,7 +368,13 @@ function StreamRoom({
|
|||||||
// we only loop through peers that are associated to user Ids which exist in the currentBroadcasters array
|
// we only loop through peers that are associated to user Ids which exist in the currentBroadcasters array
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<audio autoPlay ref={userStreamTagRef} muted />
|
<video
|
||||||
|
height={"200"}
|
||||||
|
width={"300"}
|
||||||
|
autoPlay
|
||||||
|
ref={userStreamTagRef}
|
||||||
|
muted
|
||||||
|
/>
|
||||||
this is the video of people
|
this is the video of people
|
||||||
{userPeers &&
|
{userPeers &&
|
||||||
Object.entries(userPeers).map(([userId, peer]) => (
|
Object.entries(userPeers).map(([userId, peer]) => (
|
||||||
@@ -409,7 +416,13 @@ function PeerStreamRenderer({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<audio muted={!isBroadcasting} autoPlay ref={streamRef} />
|
<video
|
||||||
|
height={"400"}
|
||||||
|
width={"500"}
|
||||||
|
muted={!isBroadcasting}
|
||||||
|
autoPlay
|
||||||
|
ref={streamRef}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user