Skip to content

Commit

Permalink
Added Stop/Pause functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Reza Amuzadeh committed Aug 18, 2019
1 parent f707f45 commit 94c8349
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public void onClick(View v) {
loadMp3();
}
});

}

private void loadMp3() {
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@
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 11
versionName "1.0.11"
versionCode 12
versionName "1.0.12"
vectorDrawables.useSupportLibrary = true

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,11 @@ public void stopPlayer() {
simpleExoPlayer.stop();
}

public void pausePlayer() {
if (simpleExoPlayer != null)
simpleExoPlayer.setPlayWhenReady(!simpleExoPlayer.getPlayWhenReady());
}

public void setShowController(boolean showController) {
if (playerView == null)
return;
Expand Down

0 comments on commit 94c8349

Please sign in to comment.