Skip to content

Commit

Permalink
docs(README): add support for a compose player
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultBee committed Nov 8, 2023
1 parent cbc93ed commit 129b7c1
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ your app.
- [Installation](#installation)
- [Gradle](#gradle)
- [Retrieve your video Id](#retrieve-your-video-id)
- [Usage](#usage)
- [View-based usage](#view-based-usage)
- [Supported player views](#supported-player-views)
- [Jetpack Compose usage](#jetpack-compose-usage)
- [Play your api.video video with ExoPlayer, MediaPlayer and VideoView](#play-your-apivideo-video-with-exoplayer-mediaplayer-and-videoview)
- [Sample application](#sample-application)
- [Documentation](#documentation)
Expand All @@ -27,6 +28,8 @@ your app.

Easily integrate a video player for videos from [api.video](https://api.video) in your Android
application.
The api.video Android player will help you to play the HLS video from api.video. It also generates
analytics of [your viewers usage](https://api.video/product/video-analytics/).

# Getting started

Expand All @@ -42,6 +45,14 @@ dependencies {
}
```

For Jetpack Compose, also add the following code in `dependencies`:

```groovy
dependencies {
implementation 'video.api:android-compose-player:1.4.2'
}
```

## Retrieve your video Id

At this point, you must have uploaded a least one video to your account. If you haven't
Expand All @@ -63,10 +74,10 @@ a video Id to use this component and play a video from api.video. To get yours,
Alternatively, you can find your video Id in the video details of
your [dashboard](https://dashboard.api.video).

## Usage
## View-based usage

The api.video Android player will help you to play the HLS video from api.video. It also generates
analytics of [your viewers usage](https://api.video/product/video-analytics/).
The api.video Android player comes with a view `ApiVideoExoPlayerView` to display the video and its
controller `ApiVideoPlayerController`.

1. Add a `ApiVideoExoPlayerView` to your Activity/Fragment layout:

Expand Down Expand Up @@ -145,6 +156,17 @@ Otherwise, in the `ApiVideoPlayerController`, you can also use the following vie

The `SurfaceView` and the `Surface` require more work to be used.

## Jetpack compose usage

The api.video Android player comes with a composable `ApiVideoPlayer` to display the video from a
compose application. In your application, you can add:

```kotlin
ApiVideoPlayer(
videoOptions = VideoOptions("YOUR_VIDEO_ID", VideoType.VOD),
)
```

## Play your api.video video with ExoPlayer, MediaPlayer and VideoView

If you want to use the ExoPlayer directly, you can use the api.video Android extensions:
Expand Down

0 comments on commit 129b7c1

Please sign in to comment.