From 29631b1f9e50a98f5515c3b77cccbe0e0eb98d4f Mon Sep 17 00:00:00 2001 From: Arthur Ivanets Date: Tue, 1 Jan 2019 22:08:15 +0200 Subject: [PATCH] Update README.md --- README.md | 63 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cd6b8fa..62b1eff 100644 --- a/README.md +++ b/README.md @@ -556,7 +556,9 @@ For more details **2. HTTP Video Request Authorization** -In cases when your video request requires authorization, you can use the [`RequestAuthorizer`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/player/datasource/RequestAuthorizer.java) to provide the necessary auth token whenever the player requests it. The created [`RequestAuthorizer`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/player/datasource/RequestAuthorizer.java) should be passed around in the ARVI [`Config`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/Config.java) object. +In cases when your video requests require authorization, you can use the [`RequestAuthorizer`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/player/datasource/RequestAuthorizer.java) to provide the necessary auth token whenever the player requests it. The created [`RequestAuthorizer`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/player/datasource/RequestAuthorizer.java) should be associated with the [`ArviHttpDataSourceFactory`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/player/datasource/ArviHttpDataSourceFactory.java) and passed around in the ARVI [`Config`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/Config.java) object. + +****RequestAuthorizer****
Kotlin (click to expand)

@@ -585,6 +587,8 @@ import com.arthurivanets.arvi.player.datasource.RequestAuthorizer; public final class ArviRequestAuthorizer extends RequestAuthorizer { + //... + @Override public final String getAuthorization() { return ("Bearer " + authTokenProvider.getAuthToken()); @@ -595,15 +599,62 @@ public final class ArviRequestAuthorizer extends RequestAuthorizer {


-> ***See: [`RequestAuthorizer`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/player/datasource/RequestAuthorizer.java), [`Config`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/Config.java)*** +****ARVI Config**** + +
Kotlin (click to expand) +

+ +````kotlin +//... +val config = Config.Builder() + .dataSourceFactory( + ArviHttpDataSourceFactory(context.playerProvider.libraryName).apply { + setConnectTimeout(REQUEST_CONNECT_TIMEOUT_IN_MILLIS) + setReadTimeout(REQUEST_READ_TIMEOUT_IN_MILLIS) + + // Your request authorizer + setRequestAuthorizer(ArviRequestAuthorizer(...)) + } + ) + .build() +```` + +


+ +
Java (click to expand) +

+ +````java +//... +final ArviHttpDataSourceFactory dataSourceFactory = new ArviHttpDataSourceFactory(PlayerProviderImpl.getInstance(context).getLibraryName()); +dataSourceFactory.setConnectTimeout(REQUEST_CONNECT_TIMEOUT_IN_MILLIS); +dataSourceFactory.setReadTimeout(REQUEST_READ_TIMEOUT_IN_MILLIS); + +// Your request authorizer +dataSourceFactory.setRequestAuthorizer(new ArviRequestAuthorizer(...)); + +// the final Config +final Config config = new Config.Builder() + .dataSourceFactory(dataSourceFactory) + .build(); +```` + +


+ +> ***See: [`RequestAuthorizer`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/player/datasource/RequestAuthorizer.java), [`ArviHttpDataSourceFactory`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/player/datasource/ArviHttpDataSourceFactory.java), [`Config`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/Config.java)*** + +**3. ViewHolder Playback Control** + +All [`Playable`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/widget/Playable.java) Item `ViewHolder`s are capable of controlling almost every aspect of the corresponding playback, thus giving you more power in terms of the actual implementation. -**3. ViewHolder Playback control** +For more details on what possibilities the [`Playable`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/widget/Playable.java) gives you +> ***See: [`Playable`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/widget/Playable.java)*** -//TODO <--- +**4. ARVI Players** -**4. Custom Implementations** +All the [`Player`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/player/Player.java)s created using the [`PlayerProviderImpl`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/PlayerProviderImpl.java) can be used as stand alone players, as they are totally independent entities, the only thing to remember here is that you should properly handle the player binding/unbinding events to avoid the potential memory leaks and other related issues. -//TODO <--- +> ***See: [`Player`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/player/Player.java), [`PlayerProvider`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/PlayerProvider.java), [`PlayerProviderImpl`](https://github.com/arthur3486/ARVI/blob/master/arvi/src/main/java/com/arthurivanets/arvi/PlayerProviderImpl.java)*** ## Contribution