Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

228
Views
Black screen when switching from video.srcObject to video.src using in Safari

I have an application where we are using the user's webcam for recording a video. For that i just use the following

const stream = await navigator.mediaDevices.getUserMedia({ video: true, audio: true })
video.srcObject = stream

Now I record the video using MediaRecorder API and when I stop recording, i simply set the srcObject to be null and use the recording as a url stored in the state simply using the below code.

video.srcObject = null
const url = URL.createObjectURL(recording)
setState({ url })

So what happens is, until I have something in srcObject for example while it is streaming or recording, it works fine. But when I stop the recording and set the srcObject to be null it does not autoplay the video. Although the video has received the src from the state. I have checked in the Safari dev-tools, the src is updated in the DOM properly.

Another debugging that I have already done is. If I do not set the video.srcObject = stream while starting the camera then everything works fine, like I can record, stop recording and then boom it autoplays the video that too with audio(not to forget, if I do not set the srcObject then unless I stop recording I am not able to see anything).

Any ideas or suggestions are welcome

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!