From 0b3c5d473180e880e33b63f21a54dacc410792bc Mon Sep 17 00:00:00 2001 From: ThibaultBee <37510686+ThibaultBee@users.noreply.github.com> Date: Fri, 20 Oct 2023 15:35:13 +0200 Subject: [PATCH] docs(README): add info on extension and improve information --- README.md | 36 ++++++++++++------- .../ApiVideoPlayerNotificationController.kt | 7 +++- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 03780d9..a45b979 100644 --- a/README.md +++ b/README.md @@ -41,15 +41,6 @@ dependencies { } ``` -## Permissions - -In your `AndroidManifest.xml`, add the following code in ``: - -```xml - - -``` - ## Retrieve your video Id At this point, you must have uploaded a least one video to your account. If you haven't @@ -71,7 +62,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). -## Code sample +## 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/). 1. Add a `ApiVideoExoPlayerView` to your Activity/Fragment layout: @@ -119,6 +113,24 @@ val player = ApiVideoPlayerController( If you requires a fullscreen video. You will have to implement the `ApiVideoPlayerController.ViewListener` interface. Check out for the implementation in the [Sample application](#sample-application). +## Play your api.video video with ExoPlayer + +If you want to use the ExoPlayer directly, you can use the api.video Android extensions: + +1. Create a video +```kotlin +val videoOptions = VideoOptions("YOUR_VIDEO_ID", VideoType.VOD) +``` + +2. Pass it to ExoPlayer + +```kotlin +val exoplayer = ExoPlayer.Builder(context).build() // You already have that in your code +exoplayer.addMediaSource(videoOptions) +// Or +exoplayer.setMediaSource(videoOptions) +``` + # Sample application A demo application demonstrates how to use player. @@ -127,11 +139,11 @@ folder. On the first run, you will have to set your video Id: 1. Click on the FloatingActionButton -> Settings -2. Replace "YOUR_VIDEO_ID" by your video Id +2. Replace the video Id with your own video Id # Documentation -* [API documentation](https://apivideo.github.io/api.video-android-player/) +* [Player documentation](https://apivideo.github.io/api.video-android-player/) * [api.video documentation](https://docs.api.video) # Dependencies diff --git a/player/src/main/java/video/api/player/ApiVideoPlayerNotificationController.kt b/player/src/main/java/video/api/player/ApiVideoPlayerNotificationController.kt index 6834e70..2191bdf 100644 --- a/player/src/main/java/video/api/player/ApiVideoPlayerNotificationController.kt +++ b/player/src/main/java/video/api/player/ApiVideoPlayerNotificationController.kt @@ -15,9 +15,14 @@ import video.api.player.models.ApiVideoMediaDescriptionAdapter /** - * The api.video player controller class. + * The api.video player notification controller class. + * + * The `ApiVideoPlayerController` uses the `ApiVideoPlayerNotificationController` to display a + * notification when the player is launched. * * @param context the application context + * @param playerNotificationManager the [PlayerNotificationManager] to use + * @param mediaSession the [MediaSessionCompat] to use */ class ApiVideoPlayerNotificationController @OptIn(UnstableApi::class)