GithubHelp home page GithubHelp logo

gleasonk / androidrtc Goto Github PK

View Code? Open in Web Editor NEW
211.0 15.0 97.0 15.06 MB

An example of WebRTC natively on Android using PubNub for signaling.

Home Page: http://kevingleason.me/AndroidRTC/

License: MIT License

Java 100.00%

androidrtc's Introduction

AndroidRTC

An example of native WebRTC on Android using PubNub's Android SDK signaling.

Big News: PubNub Android SDK for Signaling!

cover_img

This means that you can now create video chatting applications natively on Android in a breeze. Best of all, it is fully compatible with the PubNub Javascript SDK! That's right, you are minutes away from creating your very own cross platform video-chatting application.

Get it now!

NOTE: The following demo uses the PubNub Android SDK for signaling to transfer the metadata and establish the peer-to-peer connection. Once the connection is established, the video and voice runs on public Google STUN/TURN servers.

Keep in mind, PubNub can provide the signaling for WebRTC, and requires you to combine it with a hosted WebRTC solution. For more detail on what PubNub does, and what PubNub doesn’t do with WebRTC, check out this article: https://support.pubnub.com/support/solutions/articles/14000043715-does-pubnub-provide-webrtc-and-video-chat-

The AndroidRTC Example App

This app shows how to accomplish signling on a standby channel to coordinate users, then hop into a video chat and use the PubNub JavaScript SDK for signaling. You can even make a call to the AndroidRTC App from the web interface.

Users in this app layout must be subscribed to username-stdby, a standby channel. The Android side checks if a user is online by checking presence on the standby channel.

In this app, a call can be placed by sending a JSON packet to the user's standby channel:

{"call_user":"UserName","call_time":currentTimeMillis}

Upon accepting the call, the answerer creates the SDP Offer, and video chat begins.

Incoming Calls

AndroidRTC provides a good example of how to handle incoming calls.

User Messages

This app also shows how to send custom user messages. These messages could be chat, game scores, and much more.

androidrtc's People

Contributors

ashutoshbarthwal avatar gleasonk avatar pubnubcraig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

androidrtc's Issues

Switch device camera while streaming

How can I switch the camera while streaming. Currently I put a button on a corner and try to access the camera but I fail. Is there some helper function or anything else to make this work ?

No sound

Hello,

irst of all, thnaks a lot for your work, it helps a lot !

I adapted this demo for our own videochat needs, but I can't get the sound to work.

Logcat does show that something happens with the sounds :

09-28 17:47:51.148  17972-20776/com.relinkdevice.manager D/AudioManager﹕ ctor@[tid=20776]
09-28 17:47:51.148  17972-20776/com.relinkdevice.manager D/JVM﹕ JNIEnvironment::RegisterNatives(org/webrtc/voiceengine/WebRtcAudioManager)
09-28 17:47:51.148  17972-20776/com.relinkdevice.manager D/WebRtcAudioManager﹕ ctor@[name=Thread-1292, id=1292]
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager V/AudioTrack﹕ getMinFrameCount=5644: afFrameCount=1024, minBufCount=6, afSampleRate=48000, afLatency=138
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioManager﹕ OnCacheAudioParameters@[tid=20776]
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioManager﹕ hardware_aec: 1
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioManager﹕ low_latency_output: 0
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioManager﹕ sample_rate: 44100
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioManager﹕ channels: 1
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioManager﹕ output_buffer_size: 5644
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioManager﹕ input_buffer_size: 3840
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioManager﹕ JavaAudioManager::ctor@[tid=20776]
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioManager﹕ IsLowLatencyPlayoutSupported()
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioTrackJni﹕ ctor@[tid=20776]
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/JVM﹕ JNIEnvironment::RegisterNatives(org/webrtc/voiceengine/WebRtcAudioTrack)
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/WebRtcAudioTrack﹕ ctor@[name=Thread-1292, id=1292]
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/WebRtcAudioTrack﹕ Android SDK: 16, Release: 4.1.2, Brand: lge, Device: d1lsk, Id: JZO54K, Hardware: d1lsk, Manufacturer: lge, Model: LG-F160S, Product: d1lsk_SKT_KR
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioRecordJni﹕ ctor@[tid=20776]
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/JVM﹕ JNIEnvironment::RegisterNatives(org/webrtc/voiceengine/WebRtcAudioRecord)
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/WebRtcAudioRecord﹕ ctor@[name=Thread-1292, id=1292]
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioManager﹕ SetActiveAudioLayer(5)@[tid=20776]
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioManager﹕ delay_estimate_in_milliseconds: 150
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioTrackJni﹕ AttachAudioBuffer@[tid=20776]
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioTrackJni﹕ SetPlayoutSampleRate(44100)
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioTrackJni﹕ SetPlayoutChannels(1)
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioRecordJni﹕ AttachAudioBuffer
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioRecordJni﹕ SetRecordingSampleRate(44100)
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioRecordJni﹕ SetRecordingChannels(1)
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioRecordJni﹕ total_delay_in_milliseconds: 150
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioManager﹕ Init@[tid=20776]
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/WebRtcAudioManager﹕ init@[name=Thread-1292, id=1292]
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/WebRtcAudioManager﹕ audio mode is: MODE_NORMAL
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/AudioRecordJni﹕ EnableBuiltInAEC@[tid=20776]
09-28 17:47:51.158  17972-20776/com.relinkdevice.manager D/WebRtcAudioRecord﹕ EnableBuiltInAEC(true)
09-28 17:47:51.168  17972-20776/com.relinkdevice.manager D/AudioRecordJni﹕ EnableBuiltInAEC@[tid=20776]
09-28 17:47:51.168  17972-20776/com.relinkdevice.manager D/WebRtcAudioRecord﹕ EnableBuiltInAEC(true)
09-28 17:47:51.208  17972-20782/com.relinkdevice.manager D/AudioManager﹕ ctor@[tid=20782]
09-28 17:47:51.208  17972-20782/com.relinkdevice.manager D/JVM﹕ JNIEnvironment::RegisterNatives(org/webrtc/voiceengine/WebRtcAudioManager)
09-28 17:47:51.208  17972-20782/com.relinkdevice.manager D/WebRtcAudioManager﹕ ctor@[name=Thread-1295, id=1295]
09-28 17:47:51.218  17972-20782/com.relinkdevice.manager V/AudioTrack﹕ getMinFrameCount=5644: afFrameCount=1024, minBufCount=6, afSampleRate=48000, afLatency=138
09-28 17:47:51.218  17972-20782/com.relinkdevice.manager D/AudioManager﹕ OnCacheAudioParameters@[tid=20782]
09-28 17:47:51.218  17972-20782/com.relinkdevice.manager D/AudioManager﹕ hardware_aec: 1
09-28 17:47:51.218  17972-20782/com.relinkdevice.manager D/AudioManager﹕ low_latency_output: 0
09-28 17:47:51.218  17972-20782/com.relinkdevice.manager D/AudioManager﹕ sample_rate: 44100
09-28 17:47:51.218  17972-20782/com.relinkdevice.manager D/AudioManager﹕ channels: 1
09-28 17:47:51.218  17972-20782/com.relinkdevice.manager D/AudioManager﹕ output_buffer_size: 5644
09-28 17:47:51.218  17972-20782/com.relinkdevice.manager D/AudioManager﹕ input_buffer_size: 3840
09-28 17:47:51.218  17972-20782/com.relinkdevice.manager D/AudioManager﹕ JavaAudioManager::ctor@[tid=20782]
09-28 17:47:51.218  17972-20782/com.relinkdevice.manager D/AudioManager﹕ IsLowLatencyPlayoutSupported()
09-28 17:47:51.218  17972-20782/com.relinkdevice.manager D/AudioTrackJni﹕ ctor@[tid=20782]
09-28 17:47:51.218  17972-20782/com.relinkdevice.manager D/JVM﹕ JNIEnvironment::RegisterNatives(org/webrtc/voiceengine/WebRtcAudioTrack)
09-28 17:47:51.218  17972-20782/com.relinkdevice.manager D/WebRtcAudioTrack﹕ ctor@[name=Thread-1295, id=1295]
09-28 17:47:51.218  17972-20782/com.relinkdevice.manager D/WebRtcAudioTrack﹕ Android SDK: 16, Release: 4.1.2, Brand: lge, Device: d1lsk, Id: JZO54K, Hardware: d1lsk, Manufacturer: lge, Model: LG-F160S, Product: d1lsk_SKT_KR
09-28 17:47:51.218  17972-20782/com.relinkdevice.manager D/AudioRecordJni﹕ ctor@[tid=20782]
09-28 17:47:51.228  17972-20782/com.relinkdevice.manager D/JVM﹕ JNIEnvironment::RegisterNatives(org/webrtc/voiceengine/WebRtcAudioRecord)
09-28 17:47:51.228  17972-20782/com.relinkdevice.manager D/WebRtcAudioRecord﹕ ctor@[name=Thread-1295, id=1295]
09-28 17:47:51.228  17972-20782/com.relinkdevice.manager D/AudioManager﹕ SetActiveAudioLayer(5)@[tid=20782]
09-28 17:47:51.228  17972-20782/com.relinkdevice.manager D/AudioManager﹕ delay_estimate_in_milliseconds: 150
09-28 17:47:51.228  17972-20782/com.relinkdevice.manager D/AudioTrackJni﹕ AttachAudioBuffer@[tid=20782]
09-28 17:47:51.228  17972-20782/com.relinkdevice.manager D/AudioTrackJni﹕ SetPlayoutSampleRate(44100)
09-28 17:47:51.228  17972-20782/com.relinkdevice.manager D/AudioTrackJni﹕ SetPlayoutChannels(1)
09-28 17:47:51.228  17972-20782/com.relinkdevice.manager D/AudioRecordJni﹕ AttachAudioBuffer
09-28 17:47:51.228  17972-20782/com.relinkdevice.manager D/AudioRecordJni﹕ SetRecordingSampleRate(44100)
09-28 17:47:51.228  17972-20782/com.relinkdevice.manager D/AudioRecordJni﹕ SetRecordingChannels(1)
09-28 17:47:51.228  17972-20782/com.relinkdevice.manager D/AudioRecordJni﹕ total_delay_in_milliseconds: 150
09-28 17:47:51.228  17972-20782/com.relinkdevice.manager D/AudioManager﹕ Init@[tid=20782]
09-28 17:47:51.228  17972-20782/com.relinkdevice.manager D/WebRtcAudioManager﹕ init@[name=Thread-1295, id=1295]
09-28 17:47:51.228  17972-20782/com.relinkdevice.manager D/WebRtcAudioManager﹕ audio mode is: MODE_NORMAL
09-28 17:47:51.228  17972-20782/com.relinkdevice.manager D/AudioRecordJni﹕ EnableBuiltInAEC@[tid=20782]
09-28 17:47:51.228  17972-20782/com.relinkdevice.manager D/WebRtcAudioRecord﹕ EnableBuiltInAEC(true)
09-28 17:47:51.238  17972-20782/com.relinkdevice.manager D/AudioRecordJni﹕ EnableBuiltInAEC@[tid=20782]
09-28 17:47:51.238  17972-20782/com.relinkdevice.manager D/WebRtcAudioRecord﹕ EnableBuiltInAEC(true)
09-28 17:47:53.190  17972-20782/com.relinkdevice.manager D/AudioTrackJni﹕ InitPlayout@[tid=20782]
09-28 17:47:53.190  17972-20782/com.relinkdevice.manager D/WebRtcAudioTrack﹕ InitPlayout(sampleRate=44100, channels=1)
09-28 17:47:53.190  17972-20782/com.relinkdevice.manager D/WebRtcAudioTrack﹕ byteBuffer.capacity: 882
09-28 17:47:53.190  17972-20782/com.relinkdevice.manager D/AudioTrackJni﹕ OnCacheDirectBufferAddress
09-28 17:47:53.190  17972-20782/com.relinkdevice.manager D/AudioTrackJni﹕ direct buffer capacity: 882
09-28 17:47:53.190  17972-20782/com.relinkdevice.manager D/AudioTrackJni﹕ frames_per_buffer: 441
09-28 17:47:53.200  17972-20782/com.relinkdevice.manager V/AudioTrack﹕ getMinFrameCount=5644: afFrameCount=1024, minBufCount=6, afSampleRate=48000, afLatency=138
09-28 17:47:53.200  17972-20782/com.relinkdevice.manager D/WebRtcAudioTrack﹕ AudioTrack.getMinBufferSize: 11288
09-28 17:47:53.200  17972-20782/com.relinkdevice.manager V/AudioTrack﹕ set() streamType 0 frameCount 5644 flags 0000
09-28 17:47:53.200  17972-20782/com.relinkdevice.manager V/AudioTrack﹕ AudioTrack getOutput streamType 0, sampleRate 44100, format 1, channelMask 1, flags 0
09-28 17:47:53.200  17972-20782/com.relinkdevice.manager V/AudioTrack﹕ createTrack_l() output 2 afLatency 138
09-28 17:47:53.200  17972-20782/com.relinkdevice.manager V/AudioTrack﹕ minFrameCount: 5644, afFrameCount=1024, minBufCount=6, sampleRate=44100, afSampleRate=48000, afLatency=138
09-28 17:47:53.200  17972-20782/com.relinkdevice.manager D/AudioManager﹕ IsCommunicationModeEnabled()
09-28 17:47:53.200  17972-20782/com.relinkdevice.manager W/AudioDeviceTemplate﹕ The application should use MODE_IN_COMMUNICATION audio mode!
09-28 17:47:53.200  17972-20782/com.relinkdevice.manager D/AudioTrackJni﹕ StartPlayout@[tid=20782]
09-28 17:47:53.200  17972-20782/com.relinkdevice.manager D/WebRtcAudioTrack﹕ StartPlayout
09-28 17:47:53.200  17972-20832/com.relinkdevice.manager D/WebRtcAudioTrack﹕ AudioTrackThread@[name=AudioTrackJavaThread, id=1303]
09-28 17:47:53.200  17972-20832/com.relinkdevice.manager V/AudioTrack﹕ start 0x5e53a980
09-28 17:47:53.200  17972-20832/com.relinkdevice.manager V/AudioTrack﹕ start 0x5e53a980 before lock cblk 0x66906000
09-28 17:47:53.200  17972-20832/com.relinkdevice.manager V/AudioTrack﹕ mAudioTrack->start()
09-28 17:47:53.210  17972-20832/com.relinkdevice.manager V/AudioTrack﹕ write 0x5e53a980: 882 bytes, mActive=1
[many more like that]
09-28 17:47:55.933  17972-20832/com.relinkdevice.manager V/AudioTrack﹕ write 0x5e53a980: 882 bytes, mActive=1
09-28 17:47:55.943  17972-20782/com.relinkdevice.manager D/AudioTrackJni﹕ StopPlayout@[tid=20782]
09-28 17:47:55.943  17972-20782/com.relinkdevice.manager D/WebRtcAudioTrack﹕ StopPlayout
09-28 17:47:55.973  17972-20832/com.relinkdevice.manager V/AudioTrack﹕ stop 0x5e53a980
09-28 17:47:55.973  17972-20832/com.relinkdevice.manager V/AudioTrack﹕ flush
09-28 17:47:55.983  17972-20782/com.relinkdevice.manager V/AudioTrack﹕ stop 0x5e53a980
09-28 17:47:55.983  17972-20782/com.relinkdevice.manager V/AudioTrack﹕ stop 0x5e53a980
09-28 17:47:55.983  17972-20782/com.relinkdevice.manager V/AudioTrack﹕ stop 0x5e53a980

