-
Notifications
You must be signed in to change notification settings - Fork 28
Provide both Surface and SurfaceHolder in MediaPlayer #162
Conversation
mediaPlayer.setDisplay(value); | ||
} | ||
}; | ||
surface.apply(setSurface, setDisplay); |
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.
really digging this 👍
@@ -0,0 +1,50 @@ | |||
package com.novoda.noplayer.model; |
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.
Are we exposing this to clients? If not the project is using the convention of an internal
package to describe public classes which do not provide a guaranteed api.
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.
Not directly, but it's used in SurfaceRequester
which is kinda exposed in the public API through PlayerSurfaceHolder
(the clients need to provide an instance of this when they implement a custom implementation of PlayerView
).
@@ -67,7 +68,7 @@ static AndroidMediaPlayerFacade newInstance(Context context, MediaPlayerForwarde | |||
this.mediaPlayerCreator = mediaPlayerCreator; | |||
} | |||
|
|||
void prepareVideo(Uri videoUri, Surface surface) { | |||
public void prepareVideo(Uri videoUri, Either<Surface, SurfaceHolder> surface) { |
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.
Think this public
was done in error, the class is still package.
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.
Just a public method that shouldn't be then LGTM 💯
Problem
While adding a support for
TextureView
I (possibly) changed the behavior ofMediaPlayer
with theSurfaceView
because instead of providingSurfaceHolder
to MediaPlayer I started providingSurface
. I don't know if that changes any behavior, so it's probably for the best to keep the changes to minimum.Solution
Add support to provide both
Surface
andSurfaceHolder
to MediaPlayer by introducing a concept ofEither
. That way, theSurface
is only provided if no-player is used withTextureView
which is completely separate from the previousSurfaceView
behavior that usesSurfaceHolder
.Test(s) added
updated and added where necessary
Screenshots
no UI changes
Paired with
nobody