简体   繁体   中英

WebRTC remote-stream video readyState : “muted” while audio is working

everything just works fine (createOffer, createAnswer, iceCandidates, ...), but then the incoming remoteStream has 2 tracks, the audioTrack which is working and the videoTrack which is not working with readyState: "muted".

if i do createOffer on pageload and then with start call do crreateOffer again with the same peerConnection, also the video displays correctly (but then i'll get in firefox the "Cannot create offer in state have-local-offer".

any ideas what could be the problem? (code is quite too complex for showing here)

Can you the local video on both the sides?
-> In a pc only one browser will get access to camera at any time either chrome/firefox)
-> Try calling between two different machines or chrome-to-chrome or firefox-to-firefox.

"Cannot create offer in state have-local-offer"
It mean you already created an offer and trying to create again without setting remote answer.

Calling createOffer again is not good idea. Make sure you create the offer in the following way(synchronously).

  • After receiving the stream gUM callback, then add it peerConnection.
  • After adding the stream then create the offer, in case of answer set remote offer also before creating answer.

I was having this issue while preparing the MediaStream on the iOS app. It turns out the the I wasn't passing the correct RTCMediaConstraints .

The problem resolved after I switch and use [RTCMediaConstraints defaultConstraints] .

For example:

- (RTCVideoTrack *)createLocalVideoTrack {
    RTCVideoTrack* localVideoTrack = nil;

    RTCMediaConstraints *mediaConstraints = [RTCMediaConstraints defaultConstraints];
    RTCAVFoundationVideoSource *source =
    [[self peerConnectionFactory] avFoundationVideoSourceWithConstraints:mediaConstraints];
    localVideoTrack =
    [[self peerConnectionFactory] videoTrackWithSource:source
                           trackId:kARDVideoTrackId];
    return localVideoTrack;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM