A video I made about how to create a video chat application using Firebase and Agora.IO SDK for Android. Resources For Development Dependency compile 'io.agora.rtc:full-sdk:2.2.0' Agora Video Streaming SDK Download here. XML Layout <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.aye.chat.Test.FireVideo"> <FrameLayout android:id="@+id/remote_video_view_container" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white" /> <FrameLayout android:id="@+id/local_video_view_container" android:layout_width="160dp" android:layout_height="200dp" android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_marginEnd="@dimen/activity_horizontal_margin" android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginTop="@dimen/activity_vertical_margin" android:background="@android:color/darker_gray" /> </RelativeLayout> Java Class [ From Youtube ] public class FireVideo extends AppCompatActivity { private RtcEngine mRtcEngine; private IRtcEngineEventHandler mRtcEventHandler; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fire_video); mRtcEventHandler = new IRtcEngineEventHandler() { @Override public void onFirstRemoteVideoDecoded(int uid, int width, int height, int elapsed) { Log.i("uid video",uid+""); runOnUiThread(new Runnable() { @Override public void run() { setupRemoteVideo(uid); } }); } }; initializeAgoraEngine(); } private void initializeAgoraEngine() { try { mRtcEngine = RtcEngine.create(getBaseContext(), getString(R.string.agora_app_id), mRtcEventHandler); joinChannel(); setupLocalVideo(); setupVideoProfile(); } catch (Exception e) { e.printStackTrace(); } } private void setupVideoProfile() { mRtcEngine.enableVideo(); mRtcEngine.setVideoProfile(Constants.VIDEO_PROFILE_360P, false); } private void setupLocalVideo() { FrameLayout container = (FrameLayout) findViewById(R.id.local_video_view_container); SurfaceView surfaceView = RtcEngine.CreateRendererView(getBaseContext()); surfaceView.setZOrderMediaOverlay(true); container.addView(surfaceView); mRtcEngine.setupLocalVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_ADAPTIVE, 0)); } private void joinChannel() { mRtcEngine.joinChannel(null, "aye", "Extra Optional Data", new Random().nextInt(10000000)+1); // if you do not specify the uid, Agora will assign one. } private void setupRemoteVideo(int uid) { FrameLayout container = (FrameLayout) findViewById(R.id.remote_video_view_container); if (container.getChildCount() >= 1) { return; } SurfaceView surfaceView = RtcEngine.CreateRendererView(getBaseContext()); container.addView(surfaceView); mRtcEngine.setupRemoteVideo(new VideoCanvas(surfaceView, VideoCanvas.RENDER_MODE_ADAPTIVE, uid)); surfaceView.setTag(uid); } private void leaveChannel() { mRtcEngine.leaveChannel(); } } Required Manifest Permissions <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.BLUETOOTH" /> Got any questions? Comment below ❤️ Products you may like, Always Curious T-Shirt From $22.95 Select options My Code Works But No Idea Why T-Shirt From $22.95 Select options It Works, I Love Programming T-Shirt From $22.95 Select options Ins(pi)re T-Shirt From $22.95 Select options Hide & Seek Champion T-Shirt From $22.95 Select options Declare Variables Not War T-Shirt From $26.39 Select options View All Products
Android Video Chat App Using Firebase [Source Code Only]
A video I made about how to create a video chat application using Firebase and Agora.IO SDK for Android.
Resources For Development
Dependency
Agora Video Streaming SDK
Download here.
XML Layout
Java Class
[ From Youtube ]
Required Manifest Permissions
Got any questions? Comment below ❤️
Products you may like,
Always Curious T-Shirt
From $22.95My Code Works But No Idea Why T-Shirt
From $22.95It Works, I Love Programming T-Shirt
From $22.95Ins(pi)re T-Shirt
From $22.95Hide & Seek Champion T-Shirt
From $22.95Declare Variables Not War T-Shirt
From $26.393 replies to “Android Video Chat App Using Firebase [Source Code Only]”
Mohammad
can i run the remote and local video on same device testor?
jociclebyson
ola tudo bem,este codigo fonte esta completo?
Luther Krompel
Awesome! Its genuinely awesome piece of writing, I have got much clear idea on the topic of from this paragraph.|