Giter Club home page Giter Club logo

zhengchuangjian / mediasoup-client-android Goto Github PK

View Code? Open in Web Editor NEW

This project forked from haiyangwu/mediasoup-client-android

0.0 0.0 0.0 127.63 MB

mediasoup android client side library https://mediasoup.org

License: MIT License

Java 4.98% CMake 0.18% C++ 80.00% Shell 0.33% Python 5.43% C 5.67% Assembly 0.04% Objective-C 1.23% Objective-C++ 1.86% HTML 0.05% MATLAB 0.06% CSS 0.01% JavaScript 0.08% Roff 0.01% Batchfile 0.01% nesC 0.08% Pawn 0.01% Makefile 0.01% sed 0.01% PowerShell 0.01%

mediasoup-client-android's Introduction

mediasoup-client-android

Bintray Codacy Badge

mediasoup android client side library https://mediasoup.org

Getting Started

Setting up the dependency

Include mediasoup-client-android into your project, for example, as a Gradle compile dependency:

implementation 'org.mediasoup.droid:mediasoup-client:3.0.8-beta-3'

Example

  • Initialize MediasoupClient
MediasoupClient.initialize(getApplicationContext());
  • Create Device and load routerRtpCapabilities
Device mMediasoupDevice = new Device();
// ...
// routerRtpCapabilities, the response of request `getRouterRtpCapabilities` from mediasoup-demo server
mMediasoupDevice.load(routerRtpCapabilities)
  • Create SendTransport and produce MediaStreamTrack
// ...
// res, the response of request `createWebRtcTransport` from mediasoup-demo server
JSONObject info = new JSONObject(res);
String id = info.optString("id");
String iceParameters = info.optString("iceParameters");
String iceCandidates = info.optString("iceCandidates");
String dtlsParameters = info.optString("dtlsParameters");
String sctpParameters = info.optString("sctpParameters");

SendTransport mSendTransport =
  mMediasoupDevice.createSendTransport(
  sendTransportListener, id, iceParameters, iceCandidates, dtlsParameters);
// ...
// mLocalVideoTrack, created by `org.webrtc.PeerConnectionFactory`
Producer mCamProducer =
  mSendTransport.produce(
  producer -> {
    Logger.e(TAG, "onTransportClose(), camProducer");
  },
  mLocalVideoTrack, null, null);
  • Create RecvTransport and consume MediaStreamTrack
// ...
// res, the response of request `createWebRtcTransport` from mediasoup-demo server
JSONObject info = new JSONObject(res);
String id = info.optString("id");
String iceParameters = info.optString("iceParameters");
String iceCandidates = info.optString("iceCandidates");
String dtlsParameters = info.optString("dtlsParameters");
String sctpParameters = info.optString("sctpParameters");

RecvTransport mRecvTransport =
  mMediasoupDevice.createRecvTransport(
  recvTransportListener, id, iceParameters, iceCandidates, dtlsParameters);

// ...
// request, the request `newConsumer` from mediasoup-demo server
JSONObject data = request.getData();
String peerId = data.optString("peerId");
String producerId = data.optString("producerId");
String id = data.optString("id");
String kind = data.optString("kind");
String rtpParameters = data.optString("rtpParameters");
String type = data.optString("type");
String appData = data.optString("appData");
Consumer consumer =
  mRecvTransport.consume(
  c -> {
    Logger.w(TAG, "onTransportClose for consume");
  },
  id, producerId, kind, rtpParameters, appData);

Dependencies

  • libmediasoupclient mediasoup client side C++ library which supported by mediasoup team
  • webrtc-android-build my personal webrtc android prebuilt static library which may be compiled with some patch

Demo Project

mediasoup-demo-android

TODO

  • sync to the latest version of libmediasoupclient and adapter to webrtc m79
  • support DataProducer etc
  • add convenient Gradle Tasks for sync, compile and so on
  • add script to use generate-jni to automatic generate `xxx-jni.h
  • add java MediaSoupClientException mapping to `MediaSoupClientErrors.hpp
  • document

Bugs and Feedback

For bugs, feature requests, and discussion please use GitHub Issues.

Author

Haiyang Wu(@haiyangwu at Github)

License

MIT

mediasoup-client-android's People

Contributors

haiyangwu avatar ethand91 avatar rawnsley 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.