Coder Social home page Coder Social logo

tommyteavee / librtmp-client-for-android Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ant-media/librtmp-client-for-android

0.0 0.0 0.0 316 KB

It is probably the smallest(~60KB, fat version ~300KB) rtmp client for android. It calls librtmp functions over JNI interface

Home Page: http://antmedia.io

License: Apache License 2.0

Java 4.36% C 89.78% Makefile 0.81% HTML 2.39% CMake 0.70% Roff 1.96%

librtmp-client-for-android's Introduction

Librtmp Client for Android

It is probably the smallest(~60KB) rtmp client for android. It calls librtmp functions over JNI interface. With all cpu architectures(arm, arm7, arm8, x86, x86-64, mips) its size is getting about 300KB

It compiles librtmp library without ssl.

In version 0.2, it supports FLV muxing and sending stream via RTMP. FLV muxing is based on this repo https://github.com/rainfly123/flvmuxer

To read streams, you can call below functions of RtmpClient from Java

For live streams add " live=1" at the end of the url when calling the open function

  • public native int open(String url, boolean isPublishMode);
  • public native int read(byte[] data, int offset, int size);
  • public native int write(byte[] data);
  • public native int seek(int seekTime);
  • public native int pause(int pause);
  • public native int close();
  • public native int isConnected();: Call this function to query the connection status. Returns 1 if connected, returns 0 if not connected

Don't forget calling the close function after you are done. If you don't, there will be memory leakage

To publish streams, you can call below functions of RtmpMuxer from Java
  • public native int open(String url, int width, int height); : First, call this function with the url you plan to publish. Width and height are the width and height of the video. These two parameters are not mandatory. They are optional. They put width and height values into the metadata tag.
  • public native int writeVideo(byte[] data, int offset, int length, int timestamp);: Write h264 nal units with this function
  • public native int writeAudio(byte[] data, int offset, int length, int timestamp);: Write aac frames with this function
  • public native int close();: Call this function to close the publishing.
  • public native int isConnected();: Call this function to query the connection status. Returns 1 if connected, returns 0 if not connected

To save flv file locally as well, you can use below functions

  • public native void file_open(String filename); : call this function with full file path
  • public native void write_flv_header(boolean is_have_audio, boolean is_have_video);: After opening file call this function
  • public native void file_close();: Call this function to close the file.

if any local file is opened, library will write the audio and video frames to local file as well.

Install

  • Add dependency to your build gradle
dependencies {
    ...
    compile 'net.butterflytv.utils:rtmp-client:3.1.0'
    ...
}
  • That's all. You can use RtmpClient class

Ant Media

librtmp-client-for-android's People

Contributors

bryant1410 avatar ianholing avatar mekya avatar mstorsjo avatar pnemonic78 avatar vavadhani avatar

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.