-
-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unhandled Rejection (TypeError): myVideo.current is undefined #7
Comments
Did you find any solution? |
Don't know if this is still relevant, but this worked for me: With the default boilerplate generated by import ReactDOM from 'react-dom/client';
import './styles/index.css';
import App from './App';
import { ContextProvider } from './Context';
const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
);
root.render(
<ContextProvider>
<App />
</ContextProvider>
); I changed this to match the video and turned it into import ReactDOM from 'react-dom';
import './styles/index.css';
import App from './App';
import { ContextProvider } from './Context';
ReactDOM.render(
<ContextProvider>
<App />
</ContextProvider>,
document.getElementById('root') as HTMLElement
); I am absolutely oblivious as to why this fixes the issue, but it did for me. |
I'm currently facing as issue with this. The project isn't working because of this, I've tried multiple ways, but still haven't gotten a better solution.😤 |
try this, it may help🫥 `
}, []); |
Ok, I'd get back to you.
…On Wed, Nov 9, 2022, 10:47 PM gihev72 ***@***.***> wrote:
try this, it may help🫥
`
useEffect(()=>{
const getMd = async () => {
const currentStream = await navigator.mediaDevices.getUserMedia({video: true, audio: true});
setStream(currentStream);
myVideo.current.srcObject = currentStream;
}
(async ()=> await getMd())();
// getMd()
socket.on("me", (id)=> setMe(id))
socket.on("calluser", ({from, name:callerName, signal})=>{
setCall({isReceiveCall: true, from, name: callerName, signal})
})
}, []);
`
—
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXDOLURGO3EYYOO4LLPDZETWHQLXTANCNFSM5FGVH53A>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
C:/Users/mohdw/Desktop/WebRTC/client/src/SocketContext.js:26
.then((currentStream) => {
setStream(currentStream);
The text was updated successfully, but these errors were encountered: