Commit 2e302e6e authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

TV: Prevent NPE in video player

parent 53c1c33b
...@@ -972,7 +972,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C ...@@ -972,7 +972,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
} }
public boolean dispatchGenericMotionEvent(MotionEvent event) { public boolean dispatchGenericMotionEvent(MotionEvent event) {
return !mIsLoading && mTouchDelegate.dispatchGenericMotionEvent(event); return !mIsLoading && mTouchDelegate != null && mTouchDelegate.dispatchGenericMotionEvent(event);
} }
@Override @Override
...@@ -1262,7 +1262,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C ...@@ -1262,7 +1262,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
} }
public void showDelayControls(){ public void showDelayControls(){
mTouchDelegate.clearTouchAction(); if (mTouchDelegate != null) mTouchDelegate.clearTouchAction();
if (!mDisplayManager.isPrimary()) showOverlayTimeout(OVERLAY_INFINITE); if (!mDisplayManager.isPrimary()) showOverlayTimeout(OVERLAY_INFINITE);
ViewStubCompat vsc = findViewById(R.id.player_overlay_settings_stub); ViewStubCompat vsc = findViewById(R.id.player_overlay_settings_stub);
if (vsc != null) { if (vsc != null) {
...@@ -1594,7 +1594,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C ...@@ -1594,7 +1594,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
if (event.getBuffering() == 100f) if (event.getBuffering() == 100f)
stopLoading(); stopLoading();
else if (!mHandler.hasMessages(LOADING_ANIMATION) && !mIsLoading else if (!mHandler.hasMessages(LOADING_ANIMATION) && !mIsLoading
&& !mTouchDelegate.isSeeking() && !mDragging) && (mTouchDelegate == null || !mTouchDelegate.isSeeking()) && !mDragging)
mHandler.sendEmptyMessageDelayed(LOADING_ANIMATION, LOADING_ANIMATION_DELAY); mHandler.sendEmptyMessageDelayed(LOADING_ANIMATION, LOADING_ANIMATION_DELAY);
break; break;
} }
...@@ -1968,7 +1968,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C ...@@ -1968,7 +1968,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
@Override @Override
public boolean onTouchEvent(MotionEvent event) { public boolean onTouchEvent(MotionEvent event) {
return mService != null && mTouchDelegate.onTouchEvent(event); return mService != null && mTouchDelegate != null && mTouchDelegate.onTouchEvent(event);
} }
boolean updateViewpoint(float yaw, float pitch, float fov) { boolean updateViewpoint(float yaw, float pitch, float fov) {
...@@ -2563,7 +2563,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C ...@@ -2563,7 +2563,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
mHudBinding.progressOverlay.setLayoutParams(layoutParams); mHudBinding.progressOverlay.setLayoutParams(layoutParams);
mOverlayBackground = findViewById(R.id.player_overlay_background); mOverlayBackground = findViewById(R.id.player_overlay_background);
mNavMenu = findViewById(R.id.player_overlay_navmenu); mNavMenu = findViewById(R.id.player_overlay_navmenu);
if (!AndroidDevices.isChromeBook && AndroidUtil.isJellyBeanMR1OrLater) { if (!AndroidDevices.isChromeBook && AndroidUtil.isJellyBeanMR1OrLater && !VLCApplication.showTvUi()) {
mRendererBtn = findViewById(R.id.video_renderer); mRendererBtn = findViewById(R.id.video_renderer);
RendererDelegate.INSTANCE.getSelectedRenderer().observe(this, new Observer<RendererItem>() { RendererDelegate.INSTANCE.getSelectedRenderer().observe(this, new Observer<RendererItem>() {
@Override @Override
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment