Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
A0ks9 authored Jun 1, 2024
1 parent f3313ca commit d421539
Showing 1 changed file with 31 additions and 29 deletions.
60 changes: 31 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,13 @@ dependencies {
}
```

<br>

### Step 2
> Add this file code without changing its name to your project Link:
[exo_control_view](https://github.com/A0ks9/EnhancedPlayerView/blob/main/app/src/main/res/layout/exo_control_view.xml)

<br>

### Step 3
### Step 2
> Add this widget to your `xml` activity file
```xml
<com.better.player.EnhancedPlayerView
android:id="@+id/name_view"
android:id="@+id/view_name"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:animation_enabled="false"
Expand All @@ -67,29 +61,12 @@ app:controller_layout_id="@layout/exo_control_view"

<br>

### Step 4
### Step 3
> add ExoPlayer to your project and use it normally
<br>

### Step 5
> If you want to cache the video, so it doesn't download every time the user opens the app. Then add this to the EnhancedPlayerView view
```java
binding.playerView.initializeDatabaseProvider();
binding.playerView.initializeActivityResult(getActivityResultRegistry());
```

<br>

### Step 6
> **Important:** You should add this code at the beginning Of onCreate
```java
binding.playerView.initializeViews(getResources(), getPackageName());
```

<br>

### Step 7
### Step 4
> After adding ExoPlayer to the project and intializing it then use it with the EnhancedPlayerView like this
```java
binding.playerView.setPlayer(player);
Expand All @@ -99,17 +76,21 @@ player.prepare();

<br>

### Step 8
### Step 5
> Add this Code in onResume of your Activity/Fragment
```java
binding.playerView.onResumeActivity();
```

<br>

> Add this code in onPause of your Activity/Fragment
```java
binding.playerView.onPauseActivity();
```

<br>

> Add this code in onDestory of your Activity/Fragment
```java
binding.playerView.onDestroyActivity();
Expand All @@ -122,6 +103,28 @@ if (player != null) {
<br>

### OPTIONAL
> If you want to hide UserID text that moves on the screen then use this in `xml`
```xml
app:show_floating_text="false"
```

<br>

> If you want to hide Close Image then use this in `xml`
```xml
app:show_close="false"
```

<br>

> If you want to cache the video, so it doesn't download every time the user opens the app. Then add this to the EnhancedPlayerView view
```java
binding.playerView.initializeDatabaseProvider();
binding.playerView.initializeActivityResult(getActivityResultRegistry());
```

<br>

> If you are looking for video orientation based on phone orientation then Add this code in your Activity/Fragment
```java
@Override
Expand All @@ -133,7 +136,6 @@ public void onConfigurationChanged(@NonNull Configuration newConfig) {

<br>

### OPTIONAL
> If tou are looking for PIP for the video then Add this code in your Activity/Fragment
```java
@Override
Expand Down

0 comments on commit d421539

Please sign in to comment.