com.google.android.exoplayer2.ui.PlayerControlView Java Examples

The following examples show how to use com.google.android.exoplayer2.ui.PlayerControlView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VideoPlayer.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
public VideoPlayer(Context context, AttributeSet attrs, int defStyleAttr) {
  super(context, attrs, defStyleAttr);

  inflate(context, R.layout.video_player, this);

  this.exoView     = ViewUtil.findById(this, R.id.video_view);
  this.exoControls = new PlayerControlView(getContext());
  this.exoControls.setShowTimeoutMs(-1);
}
 
Example #2
Source File: SwipeablePlayerView.java    From zapp with MIT License 5 votes vote down vote up
private void init(Context context) {
	controlView = (PlayerControlView) getChildAt(2);
	window = ((Activity) context).getWindow();
	audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);

	volumeIndicator = new SwipeIndicatorView(context);
	volumeIndicator.setIconResId(R.drawable.ic_volume_up_white_24dp);
	addView(volumeIndicator, new LayoutParams(INDICATOR_WIDTH, ViewGroup.LayoutParams.MATCH_PARENT, Gravity.END));

	brightnessIndicator = new SwipeIndicatorView(context);
	brightnessIndicator.setIconResId(R.drawable.ic_brightness_6_white_24dp);
	addView(brightnessIndicator, new LayoutParams(INDICATOR_WIDTH, ViewGroup.LayoutParams.MATCH_PARENT, Gravity.START));

	gestureDetector = new GestureDetector(context.getApplicationContext(), new WipingControlGestureListener());
	gestureDetector.setIsLongpressEnabled(false);

	scaleGestureDetector = new ScaleGestureDetector(context.getApplicationContext(), new ScaleGestureListener());

	setOnTouchListener(this);
	setAspectRatioListener(this);

	setLayoutTransition(new LayoutTransition());

	settingsRepository = new SettingsRepository(getContext());
	if (settingsRepository.getIsPlayerZoomed()) {
		setZoomStateCropped();
	} else {
		setZoomStateBoxed();
	}
}
 
Example #3
Source File: Player.java    From zapp with MIT License 4 votes vote down vote up
public void rewind() {
	player.seekTo(
		Math.max(player.getCurrentPosition() - PlayerControlView.DEFAULT_REWIND_MS, 0)
	);
}
 
Example #4
Source File: Player.java    From zapp with MIT License 4 votes vote down vote up
public void fastForward() {
	player.seekTo(
		Math.min(player.getCurrentPosition() + PlayerControlView.DEFAULT_FAST_FORWARD_MS, player.getDuration())
	);
}