Skip to content
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

Chore: Migrate and check changes #611

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion clevertap-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ android {

dependencies {
compileOnly(libs.firebase.messaging)
compileOnly(libs.bundles.exoplayer)
//compileOnly(libs.bundles.exoplayer)

compileOnly("androidx.media3:media3-exoplayer:1.1.1")
compileOnly("androidx.media3:media3-exoplayer-hls:1.1.1")
compileOnly("androidx.media3:media3-ui:1.1.1")
compileOnly(libs.glide)
//for notification
compileOnly(libs.androidx.core.core)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ private static boolean checkForExoPlayer() {
try {
className = Class.forName("com.google.android.exoplayer2.ExoPlayer");
className = Class.forName("com.google.android.exoplayer2.source.hls.HlsMediaSource");
className = Class.forName("com.google.android.exoplayer2.ui.StyledPlayerView");
className = Class.forName("com.google.android.exoplayer2.ui.PlayerView");
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is incorrect code and we will change it.


Logger.d("ExoPlayer is present");
exoPlayerPresent = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,22 @@
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.Scope;
import androidx.core.content.res.ResourcesCompat;
import androidx.media3.common.util.UnstableApi;
import androidx.media3.exoplayer.ExoPlayer;
import androidx.media3.exoplayer.trackselection.AdaptiveTrackSelection;
import androidx.media3.exoplayer.trackselection.DefaultTrackSelector;
import androidx.media3.exoplayer.trackselection.ExoTrackSelection;
import androidx.media3.exoplayer.trackselection.TrackSelector;
import androidx.media3.ui.AspectRatioFrameLayout;
import androidx.media3.ui.PlayerView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.clevertap.android.sdk.R;
import com.clevertap.android.sdk.inbox.CTInboxActivity;
import com.clevertap.android.sdk.inbox.CTInboxBaseMessageViewHolder;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.trackselection.ExoTrackSelection;
import com.google.android.exoplayer2.trackselection.TrackSelector;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import com.google.android.exoplayer2.ui.StyledPlayerView;
import androidx.media3.common.Player;

@RestrictTo(Scope.LIBRARY)
@UnstableApi @RestrictTo(Scope.LIBRARY)
public class MediaPlayerRecyclerView extends RecyclerView {

ExoPlayer player;
Expand All @@ -36,7 +37,7 @@ public class MediaPlayerRecyclerView extends RecyclerView {
private CTInboxBaseMessageViewHolder playingHolder;

//surface view for playing video
private StyledPlayerView videoSurfaceView;
private PlayerView videoSurfaceView;

/**
* {@inheritDoc}
Expand Down Expand Up @@ -172,7 +173,7 @@ private CTInboxBaseMessageViewHolder findBestVisibleMediaHolder() {

private void initialize(Context context) {
appContext = context.getApplicationContext();
videoSurfaceView = new StyledPlayerView(appContext);
videoSurfaceView = new PlayerView(appContext);
videoSurfaceView.setBackgroundColor(Color.TRANSPARENT);
if (CTInboxActivity.orientation == Configuration.ORIENTATION_LANDSCAPE) {
videoSurfaceView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FILL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,31 @@
import androidx.annotation.RequiresApi;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat;
import androidx.media3.common.MediaItem;
import androidx.media3.common.Player;
import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util;
import androidx.media3.datasource.DataSource;
import androidx.media3.datasource.DefaultDataSource;
import androidx.media3.datasource.DefaultHttpDataSource;
import androidx.media3.datasource.TransferListener;
import androidx.media3.exoplayer.ExoPlayer;
import androidx.media3.exoplayer.hls.HlsMediaSource;
import androidx.media3.exoplayer.trackselection.AdaptiveTrackSelection;
import androidx.media3.exoplayer.trackselection.DefaultTrackSelector;
import androidx.media3.exoplayer.trackselection.ExoTrackSelection;
import androidx.media3.exoplayer.trackselection.TrackSelector;
import androidx.media3.exoplayer.upstream.BandwidthMeter;
import androidx.media3.exoplayer.upstream.DefaultBandwidthMeter;
import androidx.media3.ui.PlayerView;

import com.clevertap.android.sdk.R;
import com.clevertap.android.sdk.customviews.CloseImageView;
import com.clevertap.android.sdk.gif.GifImageView;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.source.hls.HlsMediaSource;
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.trackselection.ExoTrackSelection;
import com.google.android.exoplayer2.trackselection.TrackSelector;
import com.google.android.exoplayer2.ui.StyledPlayerView;
import com.google.android.exoplayer2.upstream.BandwidthMeter;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
import com.google.android.exoplayer2.upstream.DefaultDataSource;
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource;
import com.google.android.exoplayer2.upstream.TransferListener;
import com.google.android.exoplayer2.util.Util;

import java.util.ArrayList;

public class CTInAppNativeInterstitialFragment extends CTInAppBaseFullNativeFragment {
@UnstableApi public class CTInAppNativeInterstitialFragment extends CTInAppBaseFullNativeFragment {

private static long mediaPosition = 0;

Expand All @@ -65,7 +68,7 @@ public class CTInAppNativeInterstitialFragment extends CTInAppBaseFullNativeFrag

private ExoPlayer player;

private StyledPlayerView playerView;
private PlayerView playerView;

private RelativeLayout relativeLayout;

Expand Down Expand Up @@ -355,7 +358,7 @@ private void prepareMedia() {
videoFrameLayout = relativeLayout.findViewById(R.id.video_frame);
videoFrameLayout.setVisibility(View.VISIBLE);

playerView = new StyledPlayerView(this.context);
playerView = new PlayerView(this.context);
fullScreenIcon = new ImageView(this.context);
fullScreenIcon.setImageDrawable(
ResourcesCompat.getDrawable(this.context.getResources(), R.drawable.ct_ic_fullscreen_expand, null));
Expand Down Expand Up @@ -406,7 +409,7 @@ private void prepareMedia() {
layoutParams.setMargins(0, iconTop, iconRight, 0);
fullScreenIcon.setLayoutParams(layoutParams);
}
playerView.setShowBuffering(StyledPlayerView.SHOW_BUFFERING_WHEN_PLAYING);
playerView.setShowBuffering(PlayerView.SHOW_BUFFERING_WHEN_PLAYING);
playerView.setUseArtwork(true);
playerView.setControllerAutoShow(false);
videoFrameLayout.addView(playerView);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,23 @@
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.Scope;
import androidx.core.content.res.ResourcesCompat;
import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util;
import androidx.media3.datasource.DataSource;
import androidx.media3.datasource.DefaultDataSource;
import androidx.media3.datasource.DefaultHttpDataSource;
import androidx.media3.exoplayer.ExoPlayer;
import androidx.media3.exoplayer.hls.HlsMediaSource;
import androidx.media3.exoplayer.upstream.DefaultBandwidthMeter;
import androidx.media3.ui.PlayerView;
import androidx.recyclerview.widget.RecyclerView;
import com.clevertap.android.sdk.R;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.source.hls.HlsMediaSource;
import com.google.android.exoplayer2.ui.StyledPlayerView;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
import com.google.android.exoplayer2.upstream.DefaultDataSource;
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource;
import com.google.android.exoplayer2.util.Util;
import androidx.media3.common.MediaItem;
import java.lang.ref.WeakReference;
import java.text.SimpleDateFormat;
import java.util.Date;

@RestrictTo(Scope.LIBRARY)
@UnstableApi @RestrictTo(Scope.LIBRARY)
public class CTInboxBaseMessageViewHolder extends RecyclerView.ViewHolder {

Context context;
Expand Down Expand Up @@ -70,7 +71,7 @@ public class CTInboxBaseMessageViewHolder extends RecyclerView.ViewHolder {
readDot = itemView.findViewById(R.id.read_circle);
}

public boolean addMediaPlayer(StyledPlayerView videoSurfaceView) {
public boolean addMediaPlayer(PlayerView videoSurfaceView) {
if (!requiresMediaPlayer) {
return false;
}
Expand Down Expand Up @@ -154,7 +155,7 @@ public boolean addMediaPlayer(StyledPlayerView videoSurfaceView) {
}

videoSurfaceView.requestFocus();
videoSurfaceView.setShowBuffering(StyledPlayerView.SHOW_BUFFERING_NEVER);
videoSurfaceView.setShowBuffering(PlayerView.SHOW_BUFFERING_NEVER);
DefaultBandwidthMeter defaultBandwidthMeter = new DefaultBandwidthMeter.Builder(context).build();

Context ctx = this.context;
Expand Down
6 changes: 3 additions & 3 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ dependencies {
implementation("com.google.firebase:firebase-messaging:23.0.6") //Needed for FCM
implementation("com.google.android.gms:play-services-ads:20.4.0") //Needed to use Google Ad Ids
//ExoPlayer Libraries for Audio/Video InApp Notifications
implementation("com.google.android.exoplayer:exoplayer:2.19.1")
implementation("com.google.android.exoplayer:exoplayer-hls:2.19.1")
implementation("com.google.android.exoplayer:exoplayer-ui:2.19.1")
implementation("androidx.media3:media3-exoplayer:1.1.1")
implementation("androidx.media3:media3-exoplayer-hls:1.1.1")
implementation("androidx.media3:media3-ui:1.1.1")
implementation("com.github.bumptech.glide:glide:4.12.0")

//Mandatory if you are using Notification Inbox
Expand Down
Loading