-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/sdk 3780/exoplayer migration #621
base: develop
Are you sure you want to change the base?
Conversation
- code cleanup and conditions simplified
- removed exoplay and styledplayerview instance in other handle - the handle provides methods which will be extracted in interface
- removed all exoplayer imports - optimised the code to fold methods - removed recundant checks - rect is reused - stop and release methods called appropriately - todo in activity
- fields made final where possible - optimised the context getting and usage, removed cached field
- the class does not contain any player/surface handling code anymore - deletes the code to ExoplayerHandle.kt class where which we use as a holder to migrate to the media3
- force unwrap avoided
- removed static block and made static field inline.
- removes force unwraps so that there are no NPEs
- is video supported is computed statically by checking class.forname - moved method to correct package
- removed forceful unwraps and used null safe operator.
- did not use static filed from activity.
- removed unref method
- fixes val name clashing
- possible to use field in holder.
- adds media handle which uses media3 components instead of exoplayer - adds a different handle class which has similar func to exo handle - runtime can find the correct handle based on user and attach
- allows use of both impls of media3 as well as exoplayer2 - checks need to be added on runtime to chekc available lib and use appropriate handle
- adds method to check media3 exoplayer which is new lib
- changes to kotlin class from java - force unwraps removed - change method signature which is more optimised for kotlin code
- uses media3 if possible - exoplayer is deprecated but we do not force migration
- changes interface signature so corrected the impl
- uses media3 if available - used exoplayer in other cases
- uses media3 if available - used exoplayer in other cases
ctLockManager, | ||
callbackManager, | ||
VideoLibChecker.INSTANCE.haveVideoPlayerSupport | ||
) |
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 not VideoLibChecker.haveVideoPlayerSupport
@Override | ||
public void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
if (VideoLibChecker.INSTANCE.mediaLibType == VideoLibraryIntegrated.MEDIA3) { |
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 not VideoLibChecker.haveVideoPlayerSupport?
public void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
if (VideoLibChecker.INSTANCE.mediaLibType == VideoLibraryIntegrated.MEDIA3) { | ||
handle = new Media3Handle(); |
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 be renamed to videoHandle/ mediaHandle
); | ||
} | ||
|
||
private void streamContainer() { |
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 be renamed to showStreamContainer()?
@@ -74,7 +76,7 @@ private final class NotificationPrepareRunnable implements Runnable { | |||
|
|||
private JSONObject jsonObject; | |||
|
|||
private final boolean videoSupport = Utils.haveVideoPlayerSupport; | |||
private final boolean videoSupport = VideoLibChecker.INSTANCE.haveVideoPlayerSupport; |
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 not VideoLibChecker.haveVideoPlayerSupport instead of VideoLibChecker.INSTANCE.haveVideoPlayerSupport
@@ -126,4 +126,8 @@ public boolean isVideo() { | |||
String contentType = this.getContentType(); | |||
return contentType != null && this.mediaUrl != null && contentType.startsWith("video"); | |||
} | |||
|
|||
public boolean isStreamMedia() { |
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.
Function names can be made same here and for mediaIsStreamable()
media3ExoplayerPresent = true | ||
} catch (t: Throwable) { | ||
Logger.d("Media3 ExoPlayer library files are missing!!!") | ||
Logger.d("Please add ExoPlayer dependencies to render InApp or Inbox messages playing video. For more information checkout CleverTap documentation.") |
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.
Logs could be a little misleading
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.
Left comments @CTLalit
- broken down view method into smaller chunks - makes the fragment readable
- corrects behaviour of add/remove views which are used to steam - optimises add/remove on lifecycle events - optimises view creation for surfaceview and close button - reuses same views in dialog and activity - methods cleanup and renaming
- fixes video view removal/add crash. dialog is reused and video container need not be attached again.
- moves full screen and normal view layout params in handles - sets them correctly as needed
- corrects initialisation after removal
Exoplayer Migration.