mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-30 03:24:44 +01:00
Fix muting audio after video play ends.
This commit is contained in:
parent
25328e5d18
commit
a88f43ff38
@ -1867,6 +1867,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
@Nullable
|
@Nullable
|
||||||
ExoPlayerViewHelper helper;
|
ExoPlayerViewHelper helper;
|
||||||
private Uri mediaUri;
|
private Uri mediaUri;
|
||||||
|
private float volume = 0f;
|
||||||
|
|
||||||
PostVideoAutoplayViewHolder(View itemView) {
|
PostVideoAutoplayViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
@ -1901,9 +1902,11 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
if (helper.getVolume() != 0) {
|
if (helper.getVolume() != 0) {
|
||||||
muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_mute_24dp));
|
muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_mute_24dp));
|
||||||
helper.setVolume(0f);
|
helper.setVolume(0f);
|
||||||
|
volume = 0f;
|
||||||
} else {
|
} else {
|
||||||
muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_unmute_24dp));
|
muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_unmute_24dp));
|
||||||
helper.setVolume(1f);
|
helper.setVolume(1f);
|
||||||
|
volume = 1f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1936,8 +1939,13 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
|
|||||||
for (int i = 0; i < trackGroups.length; i++) {
|
for (int i = 0; i < trackGroups.length; i++) {
|
||||||
String mimeType = trackGroups.get(i).getFormat(0).sampleMimeType;
|
String mimeType = trackGroups.get(i).getFormat(0).sampleMimeType;
|
||||||
if (mimeType != null && mimeType.contains("audio")) {
|
if (mimeType != null && mimeType.contains("audio")) {
|
||||||
helper.setVolume(0f);
|
helper.setVolume(volume);
|
||||||
muteButton.setVisibility(View.VISIBLE);
|
muteButton.setVisibility(View.VISIBLE);
|
||||||
|
if (volume != 0f) {
|
||||||
|
muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_unmute_24dp));
|
||||||
|
} else {
|
||||||
|
muteButton.setImageDrawable(mActivity.getDrawable(R.drawable.ic_mute_24dp));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user