Skip to content

Commit

Permalink
Hide video player controls by default
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsvanvelzen committed Oct 29, 2024
1 parent e7738c7 commit 1062d7b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ public class CustomPlaybackOverlayFragment extends Fragment implements LiveTvGui
private AudioManager mAudioManager;

private boolean mFadeEnabled = false;
private boolean mIsVisible = true;
private boolean mIsVisible = false;
private boolean mPopupPanelVisible = false;
private boolean navigating = false;

private LeanbackOverlayFragment leanbackOverlayFragment;
protected LeanbackOverlayFragment leanbackOverlayFragment;

private final Lazy<org.jellyfin.sdk.api.client.ApiClient> api = inject(org.jellyfin.sdk.api.client.ApiClient.class);
private final Lazy<MediaManager> mediaManager = inject(MediaManager.class);
Expand Down Expand Up @@ -294,6 +294,9 @@ public void onScrollChanged(ObservableHorizontalScrollView scrollView, int x, in
// start playing
playbackControllerContainer.getValue().getPlaybackController().play(startPos);
leanbackOverlayFragment.updatePlayState();

// Set initial skip overlay state
binding.skipOverlay.setSkipUiEnabled(!mIsVisible && !mGuideVisible && !mPopupPanelVisible);
}

@Override
Expand Down Expand Up @@ -1209,7 +1212,6 @@ public void setSecondaryTime(long time) {

public void setFadingEnabled(boolean value) {
mFadeEnabled = value;
// if (!mIsVisible) requireActivity().runOnUiThread(this::show);
if (mFadeEnabled) {
startFadeTimer();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ public void onPlaybackSpeedChange(float newSpeed) {
@Override
public void onPrepared() {
if (mPlaybackState == PlaybackState.BUFFERING) {
if (mFragment != null) mFragment.setFadingEnabled(true);
if (mFragment != null) mFragment.leanbackOverlayFragment.setShouldShowOverlay(false);

mPlaybackState = PlaybackState.PLAYING;
mCurrentTranscodeStartTime = mCurrentStreamInfo.getPlayMethod() == PlayMethod.Transcode ? Instant.now().toEpochMilli() : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import static org.koin.java.KoinJavaComponent.inject;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.leanback.app.PlaybackSupportFragment;

import org.jellyfin.androidtv.ui.playback.CustomPlaybackOverlayFragment;
Expand Down Expand Up @@ -36,6 +39,13 @@ public void onCreate(Bundle savedInstanceState) {
playerGlue.setHost(new CustomPlaybackFragmentGlueHost(this));
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);

super.hideControlsOverlay(false);
}

public void initFromView(CustomPlaybackOverlayFragment customPlaybackOverlayFragment) {
playerGlue.setInitialPlaybackDrawable();
playerAdapter.setMasterOverlayFragment(customPlaybackOverlayFragment);
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/vlc_player_interface.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
android:layout_gravity="center_horizontal|top"
android:layout_marginHorizontal="40dp"
android:layout_marginTop="20dp"
android:clickable="false">
android:clickable="false"
android:visibility="gone">

<org.jellyfin.androidtv.ui.AsyncImageView
android:id="@+id/item_logo"
Expand Down

0 comments on commit 1062d7b

Please sign in to comment.