-
Notifications
You must be signed in to change notification settings - Fork 28
Conversation
@@ -51,6 +52,8 @@ ExoPlayerTwoImpl create(Context context, DrmSessionCreator drmSessionCreator, bo | |||
|
|||
DefaultTrackSelector trackSelector = new DefaultTrackSelector(); | |||
|
|||
MediaCodecSelector mediaCodecSelector = downgradeSecureDecoder ? SecurityDowngradingCodecSelector.newInstance() : MediaCodecSelector.DEFAULT; |
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.
boolean downgradeSecureDecoder
is transformed into the associated MediaCodecSelector
.
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.
@joetimmins the boolean now lives on PlayerBuilder
-> NoPlayerCreator
and finally here where it gets converted to the codec selector
import com.novoda.noplayer.exoplayer.drm.DrmSessionCreatorFactory; | ||
import com.novoda.noplayer.mediaplayer.NoPlayerMediaPlayerCreator; | ||
|
||
class NoPlayerCreator { |
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.
This is the old PlayerFactory
minus a few wrapper methods, we only expose the one method create and it is used only in the PlayerBuilder
.
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public class PlayerBuilder { |
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.
Builder
party 🎉
return this; | ||
} | ||
|
||
public Player build(Context context) { |
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.
as a user of the library I can still use NoPlayerExoPlayerCreator
directly and create it without the builder.
Is this intentional?
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.
I don't see how to avoid this without flattening all the packages 😢
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.
😢
I have taken a look and I don't see either
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.
Can NoPlayerCreator
be properly used by the client? if it doesn't make sense for the client to do so, we might have to flatten the packages... java, libraries and packages are not friends, it really sucks :S
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.
NoPlayerCreator
is not public, it's the individual player creators which are, like NoPlayerExoPlayerCreator
I don't think it's problem or enough of a reason to flatten the entire library.
There's no issue or side effects of a client creating a single player directly via the public player creators, if anything it's an architectural feature. The PlayerBuilder
is syntactic sugar around selecting a player for given types, which isn't needed if a client decides to manually use a specific creator
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.
It's the NoPlayerMediaPlayerCreator
and NoPlayerExoPlayerCreator
that are exposed. They are the sole entry points into the exo-player
and media-player
packages. Flattening would solve this problem but make maintaining no-player
extremely painful.
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.
Agreed offline, we'll expose these creators as part of the public API
this.internalMediaCodecUtil = internalMediaCodecUtil; | ||
this.downgradeSecureDecoder = downgradeSecureDecoder; | ||
} | ||
|
||
@Override | ||
public MediaCodecInfo getDecoderInfo(String mimeType, boolean contentRequiresSecureDecoder) |
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.
is contentRequiresSecureDecoder
not used anymore? if so... kill it? (if we can, which I don't know)
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.
it's from ExoPlayer MediaCodecSelector
, we can't remove it, unless you mean rename it?
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.
I didn't notice it was from the exoplayer one, ok then 👍
return this; | ||
} | ||
|
||
public PlayerBuilder withDowngradedSecureDecoder() { |
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.
👍
DataPostingModularDrm drmHandler = new DataPostingModularDrm(EXAMPLE_MODULAR_LICENSE_SERVER_PROXY); | ||
|
||
player = playerFactory.create(DrmType.WIDEVINE_MODULAR_STREAM, drmHandler); | ||
player = new PlayerBuilder() |
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.
To be honest I feel the builder is a super cool idea! 💯
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.
you can thank @Mecharyry trolling me and @zegnus 😂
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.
LGTM, I like the builder
I don't like the NoPlayer
creators for media player or exo player being public, but I can't see how to make it better
} | ||
|
||
@Override | ||
public MediaCodecInfo getDecoderInfo(String mimeType, boolean contentRequiresSecureDecoder) | ||
throws MediaCodecUtil.DecoderQueryException { | ||
return internalMediaCodecUtil.getDecoderInfo(mimeType, contentRequiresSecureDecoder && !downgradeSecureDecoder); | ||
return internalMediaCodecUtil.getDecoderInfo(mimeType, false); |
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.
can you extract that boolean? I have no idea what's false there :P
💯 niiice! |
Problem
As per issue #53 and the conversation that took place in https://github.com/novoda/no-player/pull/52/files/4748c1dd02defdb565cd7174a38deb90ee214d9d#diff-d137d202ec4e30de3f26dfb2c0131896 we want to replace the
PlayerFactory
with aPlayerBuilder
as the player has a number of customizations that can be exposed to our clients.Solution
Create a
PlayerBuilder
and aPlayerCreator
. We have exposed awithDowngradedSecureDecoder
to hide theboolean
we had before. Thisboolean
is passed down to theExoPlayer
level at which point it is transformed into the necessaryMediaCodecSelector
. TheMediaCodecSelector
is not directly exposed in theBuilder
because it is only necessary forExoPlayer
.Test(s) added
Updating tests that we broke as a result of these changes.
Screenshots
No UI changes.
Paired with
@ouchadam