From f79e0a778b2bcd925a93cf6fb1b07f54b389f3ac Mon Sep 17 00:00:00 2001 From: ThibaultBee <37510686+ThibaultBee@users.noreply.github.com> Date: Mon, 12 Feb 2024 15:07:26 +0100 Subject: [PATCH] docs(README.md): add info about `ApiVideoCameraPreview` fit parameter --- README.md | 59 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index f456799..ad3ff46 100644 --- a/README.md +++ b/README.md @@ -15,14 +15,14 @@ your app. - [Table of contents](#table-of-contents) - [Project description](#project-description) - [Getting started](#getting-started) - - [Installation](#installation) - - [Permissions](#permissions) - - [Code sample](#code-sample) - - [Manage application lifecycle](#manage-application-lifecycle) + - [Installation](#installation) + - [Permissions](#permissions) + - [Code sample](#code-sample) + - [Manage application lifecycle](#manage-application-lifecycle) - [Example App](#example-app) - - [Setup](#setup) - - [Android](#android) - - [iOS](#ios) + - [Setup](#setup) + - [Android](#android) + - [iOS](#ios) - [Plugins](#plugins) - [FAQ](#faq) @@ -30,15 +30,21 @@ your app. + ## Project description This module is made for broadcasting RTMP live stream from smartphone camera. @@ -47,11 +53,10 @@ This module is made for broadcasting RTMP live stream from smartphone camera. ### Installation -In your pubspec.yaml file, add the following: +Run the following command at the root of your project. -```yaml -dependencies: - apivideo_live_stream: ^1.1.3 +```shell +flutter pub add apivideo_live_stream ``` In your dart file, import the package: @@ -64,7 +69,7 @@ import 'package:apivideo_live_stream/apivideo_live_stream.dart'; To be able to broadcast, you must: -1) On Android: ask for internet, camera and microphone permissions: +1. On Android: ask for internet, camera and microphone permissions: ```xml @@ -76,8 +81,9 @@ To be able to broadcast, you must: ``` The library will require android.permission.CAMERA and android.permission.RECORD_AUDIO at runtime. +You don't need to request them. -2) On iOS: update the Info.plist with a usage description for camera and microphone +2. On iOS: update the Info.plist with a usage description for camera and microphone ```xml @@ -105,12 +111,23 @@ await _controller.initialize(); 3. Adds a CameraPreview widget as a child of your view -Ensure that _controller.create() has been finished before creating the CameraPreview widget. - ```dart -child: ApiVideoCameraPreview(controller: _controller), +@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](https://api.flutter.dev/flutter/painting/BoxFit.html) for more information) +- `child`: a child widget to overlay on top of the preview (optional) + 4. Starts a live stream ```dart @@ -177,7 +194,7 @@ identifier. ## Plugins -api.video Flutter live stream library is using external native library: +api.video Flutter live stream library is using external native libraries: | Plugin | README | |------------|--------------| @@ -186,7 +203,7 @@ api.video Flutter live stream library is using external native library: ## FAQ -If you have any questions, ask us in the [community](https://community.api.video). Or +If you have any questions, ask us in the [community](https://community.api.video) or use [issues](https://github.com/apivideo/api.video-flutter-live-stream/issues). [//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax)