From fdab3adb69d66273de1d9d8ef099c81077aae1de Mon Sep 17 00:00:00 2001 From: ThibaultBee Date: Fri, 7 Jun 2024 09:49:08 +0000 Subject: [PATCH] fix(lib): fix preview when container has an infinite dimension --- .../livestream/apivideo-flutter-livestream.md | 45 +++++++++++++------ 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/sdks/livestream/apivideo-flutter-livestream.md b/sdks/livestream/apivideo-flutter-livestream.md index 6eb72821..5c15a361 100644 --- a/sdks/livestream/apivideo-flutter-livestream.md +++ b/sdks/livestream/apivideo-flutter-livestream.md @@ -1,13 +1,19 @@ --- ## THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. IF YOU NEED TO CHANGE THIS FILE, CREATE A PR IN THE SOURCE REPOSITORY. title: Flutter RTMP live stream client -meta: - description: The official Flutter RTMP live stream client for api.video. [api.video](https://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. +meta: +description: The official Flutter RTMP live stream client for +api.video. [api.video](https://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. --- # Flutter RTMP Live stream Client -[api.video](https://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. +[api.video](https://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. + ## Project description @@ -17,11 +23,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: @@ -34,7 +39,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 @@ -46,8 +51,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 @@ -75,12 +81,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 @@ -147,7 +164,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 | |------------|--------------| @@ -156,7 +173,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)