Live streaming from mobile device camera

TRUETECH is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Live streaming from mobile device camera
Complex
from 1 week to 3 months
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    757
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1054
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    874
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Live Streaming from Mobile Device Camera

Press a button — viewers see you live in 2–3 seconds. Behind those seconds: camera capture, H.264/H.265 hardware encoding, container assembly, sending to media server, and CDN delivery. Each stage has its own API and ways to break.

Video and Audio Capture

iOS. AVCaptureSession — entry point. Configure quality preset (sessionPreset = .hd1280x720), add AVCaptureDeviceInput for camera and microphone, add AVCaptureVideoDataOutput and AVCaptureAudioDataOutput with delegates. captureOutput(_:didOutput:from:) delivers CMSampleBuffer — raw frames from camera in real time.

Orientation: AVCaptureConnection.videoOrientation must be updated on device rotation. Without it, viewers see video sideways if broadcast started in portrait.

Android. Camera2 API or CameraX (recommended). CameraX.bindToLifecycle() with Preview + VideoCapture use case. VideoCapture.output.prepareRecording() — native recording. For streaming you need raw stream: ImageAnalysis use case with setOutputImageFormat(OUTPUT_IMAGE_FORMAT_YUV_420_888), process frames manually via MediaCodec.

Hardware Encoding

Software FFmpeg on phone — overheating and drained battery in 20 minutes. Use hardware encoder.

iOS: VideoToolboxVTCompressionSession. Create session with kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder: kCFBooleanTrue. Callback outputCallback receives CMSampleBuffer with encoded H.264/H.265.

Key parameters:

  • kVTCompressionPropertyKey_RealTime: kCFBooleanTrue — realtime mode
  • kVTCompressionPropertyKey_ProfileLevel: kVTProfileLevel_H264_High_AutoLevel
  • kVTCompressionPropertyKey_AverageBitRate: 2_000_000 (2 Mbps for 720p)
  • kVTCompressionPropertyKey_MaxKeyFrameInterval: 60 (keyframe every 2 sec at 30 fps)

Android: MediaCodec. MediaFormat.createVideoFormat("video/avc", width, height). configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE). In dequeueOutputBuffer get encoded NAL units.

For audio: AudioRecordMediaCodec with audio/mp4a-latm (AAC-LC). Sample rate 44100 Hz, bitrate 128 kbps.

Packing into RTMP or SRT

From CMSampleBuffer/MediaCodec output get H.264 NAL units and AAC frames. Need to pack into transport protocol.

Ready libraries save from manual implementation:

  • iOS: HaishinKit (Swift) — RTMP, SRT, HLS. Native Swift without FFmpeg dependency. RTMPStream, SRTStream.
  • Android: rtmp-rtsp-stream-client-java (Pedro Vicente) — RTMP and RTSP push. RtmpCamera2 with CameraX. SRTStream for SRT.
  • Flutter: rtmp_streaming (wrapper over native libraries) or native platform channel.
  • Cross-platform with FFmpeg: ffmpeg-kit-ios / ffmpeg-kit-androidFFmpegKit.executeAsync("-f avfoundation -i 0:0 -c:v libx264 -preset ultrafast -f flv rtmp://..."). Works but higher CPU than hardware encoder.

Adaptive Bitrate on Poor Connection

User enters metro — connection drops. Without adaptation: buffer overflows, stream dies.

Monitoring: RTMPStream.info.byteCount in HaishinKit, NetworkInfo callback in rtmp-rtsp-stream-client-java — track sending speed. If actual bandwidth falls below current bitrate:

  1. Reduce videoBitrate (HaishinKit: stream.videoSettings.bitRate)
  2. Lower framerate 30 to 15 fps
  3. Reduce resolution 720p to 480p

Don't do this too often — max every 5–10 seconds, else quality constantly jumps.

Preview and UI

Camera preview — AVCaptureVideoPreviewLayer (iOS) / PreviewView CameraX (Android). Overlay UI: "Live" indicator, viewer count, bitrate and signal level.

Switch front/rear camera without interrupting stream: iOS — AVCaptureSession.beginConfiguration() → remove old input → add new → commitConfiguration(). HaishinKit supports in one line: stream.captureSettings.isVideoMirrored.

Timeline

Stream from camera implementation (RTMP or SRT) on one platform with preview and basic UI — 3–5 days. Cross-platform with adaptive bitrate, camera switching, specific media server integration — 1–2 weeks.