我已经使用 agora CDN 在我的 angular 5 应用程序中实现了 agora 代码。摄像头正在打开,但一对一用户看不到对方的视频帧。为什么?
变种自我=这个;var client = AgoraRTC.createClient({ mode: 'rtc', codec: "h264" });
client.init('我的钥匙', function () {
console.log("AgoraRTC client initialized");
client.join(null, 'TestChanel', null, function (uid) {
console.log("User " + uid + " join channel successfully");
self.uId = uid;
var localStream = AgoraRTC.createStream({
// streamID: uid,
// audio: true,
// video: true,
// screen: false,
streamID: uid,
audio: true,
cameraId: self.deviceId,
// microphoneId: self.microphone,
video: true,
screen: false,
extensionId: 'minllpmhdgpndnkomcoccfekfegnlikg',
}
);
localStream.init(function () {
console.log("getUserMedia successfully");
localStream.play('agora_local');
// localStream.play('video-caller');
client.publish(localStream, function (err) {
console.log("Publish local stream error: " + err);
});
client.on('stream-published', function (evt) {
console.log("Publish local stream successfully");
});
client.on('stream-added', function (evt) {
var stream = evt.stream;
console.log("New stream added: " + stream.getId());
client.subscribe(stream, function (err) {
console.log("Subscribe stream failed", err);
});
});
client.on('stream-subscribed', function (evt) {
var remoteStream = evt.stream;
console.log("Subscribe remote stream successfully: " + remoteStream.getId());
remoteStream.play('agora_remote' + remoteStream.getId());
})
}, function (err) {
console.log("getUserMedia failed", err);
});
}, function (err) {
console.log("Join channel failed", err);
});
},函数(错误){
console.log("AgoraRTC client init failed", err);
});