R
R
Rostislav2021-08-04 21:17:36
JavaScript
Rostislav, 2021-08-04 21:17:36

How to make WebRTC audio work in Google Chrome?

I’m making a broadcast page on react, a MediaStream comes from the server via p2p, which I throw into the video tag via ref.
videoTagS.current.srcObject = stream

The problem is that sound does not work in chrome (for all chromiums), for example, everything is normal in firefox, so it’s hardly a problem in MediaStream, most likely it’s what - a chrome policy similar to this one - https://developer.chrome.com/blog/autoplay/
But I seem to fulfill its requirements, I turned on the standard controllers, turned off authoplay. upd: muted in the tag on purpose, such Google recommendations, but it didn’t help, it completely cut off the sound anyway. I also want to add that I looked at track and audioContext and everything looks normal there Example 194.177 . flag

<video muted controls ref={videoTagS}/>


610b082c13192661981774.png


Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rostislav, 2021-08-12
@rostikowb

Found a solution, suddenly someone come in handy.

It is impossible that there was a player on the page before the user clicked.

The browser does not care that the sound is turned off, that there is nothing to play, that auto playback is generally turned off, it blocks everything if there was even an empty player on the page before clicking. It is necessary to create all contexts (including the player) after pressing the button by the user.

P
profesor08, 2021-08-04
@profesor08

How to make WebRTC audio work in Google Chrome?

video muted controls ref={videoTagS}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question