Introduction to the

AnyLive is an open source push and pull flow project. The project adopts cross-platform architecture design, and a set of code supports Android, iOS, Windows, Mac, Ubuntu and other platforms. This article mainly introduces the implementation of anyLive Android platform.

This project includes the use of JNI, the practice of WebRTC Native, and the implementation of audio and video codec.

features

  • Push the flow
  • Pull flow
  • Screen sharing
  • Image push flow
  • Real-time filter based on GPUImage
  • Audio and video acquisition codec based on WEBRTC-93, FFMPEG4.3
  • Audio and video collection and rendering
  • Etc.

The Demo show

Program source code

GO πŸš€

Compilation Considerations

Before opening with AndroidStudio, download webRTC, FFMPEG libraries.

Download it at πŸ‘‰Lib

Download and decompress the lib folder to liveplayer/ SRC /main/ CPP

Please use NDK version 20.0.5594570 to compile, otherwise various errors may occur πŸ™…

API call

ArLiveEngine
Create the engine
Val liveEngine = ArLiveEngine. Create (context: context) val liveEngine = ArLiveEngine.Copy the code
The release of the engine
ArLiveEngine.release()
Copy the code
Create a stream push
liveEngine.createArLivePusher()
Copy the code
Creating a player
liveEngine.createArLivePlayer()
Copy the code
ArLivePusher
Set the push-back
void setObserver(ArLivePusherObserver observer)
Copy the code
Example Set the local camera preview View
int setRenderView(TextureViewRenderer view)
Copy the code
Turn on the camera
int startCamera(boolean frontCamera)
Copy the code

Began pushing flow

int startPush(String url)
Copy the code

Refer to the ArLivePusher class annotation for more methods

ArLivePlayer
Set up the player callback
void setObserver(ArLivePlayerObserver observer)
Copy the code
Set the player’s video render View
int setRenderView(TextureViewRenderer view)
Copy the code
Start playing
int startPlay(String url)
Copy the code

Refer to the ArLivePusher class annotation for more methods