-
Notifications
You must be signed in to change notification settings - Fork 28
Conversation
import java.util.Deque; | ||
import java.util.LinkedList; | ||
import java.util.concurrent.TimeUnit; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this class be in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I would consider to remove it @Mecharyry, just to avoid to ship it in what is effectively a non-related change set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor remarks only 💯
|
||
public interface SurfaceRequester { | ||
|
||
void requestSurfaceTexture(Callback callback); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to use texture, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -5,7 +5,7 @@ | |||
android:layout_height="wrap_content"> | |||
|
|||
<SurfaceView | |||
android:id="@+id/surface_view" | |||
android:id="@+id/texture_view" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we keep this as it was?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Override | ||
public void onClick(View v) { | ||
dialogCreator.showAudioSelectionDialog(); | ||
if (player == null || !player.isPlaying() || player.getAudioTracks().size() == 0) { | ||
Toast.makeText(MainActivity.this, "no audio tracks available!", Toast.LENGTH_LONG).show(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The buttons to trigger the dialog are always present, if you tap them before the player is playing then it will throw an IllegalStateException
.
} | ||
}; | ||
|
||
private final View.OnClickListener showSubtitleSelectionDialog = new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
if (player.getSubtitleTracks().isEmpty()) { | ||
if (player == null || !player.isPlaying() || player.getSubtitleTracks().isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here (I know that this is a demo, I am just curious)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above 😄
@@ -51,7 +51,7 @@ public View getContainerView() { | |||
} | |||
|
|||
@Override | |||
public SurfaceHolderRequester getSurfaceHolderRequester() { | |||
public SurfaceRequester getSurfaceTextureRequester() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to leak texture
here? SurfaceRequester should be enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I missed one apparently 🔍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Problem
The current implementation of
NoPlayer
relies upon aSurfaceHolderRequester
to pass aSurfaceHolder
to the underlying player. Clients may want to useSurfaceView
,TextureView
etc and the underlying player,ExoPlayer
specifically only cares about theSurface
.Solution
Switch out the
SurfaceHolderRequester
with aSurfaceRequester
passing aSurface
to the underlying player.Paired with
Nobody.