From 3ad64118c6c3bc70ace460985477b3bfd1b64a96 Mon Sep 17 00:00:00 2001 From: olivierapivideo Date: Mon, 13 Nov 2023 17:08:03 +0000 Subject: [PATCH] README to documentation synchro --- .../sdks/player/apivideo-flutter-player.md | 91 ++++++++++--------- 1 file changed, 50 insertions(+), 41 deletions(-) diff --git a/templates/documentation/sdks/player/apivideo-flutter-player.md b/templates/documentation/sdks/player/apivideo-flutter-player.md index 570ff6ff..89c19d6e 100644 --- a/templates/documentation/sdks/player/apivideo-flutter-player.md +++ b/templates/documentation/sdks/player/apivideo-flutter-player.md @@ -3,12 +3,14 @@ title: api.video Flutter Player meta: description: The official api.video Flutter Player component 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. --- + # api.video Flutter Player -[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 @@ -39,7 +41,7 @@ If you want to use your application as a web app, you need to add the [api.video - ... + ... ``` @@ -80,15 +82,17 @@ See the sample application below for more details. A Widget that displays the video and its controls. -The [ApiVideoPlayer](https://github.com/apivideo/api.video-flutter-player/blob/main/lib/src/apivideo_player.dart) constructor takes 3 parameters: +The [ApiVideoPlayer](https://github.com/apivideo/api.video-flutter-player/blob/main/lib/src/widgets/apivideo_player.dart) constructor takes 3 parameters: -| Parameter | Mandatory | Type | Description | -|--------------|--------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------| -| controller | Yes | [ApiVideoPlayerController](https://github.com/apivideo/api.video-flutter-player/blob/main/lib/src/apivideo_player_controller.dart) | The controller that controls a video player | -| hideControls | No (default false) | bool | Allows you to hide or show the controls of a video player | -| theme | No (default PlayerTheme) | [PlayerTheme](https://github.com/apivideo/api.video-flutter-player/blob/4efe23f20ccf1c9459cee7588da1d3fed74e8e36/lib/src/apivideo_player.dart#L102) | Allows you to customize the video player's colors | +| Parameter | Mandatory | Type | Description | +|------------|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------| +| controller | Yes | [ApiVideoPlayerController](https://github.com/apivideo/api.video-flutter-player/blob/main/lib/src/apivideo_player_controller.dart) | The controller that controls a video player | | Allows you to hide or show the controls of a video player | +| fit | No (default BoxFit.contain) | [BoxFit](https://api.flutter.dev/flutter/painting/BoxFit.html) | How the player should be inscribed into its box. | +| style | No (default api.video style) | [PlayerStyle](https://github.com/apivideo/api.video-flutter-player/blob/main/lib/src/style/apivideo_style.dart#L102) | Allows you to customize the video player's colors, shapes,... | +| child | No (default api.video overlay) | Widget | Replace api.video overlay by your own implementation. | ```dart + final ApiVideoPlayerController controller = ApiVideoPlayerController( videoOptions: VideoOptions(videoId: 'VIDEO_ID'), ); @@ -96,9 +100,9 @@ final ApiVideoPlayerController controller = ApiVideoPlayerController( await controller.initialize(); Widget build(BuildContext context) { - return ApiVideoPlayer( - controller: controller, - ) + return ApiVideoPlayer( + controller: controller, + ); } ``` @@ -121,6 +125,7 @@ Once the [ApiVideoPlayerController](https://github.com/apivideo/api.video-flutte Example: ```dart + final ApiVideoPlayerController controller = ApiVideoPlayerController( videoOptions: VideoOptions(videoId: 'VIDEO_ID'), ); @@ -150,6 +155,7 @@ Once the [ApiVideoPlayerController](https://github.com/apivideo/api.video-flutte Example: ```dart + final ApiVideoPlayerController controller = ApiVideoPlayerController( videoOptions: VideoOptions(videoId: 'VIDEO_ID'), ); @@ -166,11 +172,12 @@ final bool isMuted = await controller.isMuted; When you instantiate a new [ApiVideoPlayerController](https://github.com/apivideo/api.video-flutter-player/blob/main/lib/src/apivideo_player_controller.dart), you can bind callbacks to some events: ```dart + final ApiVideoPlayerController controller = ApiVideoPlayerController( - videoOptions: VideoOptions(videoId: 'VIDEO_ID'), - onPlay: () => print('PLAY'), - onPause: () => print('PAUSE'), - ); + videoOptions: VideoOptions(videoId: 'VIDEO_ID'), + onPlay: () => print('PLAY'), + onPause: () => print('PAUSE'), +); ``` #### Add a new event listener: Method 2 @@ -178,18 +185,19 @@ final ApiVideoPlayerController controller = ApiVideoPlayerController( Once the [ApiVideoPlayerController](https://github.com/apivideo/api.video-flutter-player/blob/main/lib/src/apivideo_player_controller.dart) has been instantiated, you can bind callbacks to some events: ```dart + final ApiVideoPlayerController controller = ApiVideoPlayerController( videoOptions: VideoOptions(videoId: 'VIDEO_ID'), ); await controller.initialize(); -final ApiVideoPlayerEventsListener eventsListener = - ApiVideoPlayerEventsListener( - onPlay: () => print('PLAY'), - ); +final ApiVideoPlayerControllerEventsListener eventsListener = +ApiVideoPlayerControllerEventsListener( + onPlay: () => print('PLAY'), +); -controller.addEventsListener(eventsListener); +controller.addListener(eventsListener); ``` | Event | Type | Description | @@ -202,31 +210,24 @@ controller.addEventsListener(eventsListener); #### Remove an event listener -To remove an event listener, you need to call the controller's `removeEventsListener` method. +To remove an event listener, you need to call the controller's `removeListener` method. ```dart + final ApiVideoPlayerController controller = ApiVideoPlayerController( videoOptions: VideoOptions(videoId: 'VIDEO_ID'), ); await controller.initialize(); -final ApiVideoPlayerEventsListener eventsListener = - ApiVideoPlayerEventsListener( - onPlay: () => print('PLAY'), - ); +final ApiVideoPlayerControllerEventsListener eventsListener = +ApiVideoPlayerControllerEventsListener( + onPlay: () => print('PLAY'), +); -controller.removeEventsListener(eventsListener); +controller.removeListener(eventsListener); ``` -## Dependencies - -We are using external library - -| Plugin | README | -|--------------------------------------------------|---------------------------------------------------------| -| [Exoplayer](https://github.com/google/ExoPlayer) | [README.md](https://github.com/google/ExoPlayer#readme) | - ## Sample application ```dart @@ -255,8 +256,8 @@ class _MyAppState extends State { void initState() { super.initState(); _controller.initialize(); - _controller.addEventsListener( - ApiVideoPlayerEventsListener( + _controller.addListener( + ApiVideoPlayerControllerEventsListener( onPause: () => print('PAUSE'), ), ); @@ -307,10 +308,18 @@ class _MyAppState extends State { ); } } - ``` +## Dependencies + +We are using external library + +| Plugin | README | +|--------------------------------------------------|---------------------------------------------------------| +| [Exoplayer](https://github.com/google/ExoPlayer) | [README.md](https://github.com/google/ExoPlayer#readme) | + + ## FAQ -If you have any questions, ask us in the [community](https://community.api.video). Or -use [issues](https://github.com/apivideo/api.video-flutter-player/issues). \ No newline at end of file +If you have any questions, ask us in the [community](https://community.api.video) or +use [issues](https://github.com/apivideo/api.video-flutter-player/issues).