Convert Figma logo to code with AI

begeekmyfriend logoyasea

RTMP live streaming client for Android

4,870
1,319
4,870
280

Top Related Projects

RootEncoder for Android (rtmp-rtsp-stream-client-java) is a stream encoder to push video/audio to media servers using protocols RTMP, RTSP, SRT and UDP with all code written in Java/Kotlin

RTMP 推流器,RTMP(HLS)秒开播放器,直播点播,跨平台(Win,IOS,Android)开源代码

Quick Overview

Yasea is an Android streaming client for RTMP and RTSP protocols. It provides a lightweight solution for live video streaming from Android devices, supporting various video encoding options and audio processing features.

Pros

  • Supports both RTMP and RTSP protocols for flexible streaming options
  • Offers hardware encoding for improved performance on mobile devices
  • Includes audio processing features like noise suppression and automatic gain control
  • Provides a simple API for easy integration into Android applications

Cons

  • Limited documentation, which may make it challenging for new users to get started
  • Lacks support for some advanced streaming features found in more comprehensive solutions
  • May have compatibility issues with certain Android devices or OS versions
  • Not actively maintained, with the last update being several years ago

Code Examples

  1. Initializing the streaming client:
mPublisher = new SrsPublisher(this);
mPublisher.setEncodeHandler(new SrsEncodeHandler(this));
mPublisher.setRtmpHandler(new RtmpHandler(this));
mPublisher.setRecordHandler(new SrsRecordHandler(this));
mPublisher.setPreviewResolution(640, 360);
mPublisher.setOutputResolution(360, 640);
mPublisher.setVideoHDMode();
mPublisher.startCamera();
  1. Starting and stopping the stream:
// Start streaming
mPublisher.startPublish("rtmp://your-rtmp-url");

// Stop streaming
mPublisher.stopPublish();
  1. Switching camera and toggling flashlight:
// Switch between front and back camera
mPublisher.switchCameraFace((mPublisher.getCameraId() + 1) % Camera.getNumberOfCameras());

// Toggle flashlight
mPublisher.toggleFlashLight();

Getting Started

To use Yasea in your Android project:

  1. Add the following to your build.gradle file:
dependencies {
    implementation 'com.github.begeekmyfriend:yasea:3.3'
}
  1. Initialize the publisher in your activity:
private SrsPublisher mPublisher;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mPublisher = new SrsPublisher(this);
    mPublisher.setEncodeHandler(new SrsEncodeHandler(this));
    mPublisher.setRtmpHandler(new RtmpHandler(this));
    mPublisher.setRecordHandler(new SrsRecordHandler(this));
    mPublisher.setPreviewResolution(640, 360);
    mPublisher.setOutputResolution(360, 640);
    mPublisher.setVideoHDMode();
    mPublisher.startCamera();
}
  1. Start streaming when ready:
mPublisher.startPublish("rtmp://your-rtmp-url");

Remember to handle permissions and lifecycle events appropriately in your Android application.

Competitor Comparisons

RootEncoder for Android (rtmp-rtsp-stream-client-java) is a stream encoder to push video/audio to media servers using protocols RTMP, RTSP, SRT and UDP with all code written in Java/Kotlin

Pros of RootEncoder

  • More comprehensive support for streaming protocols (RTMP, RTSP, SRT)
  • Better documentation and examples for integration
  • Active development with frequent updates and bug fixes

Cons of RootEncoder

  • Larger codebase and potentially more complex to implement
  • May have higher resource usage due to additional features

Code Comparison

RootEncoder:

rtmpCamera1 = RtmpCamera1(openGlView, connectCheckerRtmp)
rtmpCamera1.setReTries(10)
rtmpCamera1.startStream("rtmp://example.com/live")

Yasea:

mPublisher = new SrsPublisher(mSurfaceView);
mPublisher.setOutputResolution(640, 360);
mPublisher.startPublish("rtmp://example.com/live");

Key Differences

  • RootEncoder offers more flexibility in configuration and streaming options
  • Yasea has a simpler API but fewer advanced features
  • RootEncoder is written in Kotlin, while Yasea is in Java

Use Cases

  • RootEncoder: Ideal for projects requiring multiple streaming protocols and advanced customization
  • Yasea: Better suited for simpler streaming applications with basic RTMP support

Community and Support

  • RootEncoder has a more active community and regular updates
  • Yasea has fewer recent updates but still maintains a stable codebase

RTMP 推流器,RTMP(HLS)秒开播放器,直播点播,跨平台(Win,IOS,Android)开源代码

Pros of anyRTC-RTMP-OpenSource

  • More comprehensive RTMP solution with additional features like WebRTC support
  • Better documentation and examples for integration
  • Active community support and regular updates

Cons of anyRTC-RTMP-OpenSource

  • Larger codebase, potentially more complex to understand and modify
  • May have higher resource requirements due to additional features
  • Less focused on simplicity compared to Yasea

Code Comparison

anyRTC-RTMP-OpenSource:

public class RTMPPublisher {
    private native int startPublish(String url);
    private native int stopPublish();
    private native int sendAudioData(byte[] data, int size, long timestamp);
    private native int sendVideoData(byte[] data, int size, long timestamp);
}

Yasea:

public class SrsPublisher {
    private native int startPublish(String url);
    private native int stopPublish();
    private native void setVideoResolution(int width, int height);
    private native void setVideoFps(int fps);
}

The code comparison shows that anyRTC-RTMP-OpenSource provides more granular control over audio and video data sending, while Yasea focuses on simpler configuration options for video settings. This reflects the overall difference in complexity and feature set between the two projects.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

“[yasea] is being sponsored by the following tool; please help to support us by taking a look and signing up to a free trial”

GitAds

Yet Another Stream Encoder for Android

Android Arsenal

Yasea is an Android streaming client. It encodes YUV and PCM data from camera and microphone to H.264/AAC, encapsulates in FLV and transmits over RTMP.

Branch

non-gpuimage for Android without GL ES library like development board.

android-16 for Android API 16+.

aac-hev2 for Youtube live broadcast that is not compatible with conventional flash media players.

Feature

  • Android mini API 21.
  • H.264/AAC hard encoding.
  • H.264 soft encoding.
  • RTMP streaming with state callback handler.
  • Portrait and landscape dynamic orientation.
  • Front and back cameras hot switch.
  • Recording to MP4 while streaming.
  • Beautiful filters with GPUImage.
  • Acoustic echo cancellation and automatic gain control support.

Test

You may build your own private RTMP server srs. Remember to modify the URL by yourself. Have fun!

NOTE if you feel high latency, please check your bandwidth limits and player buffering.

Acknowledgements