我不想创造类似Skype的体验,两个人可以通过视频/音频进行通信。现在我希望能够关闭接收端的视频或音频,这意味着我不仅要显示视频或关闭流中的音频音量,我还是要确保客户端不流式传输数据(以节省带宽)。这可能吗?
让我举一个我现在正在做的事情的例子。
主机
var stream:NetStream = new NetStream(connection);
stream.attachCamera(camera);
stream.attachAudio(microphone);
stream.publish('myStream');
客户端
var stream:NetStream = new NetStream(connection);
var stream.play('myStream');
在客户端我很乐意,如果有办法告诉流分离视频或音频,就像你可以在主机端附加它们一样。类似于:stream.detachAudio()
如果我以错误的方式解决这个问题,或者有不同的方法来实现这一点,请告诉我。
答案 0 :(得分:2)
为此,您可以像这样使用NetStream.receiveVideo
和NetStream.receiveAudio
:
ns.receiveVideo(true); // to receive the video stream
ns.receiveVideo(false); // to stop receiving the video stream
和
ns.receiveAudio(true); // to receive the audio stream
ns.receiveAudio(false); // to stop receiving the audio stream
当然,您可以使用NetStream.info
验证您没有收到视频或音频流:
trace('ns.videoBytesPerSecond : ' + ns.info.videoBytesPerSecond);
trace('ns.audioBytesPerSecond : ' + ns.info.audioBytesPerSecond);
希望可以提供帮助。