admin管理员组文章数量:1310431
I would like to know the tracks presence in received stream onaddstream callback. Video calling is working well but I would like to make. audio only call, so I just passed audio:true,video:false
in getUserMedia constraints, now when I receive stream I cant figure out tracks presence in stream.
How to know tracks presence in stream?
I would like to know the tracks presence in received stream onaddstream callback. Video calling is working well but I would like to make. audio only call, so I just passed audio:true,video:false
in getUserMedia constraints, now when I receive stream I cant figure out tracks presence in stream.
How to know tracks presence in stream?
Share Improve this question asked May 27, 2013 at 9:06 kongarajukongaraju 9,60611 gold badges58 silver badges78 bronze badges 5- 1 Did you try getAudioTracks().length? – Muaz Khan Commented May 27, 2013 at 12:04
- how would I know absence of VideoTracks? – kongaraju Commented May 27, 2013 at 12:07
- 2 getVideoTracks().length or "a=mid:video" presence in peer.remoteDescription.sdp – Muaz Khan Commented May 27, 2013 at 12:09
- Hope you're setting OfferToReceiveAudio:true and OfferToReceiveVideo:false --- like this: github./muaz-khan/WebRTC-Experiment/blob/master/RTCall/… – Muaz Khan Commented May 27, 2013 at 12:11
- 1 so if length is 0 that should be audio only – kongaraju Commented May 27, 2013 at 12:11
1 Answer
Reset to default 7To Know presence of Audio and Video use getAudioTracks
and getVideoTracks
.
function checkStream(stream){
var hasMedia={hasVideo:false,hasAudio:false};
if(stream.getAudioTracks().length)// checking audio presence
hasMedia.hasAudio=true;
if(stream.getVideoTracks().length)// checking video presence
hasMedia.hasVideo=true;
return hasMedia;
}
To stop passing Video in stream change offer and answer constrinats.
constraints = {
optional: [],
mandatory: {
OfferToReceiveAudio: true,
OfferToReceiveVideo: false
}
};
本文标签: javascriptwebRTC How to detect audiovideo presence in StreamStack Overflow
版权声明:本文标题:javascript - webRTC: How to detect audiovideo presence in Stream? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741830407a2399897.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论