ios - 在 iOS 中注册房间服务器 Webrtc 失败
问题描述
我正在尝试webrtc
在 ios 中使用视频和音频通话应用程序。我已经按照这里的教程
当我运行我的应用程序时,我在控制台中收到此错误。
无法注册房间服务器。结果:0。
我很困惑为什么它会显示,以及对手将如何在我的屏幕上显示。我也有疯狂的远程视图和本地视图。这是我的视频聊天代码。
/* Initializes the ARDAppClient with the delegate assignment */
self.client = [[ARDAppClient alloc] initWithDelegate:self];
/* RTCEAGLVideoViewDelegate provides notifications on video frame dimensions */
[self.remoteView setDelegate:self];
[self.localView setDelegate:self];
[self.client setServerHostUrl:@"https://apprtc.appspot.com"];
[self.client connectToRoomWithId:@"512415354" options:nil];
- (void)appClient:(ARDAppClient *)client didChangeState:(ARDAppClientState)state {
switch (state) {
case kARDAppClientStateConnected:
NSLog(@"Client connected.");
break;
case kARDAppClientStateConnecting:
NSLog(@"Client connecting.");
break;
case kARDAppClientStateDisconnected:
NSLog(@"Client disconnected.");
[self remoteDisconnected];
break;
}
}
- (void)appClient:(ARDAppClient *)client didReceiveLocalVideoTrack:(RTCVideoTrack *)localVideoTrack {
self.localVideoTrack = localVideoTrack;
[self.localVideoTrack addRenderer:self.localView];
}
- (void)appClient:(ARDAppClient *)client didReceiveRemoteVideoTrack:(RTCVideoTrack *)remoteVideoTrack {
self.remoteVideoTrack = remoteVideoTrack;
[self.remoteVideoTrack addRenderer:self.remoteView];
}
- (void)appClient:(ARDAppClient *)client didError:(NSError *)error {
/* Handle the error */
NSLog(@"Error");
}
- (void)videoView:(RTCEAGLVideoView *)videoView didChangeVideoSize:(CGSize)size {
/* resize self.localView or self.remoteView based on the size returned */
}
- (void)remoteDisconnected {
if (self.remoteVideoTrack) [self.remoteVideoTrack removeRenderer:self.remoteView];
self.remoteVideoTrack = nil;
[self.remoteView renderFrame:nil];
[self videoView:self.localView didChangeVideoSize:self.localVideoSize];
}
解决方案
推荐阅读
- excel-formula - 如何检查多个 Excel 单元格值是否与所选范围匹配
- javascript - 如何在 HTML 上制作可拖动的图表?
- python - 在 Flask webapp 中不能关闭开关(只能打开)
- oracle-nosql - 如何做一个选择*,
使用 Oracle NoSQL? - html - 将鼠标悬停在图标上以显示图像时,如果图像位于视口底部,则更改其原点
- mysql - Spring JDBC - 将参数绑定到 SQL 查询的 IN 部分
- python - 如何使用嵌套循环打印金字塔形状?
- sql - 日期之间的SQL分组?
- database - 如何使用直方图估计 2 列之间的连接选择性?
- python - 在保留顺序的同时用熊猫删除重复项[python]