Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README to documentation synchro #52

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/create-documentation-pr.yml
Original file line number Diff line number Diff line change
@@ -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 }}"

109 changes: 55 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!--<documentation_excluded>-->
[![badge](https://img.shields.io/twitter/follow/api_video?style=social)](https://twitter.com/intent/follow?screen_name=api_video)
&nbsp; [![badge](https://img.shields.io/github/stars/apivideo/api.video-flutter-player?style=social)](https://github.com/apivideo/api.video-flutter-player)
&nbsp; [![badge](https://img.shields.io/discourse/topics?server=https%3A%2F%2Fcommunity.api.video)](https://community.api.video)
Expand All @@ -8,73 +9,83 @@
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
<!--</documentation_excluded>-->
<!--<documentation_only>
---
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.

</documentation_only>-->
## 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.

```shell
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
<!DOCTYPE html>
<html>
<head>
<head>
...
<!-- Add the following line inside of the head tag -->
<script src="https://unpkg.com/@api.video/player-sdk" defer></script>
</head>
</head>

<body>
...
</body>
<body>
...
</body>
</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 |
|--------------|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|
Expand All @@ -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'),
);
Expand All @@ -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 |
|------------|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|
Expand All @@ -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 |
|--------------------------------------------|-------------------------------------------------------------------------------|
Expand All @@ -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 |
|--------------|-----------------------|-------------------------------------------------|
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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.

Expand All @@ -258,7 +259,7 @@ ApiVideoPlayerControllerEventsListener(
controller.removeListener(eventsListener);
```

# Sample application
## Sample application

```dart
import 'package:apivideo_player/apivideo_player.dart';
Expand Down Expand Up @@ -340,7 +341,7 @@ class _MyAppState extends State<MyApp> {
}
```

# Dependencies
## Dependencies

We are using external library

Expand All @@ -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).
Loading