AgoraRTC.createClient(); client.init(appid, function () { console.log("AgoraRTC client initialized"); client.join(null, "any-channel", null, function (uid) { console.log("User " + uid + " joined channel successfully"); }, function (err) { console.error("Join channel failed", err); }); });
client.subscribe(stream, function (err) { console.log("Subscribe stream failed", err); }); stream.play("remote-container");
其中stream是从先前join channel的回调中获取到的现有用户的流。
注:以上示例代码仅用于代码演示与说明,实际应用需要根据自身需求进行调整和改进。