Skip to content

Commit

Permalink
chore: update SDK to 2.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
MortezaNedaei committed Jan 7, 2024
1 parent a9f2ef2 commit 7f6d56f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 22 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ dependencies {
implementation "com.mbridge.msdk.oversea:interstitialvideo:16.3.91"

// for Vast (PreRoll)
implementation("com.google.ads.interactivemedia.v3:interactivemedia:3.30.1")
implementation 'com.google.android.exoplayer:exoplayer-core:2.18.7'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.18.7'
implementation("androidx.media3:media3-ui:1.1.1")
implementation("androidx.media3:media3-exoplayer:1.1.1")
implementation("com.google.ads.interactivemedia.v3:interactivemedia:3.31.0")

testImplementation 'junit:junit:4.13.2'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,13 @@
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.media3.common.MediaItem;
import androidx.media3.exoplayer.ExoPlayer;
import androidx.media3.exoplayer.source.DefaultMediaSourceFactory;
import androidx.media3.ui.PlayerView;

import com.google.ads.interactivemedia.v3.api.AdErrorEvent;
import com.google.ads.interactivemedia.v3.api.AdEvent;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.source.DefaultMediaSourceFactory;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.ui.StyledPlayerView;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultDataSource;
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource;
import com.google.android.exoplayer2.util.Util;

import ir.tapsell.plus.TapsellPlus;
import ir.tapsell.plus.VastRequestListener;
Expand All @@ -33,7 +28,7 @@ public class ExoPlayerVastActivity extends AppCompatActivity {
private static final String SAMPLE_VIDEO_URL = "https://storage.backtory.com/tapsell-server/sdk/VASTContentVideo.mp4";

private TextView tvLog;
private StyledPlayerView playerView;
private PlayerView playerView;
private ExoPlayer player;
private ViewGroup adUiContainer;
private ViewGroup companionContainer;
Expand Down Expand Up @@ -65,13 +60,8 @@ private void initializePlayer() {
return;
}
// Set up the factory for media sources, passing the ads loader and ad view providers.
DataSource.Factory dataSourceFactory =
new DefaultDataSource.Factory(this,
new DefaultHttpDataSource.Factory()
.setUserAgent(Util.getUserAgent(this, getString(R.string.app_name))));

MediaSource.Factory mediaSourceFactory =
new DefaultMediaSourceFactory(dataSourceFactory)
DefaultMediaSourceFactory mediaSourceFactory =
new DefaultMediaSourceFactory(this)
.setLocalAdInsertionComponents(unusedAdTagUri -> adsLoader, playerView);

// Create an ExoPlayer and set it as the player for content and ads.
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/layout/activity_vast_exo_player.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
android:layout_height="200dp">


<com.google.android.exoplayer2.ui.StyledPlayerView

<androidx.media3.ui.PlayerView
android:id="@+id/exo_player"
android:layout_width="match_parent"
android:layout_height="200dp"
Expand Down

0 comments on commit 7f6d56f

Please sign in to comment.