简体   繁体   English

WebRTC远程流视频readyState:音频工作时“静音”

[英]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". 一切都工作正常(createOffer,createAnswer,iceCandidates等),但是传入的remoteStream具有2条轨道,audioTrack在起作用,而videoTrack在readyState中不起作用:“静音”。

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". 如果我在pageload上执行createOffer,然后使用相同的peerConnection再次执行crreateOffer,则视频也正确显示(但随后我将进入Firefox,“无法在州本地提供报价中创建报价”)。

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) ->在PC中,只有一个浏览器可以随时访问chrome / firefox)
-> Try calling between two different machines or chrome-to-chrome or firefox-to-firefox. ->尝试在两台不同的机器或chrome-to-chrome或firefox-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. 再次调用createOffer不是一个好主意。 Make sure you create the offer in the following way(synchronously). 确保以以下方式(同步)创建商品。

  • After receiving the stream gUM callback, then add it peerConnection. 收到流gUM回调后,然后将其添加为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. 在iOS应用上准备MediaStream时遇到了这个问题。 It turns out the the I wasn't passing the correct RTCMediaConstraints . 事实证明,我没有通过正确的RTCMediaConstraints

The problem resolved after I switch and use [RTCMediaConstraints defaultConstraints] . 切换并使用[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;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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