diff --git a/.github/workflows/create-documentation-pr.yml b/.github/workflows/create-documentation-pr.yml new file mode 100644 index 0000000..9cf44c6 --- /dev/null +++ b/.github/workflows/create-documentation-pr.yml @@ -0,0 +1,27 @@ +name: Create documentation PR +on: + # Trigger the workflow on pull requests targeting the main branch + pull_request: + types: [assigned, unassigned, opened, reopened, synchronize, edited, labeled, unlabeled, edited, closed] + branches: + - main + +jobs: + create_documentation_pr: + if: github.event.action != 'closed' + + runs-on: ubuntu-latest + + steps: + - name: Check out current repository code + uses: actions/checkout@v2 + + - name: Create the documentation pull request + uses: apivideo/api.video-create-readme-file-pull-request-action@main + with: + source-file-path: "README.md" + destination-repository: apivideo/api.video-api-client-generator + destination-path: templates/documentation/sdks/player + destination-filename: apivideo-flutter-player.md + pat: "${{ secrets.PAT }}" + \ No newline at end of file diff --git a/README.md b/README.md index b1535a5..55d3072 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ + [![badge](https://img.shields.io/twitter/follow/api_video?style=social)](https://twitter.com/intent/follow?screen_name=api_video)   [![badge](https://img.shields.io/github/stars/apivideo/api.video-flutter-player?style=social)](https://github.com/apivideo/api.video-flutter-player)   [![badge](https://img.shields.io/discourse/topics?server=https%3A%2F%2Fcommunity.api.video)](https://community.api.video) @@ -8,35 +9,48 @@ video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app. -# Table of contents +## Table of contents - [Table of contents](#table-of-contents) - [Project description](#project-description) - [Getting started](#getting-started) - - [Installation](#installation) - - [Web usage](#web-usage) + - [Installation](#installation) + - [Web usage](#web-usage) - [Documentation](#documentation) - - [Instantiation](#instantiation) - - [1. The ApiVideoPlayerController](#1-the-apivideoplayercontroller) - - [2. The ApiVideoPlayer](#2-the-apivideoplayer) - - [Methods](#methods) - - [Properties](#properties) - - [Events listener](#events-listener) - - [Add a new event listener: Method 1](#add-a-new-event-listener-method-1) - - [Add a new event listener: Method 2](#add-a-new-event-listener-method-2) - - [Remove an event listener](#remove-an-event-listener) + - [Instantiation](#instantiation) + - [1. The ApiVideoPlayerController](#1-the-apivideoplayercontroller) + - [2. The ApiVideoPlayer](#2-the-apivideoplayer) + - [Methods](#methods) + - [Properties](#properties) + - [Events listener](#events-listener) + - [Add a new event listener: Method 1](#add-a-new-event-listener-method-1) + - [Add a new event listener: Method 2](#add-a-new-event-listener-method-2) + - [Remove an event listener](#remove-an-event-listener) - [Sample application](#sample-application) - [Dependencies](#dependencies) - [FAQ](#faq) -# Project description + + +## Project description Easily integrate a video player for videos from api.video in your Flutter application for iOS, Android and Web. -# Getting started +## Getting started -## Installation +### Installation Run the following command at the root of your project. @@ -44,37 +58,34 @@ Run the following command at the root of your project. flutter pub add apivideo_player ``` -### Web usage +#### Web usage -If you want to use your application as a web app, you need to add -the [api.video player SDK](https://github.com/apivideo/api.video-player-sdk) script -in `web/index.html` from the root of your project. +If you want to use your application as a web app, you need to add the [api.video player SDK](https://github.com/apivideo/api.video-player-sdk) script in `web/index.html` from the root of your project. ```html - + ... - + - -... - + + ... + ``` -# Documentation +## Documentation -## Instantiation +### Instantiation -### 1. The ApiVideoPlayerController +#### 1. The ApiVideoPlayerController To use a video player, you must instantiate a new controller. -The [ApiVideoPlayerController](https://github.com/apivideo/api.video-flutter-player/blob/main/lib/src/apivideo_player_controller.dart) -parameters are: +The [ApiVideoPlayerController](https://github.com/apivideo/api.video-flutter-player/blob/main/lib/src/apivideo_player_controller.dart) parameters are: | Parameter | Mandatory | Type | Description | |--------------|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------| @@ -89,7 +100,6 @@ parameters are: Once instantiated, you need to initialize the controller by calling its `initialize()` method. ```dart - final ApiVideoPlayerController controller = ApiVideoPlayerController( videoOptions: VideoOptions(videoId: 'VIDEO_ID'), ); @@ -99,12 +109,11 @@ await controller.initialize(); See the sample application below for more details. -### 2. The ApiVideoPlayer +#### 2. The ApiVideoPlayer A Widget that displays the video and its controls. -The [ApiVideoPlayer](https://github.com/apivideo/api.video-flutter-player/blob/main/lib/src/widgets/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 | |------------|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------| @@ -128,11 +137,9 @@ Widget build(BuildContext context) { } ``` -## Methods +### Methods -Once -the [ApiVideoPlayerController](https://github.com/apivideo/api.video-flutter-player/blob/main/lib/src/apivideo_player_controller.dart) -has been instantiated, you can control the player it has been assigned to with its methods: +Once the [ApiVideoPlayerController](https://github.com/apivideo/api.video-flutter-player/blob/main/lib/src/apivideo_player_controller.dart) has been instantiated, you can control the player it has been assigned to with its methods: | Method | Description | |--------------------------------------------|-------------------------------------------------------------------------------| @@ -159,11 +166,9 @@ await controller.initialize(); controller.play(); // Play the video ``` -## Properties +### Properties -Once -the [ApiVideoPlayerController](https://github.com/apivideo/api.video-flutter-player/blob/main/lib/src/apivideo_player_controller.dart) -has been instantiated, you can access the video player's properties: +Once the [ApiVideoPlayerController](https://github.com/apivideo/api.video-flutter-player/blob/main/lib/src/apivideo_player_controller.dart) has been instantiated, you can access the video player's properties: | Property | Type | Description | |--------------|-----------------------|-------------------------------------------------| @@ -191,13 +196,11 @@ await controller.initialize(); final bool isMuted = await controller.isMuted; ``` -## Events listener +### Events listener -### Add a new event listener: Method 1 +#### Add a new event listener: Method 1 -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: +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 @@ -208,11 +211,9 @@ final ApiVideoPlayerController controller = ApiVideoPlayerController( ); ``` -### Add a new event listener: Method 2 +#### Add a new event listener: Method 2 -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: +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 @@ -238,7 +239,7 @@ controller.addListener(eventsListener); | onEnd | VoidCallback | A callback called when the video has ended | | onError | Function(Object) | A callback called when an error occured | -### Remove an event listener +#### Remove an event listener To remove an event listener, you need to call the controller's `removeListener` method. @@ -258,7 +259,7 @@ ApiVideoPlayerControllerEventsListener( controller.removeListener(eventsListener); ``` -# Sample application +## Sample application ```dart import 'package:apivideo_player/apivideo_player.dart'; @@ -340,7 +341,7 @@ class _MyAppState extends State { } ``` -# Dependencies +## Dependencies We are using external library @@ -349,7 +350,7 @@ We are using external library | [Exoplayer](https://github.com/google/ExoPlayer) | [README.md](https://github.com/google/ExoPlayer#readme) | -# FAQ +## 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).