exoplayer
ExoPlayer and start / pause / seekTo commands
The official example of the PlayerControl in the ExoPlayer source code do exactly what you asked: public class PlayerControl implements MediaPlayerControl { private final ExoPlayer exoPlayer; public PlayerControl(ExoPlayer exoPlayer) { this.exoPlayer = exoPlayer; } @Override public boolean canPause() { return true; } @Override public boolean canSeekBackward() { return true; } @Override public boolean canSeekForward() { … Read more
How can I scale video in ExoPlayer-V2 – Play Video In Full Screen
Following two lines helped me to play video in full-screen mode. Using app:resize_mode in layout file this somehow help but it stretches the video as mentioned in the question picture. <com.google.android.exoplayer2.ui.PlayerView android:layout_width=”match_parent” app:resize_mode=”….” android:layout_height=”match_parent” /> Try changing AspectRatioFrameLayout to FILL,FIT,ZOOM… as per yout requirement, changing below line worked for me. exoVideoPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FILL); Bellow line will ensure … Read more
Detect pause/resume in ExoPlayer
EDIT— Please refer to the Player.isPlaying() method which provides this as an API. “Rather than having to check these properties individually, Player.isPlaying can be called.” https://exoplayer.dev/listening-to-player-events.html#playback-state-changes — EDIT END You need to check playWhenReady with a Player.EventListener. The Playback states of ExoPlayer are independent from the player being paused or not: player.addListener(new Player.DefaultEventListener() { @Override … Read more
How to use android exoplayer
The ExoMedia library wraps exoplayer in simpler api and provides a video view for use in layouts. See usage examples on github: https://github.com/brianwernick/ExoMedia/
How to pause ExoPlayer 2 playback and resume (PlayerControl was removed)
You can use void setPlayWhenReady(boolean playWhenReady). If Exo is ready, passing false will pause the player. Passing true will resume it. You can check the player’s state using getPlaybackState().
Mute audio on ExoPlayer
Exoplayer 2.x.x Get the current volume: int currentvolume = player.getVolume(); Mute: player.setVolume(0f); Unmute: player.setVolume(currentVolume); Exoplayer 1.x.x I found two ways to achieve it by editing DemoPlayer from ExoPlayer. Good one : Basicly, you need to get the audioTrackRenderer which is a ExoPlayerComponent and send message to it. So : Add audioRenderer member and set it … Read more
How to hide control buttons in ExoPlayer2
ExoPlayer-r2.2.0 used videoView.hideController(); videoView.setControllerVisibilityListener(new PlaybackControlView.VisibilityListener() { @Override public void onVisibilityChange(int visibility) { if(visibility == View.VISIBLE) { videoView.hideController(); } } }); or app:use_controller=”false” in Layout <… xmlns:app=”http://schemas.android.com/apk/res-auto” …> <com.google.android.exoplayer2.ui.SimpleExoPlayerView android:layout_width=”match_parent” android:layout_height=”match_parent” app:use_controller=”false”/>
How to play Youtube video in ExoPlayer in Android?
I’ve written a class that retrieves actual YouTube video streaming URL for format like DASH and HLS using http://www.youtube.com/get_video_info?&video_id=[video_id]&el=info&ps=default&eurl=&gl=US&hl=en url with video ID as described by Karim Abdell Salam. I have also tested the URL in an app that uses ExoPlayer and it works: import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import … Read more