如何在原生的Andr​​oid应用程序中使用实现WebRTC + Pubnub API,用于视频聊天客户端 [英] How to use WebRTC + Pubnub Api for video chat client in Native android app

查看:672
本文介绍了如何在原生的Andr​​oid应用程序中使用实现WebRTC + Pubnub API,用于视频聊天客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作在一个Android应用程序与P2P视频聊天只是如Skype的功能。而在谷歌研究,我得到了一些图书馆,但没有得到任何东西Android原生。

i am working on one android application with the functionality of p2p video chat just like Skype. while researching on google, i got some libraries but not getting anything for android native.

我决定去实现WebRTC与使用PubNub的API。如何创建聊天原生的Andr​​oid客户端视频的使用有库?

i decided to go with WebRTC with the use of PubNub api. how can i create a video chat native android client with the use of there libraries?

我发现了一个code的本地视频聊天客户端,

i found one code for native video chat client,

https://github.com/pchab/AndroidRTC

本演示应用程序所需要的URL和IP:端口,所以我有一个困惑,那服务器如何将

this demo application require url with IP:PORT so i have one confusion about that how the server will be?

谁能帮助我?

推荐答案

@Alexey Osminin和@Pubnub是正确的:你需要一个信号协议服务(的 PubNub ),你需要为音频/视频流的托管实现WebRTC解决方案(如的 Xirsys )。下面是完整的解释(这并没有解决原生Android的问题 - 更确切地说,只是通用的解决方案,但考虑使用的WebView):

@Alexey Osminin and @Pubnub are right: you need a signal protocol service (PubNub) and you need a hosted WebRTC solution for the audio/video streams (like Xirsys). Here's full explanation (this does not address the native Android question - rather, just the generic solution but look into using a WebView):

Sinch 是一个基于云的移动通信平台,使得添加通话,验证,视频,短信和IM成应用程序比以往更容易。它们具有由PubNub和许多PubNub客户供电一个SDK使用Sinch在他们的应用程序。实现WebRTC是刚刚的许多功能,它们的价格一 - 供电通信移动应用: 使用Sinch API来加强与语音,短信,验证,视频和即时消息您的应用程序。

Sinch is a cloud-based, mobile communications platform that makes adding calling, verification, video, SMS, and IM into apps easier than ever. They have an SDK that is powered by PubNub and many PubNub customers use Sinch in their applications. WebRTC is just one of the many features they offer - POWERING COMMUNICATIONS FOR MOBILE APPS: Use the Sinch APIs to enhance your app with Voice, SMS, Verification, Video, and Instant Messaging.

实现WebRTC不是独立的API,它需要一个信令服务来协调通信。元数据需要被调用者之间发送的连接建立之前。这些元数据包括信息,例如:

WebRTC is not a standalone API, it needs a signaling service to coordinate communication. Metadata needs to be sent between callers before a connection can be established. This metadata includes information such as:

  • 在会话控制消息来打开和关闭连接
  • 错误信息
  • codeCS / codeC设置,带宽和媒体类型
  • 键建立安全连接
  • 网络数据,如主机的IP和端口

在信令已经发生,视频/音频/数据被直接客户端之间的流,使用实现WebRTC的PeerConnection的API。这种对等网络直接连接,您可以传输高带宽的可靠数据,如视频。 HTML5ROCKS 提供所有的东西实现WebRTC一个很大的指导(无需仔细一看,总结如下图)。

Once signaling has taken place, video/audio/data is streamed directly between clients, using WebRTC’s PeerConnection API. This peer-to-peer direct connection allows you to stream high-bandwidth robust data, such as video. HTML5Rocks provides a great guide on all things WebRTC (no need to read, I summarize below).

PubNub使得这个信号非常简单,另外,给你做这么多与你实现WebRTC应用的能力。

PubNub makes this signaling incredibly simple, and in addition, gives you the power to do so much more with your WebRTC applications.

PubNub不是服务器,以实现WebRTC。   - 信令服务指定ICE服务器上保存的视频聊天可以流过。   - 由谷歌提供公共的STUN服务器都可以使用,但它们不是非常可靠。   - STUN或TURN服务器都需要绕行防火墙,否则聊会失败。   - 许多服务提供信令和服务器的总包于一体,是不是PubNub。我们的观众是谁想要建立自己的,更多的自定义服务的人。

PubNub is not a server for WebRTC. - A signaling service specifies ICE servers that the video chat can stream over. - Public STUN servers provided by google can be used, but they are not very reliable. - STUN or TURN servers are required to circumnavigate a firewall, else chat will fail. - Many services provide the "total package" of signaling and server in one, that is not PubNub. Our audience are the people who want to build their own, more custom service.

XirSys已经使用轨对他们的GitHub 有实现WebRTC-PubNub演示。他们举办STUN和TURN服务器迎合实现WebRTC的需求。

XirSys already have a WebRTC-PubNub demo using rails on their GitHub. They host STUN and TURN servers catering to the needs of WebRTC.

有,可以下载和托管轻松一些开源STUN和TURN服务器项目:

There are a few open source STUN and TURN server projects that can be downloaded and hosted with ease:

  • 在亚马逊AWS VM:pre-作好部署
  • 在RFC5766 TURN:谷歌code,TURN服务器
  • 一到多:说明书MCU进行1对多的媒体服务器。对于大型群组聊天和流数百+用户。

因此​​,大家可以看到,我们不提供音频/视频流媒体服务,但如果你正在构建这种解决方案,PubNub是一个必要的一块与信号协议,将其结合在一起。

So as you can see, we do not provide audio/video streaming services but if you are building this solution, PubNub is a necessary piece to tie it all together with the signal protocol.

这是一个 PubNub AndroidRTC例如,通过我们的实习生的。

这篇关于如何在原生的Andr​​oid应用程序中使用实现WebRTC + Pubnub API,用于视频聊天客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