I don't really have a clue where to begin debugging... So I would be grateful for any tip or advice !

Best,

Quentin

pubnub call connection taking a long time

Hi, starting this morning (1/12/17 pst in us), when making a call from one user to another, and the receiver accepts the call, it takes a very long time for the two peer clients to connect (they do get connected though). It was way faster before (even yesterday), but for some reason starting today, the connection takes a long time to get established. I am currently using "kevingleason"'s pubnub as originally used in the project.

Even when trying to connect using the web client (https://kevingleason.me/AndroidRTC/), it now takes a very long time. Is there some issue currently with kevin's pubnub/ice server?

Provide error display when WebRTC errors are thrown

Display the actual WebRTC errors (or any errors) that are thrown in the UI. Currently, if there are connect errors, the UI just shows "Connecting..." forever. The browser console will show that there is a WebRTC error.

Installed on my Android but not working

I could not make a call, tried use the website and mobile device could not make it work.

Stop at step where I call from mobile device and say could not find user, I had a user on the website side.

Connect as chat user

Can you direct me to an example that woulday allow a user to log into a video chat as a chat user? Something where they see both videos but they have no video themselves..just chat.

Thanks.

Problem in video streaming.

Hello, I am trying to run the app, I placed to call from Device A to Device B, on other side I accepted the call.
Both devices went into Video activity and showing connect message for ever.
But I can able to send text messages after modifying "this.pnRTCClient.listenOn("Kevin")" to "this.pnRTCClient.listenOn(username);" In video activity, and able to receive call hangup call backs also.
Please help me out on this.
When I am trying to place a call from web page to Android device, I can't able to receive the call.
Android versions 4.4.2 and 5.1.1 respectively.

org.apache.http.* not found in class XirSysRequest

None of this imports of XirSysRequest is found:
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;

What is the origin?

Audio Streaming from a local file

Hi, thanks for this awesome sample. Am trying to find if there is a way through which I can stream a local mp3(or any audio) file with the AudioSource and AudioTrack classes. It would be great if there is a way through which I can do it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.