avlib-demo

Introduction: Examples of usage AVLib sdk
More: Author   ReportBugs   
Tags:

Examples for AVLib sdk usage.

AVLib library is powerful RTMP-streaming solution that provides following features:

  • Ability to use with outdated and low-performance devices with Android 4.1+
  • Auto-detection device performance and setting an optimal stream configuration
  • Handling rotation and size changes with no stream re-initiation
  • Ability to customize frame size, video codec quality, video and audio bitrate, and disable audio
  • Activity and Fragment support
  • Decreasing bitrate when connection is slow
  • Switching the main/front cameras
  • Scaling types, aspect ratio correction, and full handling lifecycle
  • Handling errors
  • Simple interface
  • Fast performance
  • No dependencies
  • Armv7a and armv8-64 support
  • Action cameras support
  • “Tap to focus” feature
  • “Record stream” feature
  • Device screen broadcasting


How to use:

  • Contact with us for AVLib sdk

  • Add AVLib sdk into your project (It's one aar file without any dependencies)

dependencies {
    implementation(name: 'AVlib2.0.0', ext: 'aar')
}

note: inside AvLib SDK used only one dependency androidx.appcompat:appcompat:1.1.0


  • For broadcasting from android cam use CameraStreamer class. Create instance and attach 'broadcast view'.

Camera view from layout

<com.onix.avlib.view.CameraStreamView
    android:id="@+id/camera_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
private val streamer = CameraStreamer(CamType.MAIN)

override fun onCreate(savedInstanceState: Bundle?) {
   super.onCreate(savedInstanceState)
   retainInstance = true
   streamer.onCreate(activity, savedInstanceState)
}
override fun onCreateView(...) {
...
   streamer.bindView(binding.cameraView, PreviewScaleType.CENTER_CROP)
   streamer.setStreamListener(this)
   return view
}
  • add lifecycle method onSaveInstanceState :
override fun onSaveInstanceState(outState: Bundle) {
   super.onSaveInstanceState(outState)
   streamer.onSaveInstanceState(outState)
}
  • Сustomize streamer before start: setVideoBitrate(VideoBitrate bitrate), setAudioBitrate(AudioBitrate bitrate), setPreviewSize(PreviewSize size), etc.
override fun onInitCompleted() {
    streamer.setServerUrl(serverUrl)
}
  • Start/Stop broadcasting:
streamer.startStreaming();
streamer.stopStreaming();

Learn More

AVLib sdk developer's guide

Privacy Policy

Official website

Copyright © 2020 Onix-Systems, LLC, All Rights Reserved.

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools