搜尋套件、儲存庫與 APP 分類

套件詳情v1.2.0

apivideo_live_stream

適用於您音訊/影片應用的 Flutter RTMP 直播串流客戶端。由 api.video 親心製作。

AndroidiOS
近 30 天下載
6690
喜歡數
99
Pub 分數
140

安裝套件

flutter pub add apivideo_live_stream

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個 Flutter RTMP 直播客戶端,可在 Flutter 應用中實現即時音訊與視訊廣播。由 api.video 用 ❤️ 建構,支援與 Android 與 iOS 上的直播工作流程無縫整合。此套件透過使用 RTMP 協定簡化了直播串流的設定與管理,非常適合用於直播活動、網路研討會或社交直播平台等互動應用。它為企圖提供高品質、低延遲直播內容的開發者提供了穩健的基礎。

適用情境

  • 即時事件直播
  • 網路研討會串流
  • 社交媒體即時動態
  • 互動視頻聊天
  • 即時內容共享

主要特色

  • RTMP 直播串流支援
  • Android 和 iOS 相容性
  • 與 api.video 的簡單整合
  • 低延遲串流
  • 安全連接處理

適合對象

  • 開發即時影片應用的開發者
  • 使用 api.video 進行串流傳輸的團隊
  • 需要即時音訊/影像的應用程式
  • 初創公司推出即時功能
  • 以行動裝置為首的串流解決方案

使用建議

  • 需要 api.video 帳戶和 API 密鑰
  • 限制為 RTMP 協議
  • 依賴穩定的互聯網連接
  • 可能需要為自訂串流設定進行額外設定
  • 不適用於非即時影片播放

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

badge   badge   badge

Flutter RTMP live stream client

api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.

Table of contents

Project description

This module is made for broadcasting RTMP live stream from smartphone camera.

Getting started

Installation

Run the following command at the root of your project:

flutter pub add apivideo_live_stream

In your dart file, import the package:

import 'package:apivideo_live_stream/apivideo_live_stream.dart';
Permissions

To be able to broadcast, you must:

  1. On Android: ask for internet, camera and microphone permissions:

<manifest>
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.CAMERA" />
</manifest>

The library will require android.permission.CAMERA and android.permission.RECORD_AUDIO at runtime. You don't need to request them.

  1. On iOS: update the Info.plist with a usage description for camera and microphone

<key>NSCameraUsageDescription</key>
<string>Your own description of the purpose</string>
<key>NSMicrophoneUsageDescription</key>
<string>Your own description of the purpose</string>
Code sample
  1. Creates a live stream controller

final ApiVideoLiveStreamController _controller = ApiVideoLiveStreamController(
    initialAudioConfig: AudioConfig(), initialVideoConfig: VideoConfig.withDefaultBitrate());
  1. Initializes the live stream controller
await _controller.initialize();
  1. Adds a CameraPreview widget as a child of your view
@override
Widget build(BuildContext context) {
  return SizedBox(
      width: 300.0,
      height: 300.0,
      child: ApiVideoCameraPreview(controller: _controller));
}

ApiVideoCameraPreview parameters:

  • controller: the live stream controller
  • fit: the fit of the preview (default is BoxFit.contain, see BoxFit for more information)
  • child: a child widget to overlay on top of the preview (optional)
  1. Starts a live stream
_controller.startStreaming("YOUR_STREAM_KEY");
  1. Stops streaming and preview
_controller.stop();
Manage application lifecycle

On the application side, you must manage application lifecycle:

@override
void didChangeAppLifecycleState(AppLifecycleState state) {
  if (state == AppLifecycleState.inactive) {
    _controller.stop();
  } else if (state == AppLifecycleState.resumed) {
    _controller.startPreview();
  }
}

Example App

You can try our example app, feel free to test it.

Setup

Be sure to follow the Flutter installation steps before anything.

  1. Open Android Studio
  2. File > New > Project from Version Control

In URL field, type:

git@github.com:apivideo/api.video-flutter-live-stream.git

Wait for the indexation to finish.

Android

Connect an Android device to your computer and click on the Run main.dart button.

iOS
  1. Connect an iOS device to your computer and click on the Run main.dart button.

  2. The build will fail because you haven't set your development profile, sign your application:

Open Xcode, click on "Open a project or file" and open the YOUR_PROJECT_NAME/example/ios/Runner.xcworkspace file.
Click on Example, go in Signin & Capabilities tab, add your team and create a unique bundle identifier.

Plugins

api.video Flutter live stream library is using external native libraries:

Plugin README
StreamPack StreamPack
HaishinKit HaishinKit

FAQ

If you have any questions, ask us in the community or use issues.

所屬分類

依賴

依賴清單 4 項

原始碼儲存庫

使用此套件的專案