简体   繁体   English

Parse.com OpenTok集成错误

[英]Parse.com OpenTok Integration Error

I'm building an app using this tutorial (using using parse.com and OpenTok). 我正在使用本教程 (使用parse.com和OpenTok)构建应用程序。 When I initiate a call, the following delegate method -- session:(OTSession *)session streamCreated:(OTStream *)stream delegate method never gets called. 当我发起呼叫时,以下委托方法-session:(OTSession *)session streamCreated:(OTStream *)stream委托方法永远不会被调用。 I have searched around and it seems others have had this error but no one seems to have found a solution. 我四处搜寻,似乎其他人也有此错误,但似乎没有人找到解决方法。

The cloud code module deployed on the parse servers seems to execute fine without errors and give no issues. 部署在解析服务器上的云代码模块似乎可以正常执行,没有错误,也没有任何问题。 But the video stream is never initiated. 但是视频流永远不会启动。

The streamCreated method looks like this: streamCreated方法如下所示:

-(void)session:(OTSession *)session streamCreated:(OTStream *)stream {
    NSLog(@"session: didReceiveStream:");
    NSLog(@"- connection.connectionId: %@", stream.connection.connectionId);
    NSLog(@"- connection.creationTime: %@", stream.connection.creationTime);
    NSLog(@"- session.sessionId: %@", stream.session.sessionId);
    NSLog(@"- streamId: %@", stream.streamId);
    NSLog(@"- creationTime %@", stream.creationTime);
    NSLog(@"- name %@", stream.name);
    NSLog(@"- hasAudio %@", (stream.hasAudio ? @"YES" : @"NO"));
    NSLog(@"- hasVideo %@", (stream.hasVideo ? @"YES" : @"NO"));
    if ( (subscribeToSelf && [stream.connection.connectionId isEqualToString: _session.connection.connectionId])
        ||
        (!subscribeToSelf && ![stream.connection.connectionId isEqualToString: _session.connection.connectionId])
        ) {
        if (!_subscriber) {
            _subscriber = [[OTSubscriber alloc] initWithStream:stream delegate:self];
            _subscriber.subscribeToAudio = self.bAudio;
            _subscriber.subscribeToVideo = self.bVideo;
        }
        NSLog(@"subscriber.session.sessionId: %@", _subscriber.session.sessionId);
        NSLog(@"- stream.streamId: %@", _subscriber.stream.streamId);
        NSLog(@"- subscribeToAudio %@", (_subscriber.subscribeToAudio ? @"YES" : @"NO"));
        NSLog(@"- subscribeToVideo %@", (_subscriber.subscribeToVideo ? @"YES" : @"NO"));
    }
}

Does anyone have any ideas at all? 有没有人有任何想法? I'm new to OpenTok and would appreciate any advice. 我是OpenTok的新手,不胜感激。 Thanks in advance. 提前致谢。

For the complete project code, see the linked tutorial. 有关完整的项目代码,请参见链接的教程。 I have not modified the code in any way with the exception of implementing the API secret for OpenTok and my Parse credentials. 除了为OpenTok和我的Parse凭据实现API秘密外,我没有以任何方式修改代码。 I have also hosted the .h and .m files on this dropbox page . 我还在此保管箱页面上托管了.h和.m文件。

You never call [session publish:publisher error:&error]; 您永远不会调用[session publish:publisher error:&error]; . There will be no streamCreated event if no stream is ever published. 如果没有流发布,则将没有streamCreated事件。

I did not read the entire tutorial, but I did take a look at the linked .m file from your DropBox. 我没有阅读整个教程,但确实查看了DropBox中链接的.m文件。 From the portion of the tutorial that I did read, I found plenty of misinformation and the explanations are more complicated than they should be. 从我确实阅读的教程部分中,我发现了很多错误信息,并且解释比应有的要复杂。 I suggest going directly to the OpenTok Tutorials and following the iOS sections. 我建议直接进入OpenTok教程,并遵循iOS部分。

In terms of how to integrate Parse (not covered in the tutorials), the most important thing you need to know is that Parse is just responsible for serving the appropriate apiKey , sessionId , and token ; 关于如何集成Parse(本教程中未介绍),您需要了解的最重要的事情是Parse仅负责提供适当的apiKeysessionIdtoken nothing else. 没有其他的。 The apiKey should always be the same. apiKey应该始终相同。 The sessionId should be the same if the clients need to be able to communicate with each other. 如果客户端需要能够相互通信,则sessionId应该相同。 Lastly, each client should get a unique token (this is one of the places where the blog post you linked is incorrect, and you should not store just one publisherToken for the entire session). 最后,每个客户都应该获得一个唯一的token (这是您链接的博客文章不正确的地方之一,并且您在整个会话中不应仅存储一个publisherToken )。 The Parse cloud code module can help you generate new sessionId s when you want and new token s for each client. 解析云代码模块可以帮助您在需要时生成新的sessionId ,并为每个客户端生成新的token For a better explained example, see a blog post I wrote on the official blog some time ago. 有关更好解释的示例,请参阅前一段时间在官方博客上撰写博客文章 Some of the information in it is old, but its still accurate. 其中的某些信息已过时,但仍然准确。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM