Skip to content

Commit

Permalink
Added Error CallBack
Browse files Browse the repository at this point in the history
  • Loading branch information
Reza Amuzadeh committed Aug 19, 2019
1 parent c82ecad commit bd56a2b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import androidx.appcompat.app.AppCompatActivity;

import com.potyvideo.library.AndExoPlayerView;
import com.potyvideo.library.globalInterfaces.ExoPlayerCallBack;
import com.potyvideo.library.utils.PathUtil;
import com.potyvideo.library.utils.PublicFunctions;

Expand Down
6 changes: 0 additions & 6 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@
android:padding="@dimen/global_padding_extra"
android:text="SOME OTHER VIEWS ;)" />

<androidx.appcompat.widget.AppCompatButton
android:id="@+id/appCompatButtonPause"
android:layout_width="match_parent"
android:text="PAUSE"
android:layout_height="wrap_content" />

</LinearLayout>

</LinearLayout>
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 12
versionName "1.0.12"
versionCode 13
versionName "1.0.13"
vectorDrawables.useSupportLibrary = true

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
10 changes: 10 additions & 0 deletions library/src/main/java/com/potyvideo/library/AndExoPlayerView.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory;
import com.potyvideo.library.globalEnums.EnumAspectRatio;
import com.potyvideo.library.globalEnums.EnumResizeMode;
import com.potyvideo.library.globalInterfaces.ExoPlayerCallBack;
import com.potyvideo.library.utils.PublicFunctions;
import com.potyvideo.library.utils.PublicValues;

Expand Down Expand Up @@ -80,6 +81,8 @@ public class AndExoPlayerView extends LinearLayout implements View.OnClickListen
private TrackSelection.Factory trackSelectionFactory;
private TrackSelector trackSelector;

private ExoPlayerCallBack exoPlayerCallBack;

public class ComponentListener implements Player.EventListener {

String TAG = AndExoPlayerView.ComponentListener.class.getSimpleName();
Expand Down Expand Up @@ -137,6 +140,9 @@ public void onLoadingChanged(boolean isLoading) {
@Override
public void onPlayerError(ExoPlaybackException error) {
showRetry();

if (exoPlayerCallBack != null)
exoPlayerCallBack.onError();
}

@Override
Expand Down Expand Up @@ -505,6 +511,10 @@ public void onClick(View v) {
}
}

public void setExoPlayerCallBack(ExoPlayerCallBack exoPlayerCallBack) {
this.exoPlayerCallBack = exoPlayerCallBack;
}

private void enterFullScreen() {
imageViewExitFullScreen.setVisibility(VISIBLE);
imageViewEnterFullScreen.setVisibility(GONE);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.potyvideo.library.globalInterfaces;

public interface ExoPlayerCallBack {

void onError();
}

0 comments on commit bd56a2b

Please sign in to comment.