Guys, I added the unity ads code in my exoplayer player file and the ad runs well, the problem is that after closing the ad, the movie does not play. If I remove the unity ads ad code, the movie plays normally. Could someone help me to run the normal movie after closing the ad?
Follow the video showing.
Thank you all.
https://drive.google.com/file/d/1KSuq5rACBxlCRnRp9ca_XVTd45h9V7KD/view?usp=share_link
This is the code for PlayerActivity.java
package com.cineday.box.view;
import static android.view.View.VISIBLE;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.media.session.MediaSession;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.PowerManager;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.cineday.box.AppConfig;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.ext.rtmp.RtmpDataSourceFactory;
import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory;
import com.google.android.exoplayer2.extractor.ExtractorsFactory;
import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.MergingMediaSource;
import com.google.android.exoplayer2.source.SingleSampleMediaSource;
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.TrackSelection;
import com.google.android.exoplayer2.trackselection.TrackSelector;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import com.google.android.exoplayer2.ui.PlayerControlView;
import com.google.android.exoplayer2.ui.PlayerView;
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.DefaultDataSourceFactory;
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory;
import com.google.android.exoplayer2.util.MimeTypes;
import com.google.android.exoplayer2.util.Util;
import com.cineday.box.R;
import com.cineday.box.database.DatabaseHelper;
import com.cineday.box.model.PlaybackModel;
import com.cineday.box.model.Video;
import com.cineday.box.model.movieDetails.Subtitle;
import com.cineday.box.utils.ToastMsg;
import com.cineday.box.view.adapter.ServerAdapter;
import com.cineday.box.view.adapter.SubtitleListAdapter;
import com.squareup.picasso.Picasso;
import com.unity3d.ads.IUnityAdsInitializationListener;
import com.unity3d.ads.IUnityAdsLoadListener;
import com.unity3d.ads.IUnityAdsShowListener;
import com.unity3d.ads.UnityAds;
import com.unity3d.ads.UnityAdsShowOptions;
import android.app.Activity;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;
public class PlayerActivity extends Activity implements IUnityAdsInitializationListener {
Context context = this;
private static final String TAG = "PlayerActivity";
private static final String CLASS_NAME = "com.cineday.box.ui.activity.PlayerActivity";
private PlayerView exoPlayerView;
private SimpleExoPlayer player;
private RelativeLayout rootLayout;
private MediaSource mediaSource;
private boolean isPlaying;
private List<Video> videos = new ArrayList<>();
private Video video = null;
private String url = "";
private String videoType = "";
private String category = "";
private int visible;
private ImageButton serverButton, fastForwardButton, subtitleButton;
private TextView movieTitleTV, movieDescriptionTV;
private ImageView posterImageView, posterImageViewForTV;
private RelativeLayout seekBarLayout;
private TextView liveTvTextInController;
private ProgressBar progressBar;
private PowerManager.WakeLock wakeLock;
private MediaSession session;
private long mChannelId;
private long mStartingPosition;
private PlaybackModel model;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_player);
{ //unityads
IUnityAdsLoadListener loadListener = new IUnityAdsLoadListener() {
@Override
public void onUnityAdsAdLoaded(String placementId) {
UnityAds.show(PlayerActivity.this, AppConfig.Unity_rewardedVideo_ID, new UnityAdsShowOptions(), new IUnityAdsShowListener() {
@Override
public void onUnityAdsShowFailure(String placementId, UnityAds.UnityAdsShowError error, String message) {
Log.e("UnityAdsExample", "Unity Ads failed to load ad for " + placementId + " with error: [" + error + "] " + message);
}
@Override
public void onUnityAdsShowStart(String placementId) {
Log.v("UnityAdsExample", "onUnityAdsShowStart: " + placementId);
}
@Override
public void onUnityAdsShowClick(String placementId) {
Log.v("UnityAdsExample", "onUnityAdsShowClick: " + placementId);
}
@Override
public void onUnityAdsShowComplete(String placementId, UnityAds.UnityAdsShowCompletionState state) {
Log.v("UnityAdsExample", "onUnityAdsShowComplete: " + placementId);
if (state.equals(UnityAds.UnityAdsShowCompletionState.COMPLETED)) {
// Reward the user for watching the ad to completion
} else {
// Do not reward the user for skipping the ad
}
}
});
}
@Override
public void onUnityAdsFailedToLoad(String placementId, UnityAds.UnityAdsLoadError error, String message) {
}
};
UnityAds.initialize (this, AppConfig.Unity_Game_ID, AppConfig.unity_ad_testMode);
UnityAds.load(AppConfig.Unity_rewardedVideo_ID, loadListener);
}
mChannelId = getIntent().getLongExtra(VideoPlaybackActivity.EXTRA_CHANNEL_ID, -1L);
mStartingPosition = getIntent().getLongExtra(VideoPlaybackActivity.EXTRA_POSITION, -1L);
model = (PlaybackModel) getIntent().getSerializableExtra(VideoPlaybackActivity.EXTRA_VIDEO);
assert model != null;
url = model.getVideoUrl();
videoType = model.getVideoType();
category = model.getCategory();
if (model.getVideo() != null)
video = model.getVideo();
if (model.getCategory().equals("movie") && mChannelId > -1L && model.getIsPaid().equals("1")) {
//Paid Content from Channel
//check user has subscription or not
//if not, send user to VideoDetailsActivity
DatabaseHelper db = new DatabaseHelper(PlayerActivity.this);
final String status = db.getActiveStatusData() != null ? db.getActiveStatusData().getStatus() : "inactive";
if (!status.equals("active")) {
Intent intent = new Intent(PlayerActivity.this, VideoDetailsActivity.class);
intent.putExtra("type", model.getCategory());
intent.putExtra("id", model.getMovieId());
intent.putExtra("thumbImage", model.getCardImageUrl());
startActivity(intent, null);
finish();
}
}
intiViews();
initVideoPlayer(url, videoType);
}
private void intiViews() {
progressBar = findViewById(R.id.progress_bar);
exoPlayerView = findViewById(R.id.player_view);
rootLayout = findViewById(R.id.root_layout);
movieTitleTV = findViewById(R.id.movie_title);
movieDescriptionTV = findViewById(R.id.movie_description);
posterImageView = findViewById(R.id.poster_image_view);
posterImageViewForTV = findViewById(R.id.poster_image_view_for_tv);
serverButton = findViewById(R.id.img_server);
subtitleButton = findViewById(R.id.img_subtitle);
fastForwardButton = findViewById(R.id.exo_ffwd);
liveTvTextInController = findViewById(R.id.live_tv);
seekBarLayout = findViewById(R.id.seekbar_layout);
if (category.equalsIgnoreCase("tv")) {
serverButton.setVisibility(View.GONE);
subtitleButton.setVisibility(View.GONE);
//seekBarLayout.setVisibility(View.GONE);
fastForwardButton.setVisibility(View.GONE);
liveTvTextInController.setVisibility(View.VISIBLE);
posterImageView.setVisibility(View.GONE);
posterImageViewForTV.setVisibility(VISIBLE);
seekBarLayout.setVisibility(View.GONE);
}
if (category.equalsIgnoreCase("tvseries")) {
serverButton.setVisibility(View.GONE);
//hide subtitle button if there is no subtitle
if (video != null) {
if (video.getSubtitle().isEmpty()) {
subtitleButton.setVisibility(View.GONE);
}
} else {
subtitleButton.setVisibility(View.GONE);
}
}
if (category.equalsIgnoreCase("movie")) {
if (model.getVideoList() != null)
videos.clear();
videos = model.getVideoList();
//hide subtitle button if there is no subtitle
if (video != null) {
if (video.getSubtitle().isEmpty()) {
subtitleButton.setVisibility(View.GONE);
}
} else {
subtitleButton.setVisibility(View.GONE);
}
if (videos != null) {
if (videos.size() < 1)
serverButton.setVisibility(View.GONE);
}
}
}
@Override
protected void onStart() {
super.onStart();
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, "My Tag:");
subtitleButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//open subtitle dialog
openSubtitleDialog();
}
});
serverButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//open server dialog
openServerDialog(videos);
}
});
//set title, description and poster in controller layout
movieTitleTV.setText(model.getTitle());
movieDescriptionTV.setText(model.getDescription());
if (category.equalsIgnoreCase("tv")) {
Picasso.get()
.load(model.getCardImageUrl())
.placeholder(R.drawable.poster_placeholder)
.centerCrop()
.resize(200, 120)
.error(R.drawable.poster_placeholder)
.into(posterImageViewForTV);
}else {
Picasso.get()
.load(model.getCardImageUrl())
.placeholder(R.drawable.poster_placeholder)
.centerCrop()
.resize(120, 200)
.error(R.drawable.poster_placeholder)
.into(posterImageView);
}
}
@Override
protected void onUserLeaveHint() {
Log.e("RemoteKey", "DPAD_HOME");
/** Use pressed home button **/
//time to set media session active
super.onUserLeaveHint();
}
boolean doubleBackToExitPressedOnce = false;
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_MOVE_HOME:
break;
case KeyEvent.KEYCODE_DPAD_UP:
if (!exoPlayerView.isControllerVisible()) {
exoPlayerView.showController();
}
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
Log.e("RemoteKey", "DPAD_DOWN");
if (!exoPlayerView.isControllerVisible()) {
exoPlayerView.showController();
}
break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
Log.e("RemoteKey", "DPAD_RIGHT");
if (!exoPlayerView.isControllerVisible()) {
exoPlayerView.showController();
}
break;
case KeyEvent.KEYCODE_DPAD_LEFT:
Log.e("RemoteKey", "DPAD_LEFT");
if (!exoPlayerView.isControllerVisible()) {
exoPlayerView.showController();
}
break;
case KeyEvent.KEYCODE_DPAD_CENTER:
Log.e("RemoteKey", "DPAD_CENTER");
if (!exoPlayerView.isControllerVisible()) {
exoPlayerView.showController();
}
break;
case KeyEvent.KEYCODE_BACK:
Log.e("RemoteKey", "DPAD_BACK");
if (exoPlayerView.isControllerVisible()) {
exoPlayerView.hideController();
finish();
}else{
exoPlayerView.showController();
}
// else {
// if (doubleBackToExitPressedOnce) {
// releasePlayer();
// //mediaSessionHelper.stopMediaSession();
// finish();
// } else {
// handleBackPress();
// }
// }
break;
case KeyEvent.KEYCODE_ESCAPE:
Log.e("RemoteKey", "DPAD_ESCAPE");
/* if (!exoPlayerView.isControllerVisible()){
exoPlayerView.showController();
}else {
releasePlayer();
finish();
}*/
break;
}
return false;
}
private void handleBackPress() {
this.doubleBackToExitPressedOnce = true;
//Toast.makeText(this, "Please click BACK again to exit.", Toast.LENGTH_SHORT).show();
new ToastMsg(PlayerActivity.this).toastIconSuccess("Clique em VOLTAR novamente para sair.");
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
doubleBackToExitPressedOnce = false;
}
}, 2000);
}
private void openServerDialog(List<Video> videos) {
if (videos != null) {
List<Video> videoList = new ArrayList<>();
videoList.clear();
for (Video video : videos) {
if (!video.getFileType().equalsIgnoreCase("embed")) {
videoList.add(video);
}
}
AlertDialog.Builder builder = new AlertDialog.Builder(PlayerActivity.this);
View view = LayoutInflater.from(PlayerActivity.this).inflate(R.layout.layout_server_tv, null);
RecyclerView serverRv = view.findViewById(R.id.serverRv);
ServerAdapter serverAdapter = new ServerAdapter(PlayerActivity.this, videoList, "movie");
serverRv.setLayoutManager(new LinearLayoutManager(PlayerActivity.this));
serverRv.setHasFixedSize(true);
serverRv.setAdapter(serverAdapter);
Button closeBt = view.findViewById(R.id.close_bt);
builder.setView(view);
final AlertDialog dialog = builder.create();
dialog.show();
closeBt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
final ServerAdapter.OriginalViewHolder[] viewHolder = {null};
serverAdapter.setOnItemClickListener(new ServerAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, Video obj, int position, ServerAdapter.OriginalViewHolder holder) {
Intent playerIntent = new Intent(PlayerActivity.this, PlayerActivity.class);
PlaybackModel video = new PlaybackModel();
video.setId(model.getId());
video.setTitle(model.getTitle());
video.setDescription(model.getDescription());
video.setCategory("movie");
video.setVideo(obj);
video.setVideoList(model.getVideoList());
video.setVideoUrl(obj.getFileUrl());
video.setVideoType(obj.getFileType());
video.setBgImageUrl(model.getBgImageUrl());
video.setCardImageUrl(model.getCardImageUrl());
video.setIsPaid(model.getIsPaid());
playerIntent.putExtra(VideoPlaybackActivity.EXTRA_VIDEO, video);
startActivity(playerIntent);
dialog.dismiss();
finish();
}
});
} else {
new ToastMsg(this).toastIconError(getString(R.string.no_other_server_found));
}
}
private void openSubtitleDialog() {
if (video != null) {
if (!video.getSubtitle().isEmpty()) {
AlertDialog.Builder builder = new AlertDialog.Builder(PlayerActivity.this);
View view = LayoutInflater.from(PlayerActivity.this).inflate(R.layout.layout_subtitle_dialog, null);
RecyclerView serverRv = view.findViewById(R.id.serverRv);
SubtitleListAdapter adapter = new SubtitleListAdapter(PlayerActivity.this, video.getSubtitle());
serverRv.setLayoutManager(new LinearLayoutManager(PlayerActivity.this));
serverRv.setHasFixedSize(true);
serverRv.setAdapter(adapter);
Button closeBt = view.findViewById(R.id.close_bt);
builder.setView(view);
final AlertDialog dialog = builder.create();
dialog.show();
closeBt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
//click event
adapter.setListener(new SubtitleListAdapter.OnSubtitleItemClickListener() {
@Override
public void onSubtitleItemClick(View view, Subtitle subtitle, int position, SubtitleListAdapter.SubtitleViewHolder holder) {
setSelectedSubtitle(mediaSource, subtitle.getUrl());
dialog.dismiss();
}
});
} else {
new ToastMsg(this).toastIconError(getResources().getString(R.string.no_subtitle_found));
}
} else {
new ToastMsg(this).toastIconError(getResources().getString(R.string.no_subtitle_found));
}
}
private void setSelectedSubtitle(com.google.android.exoplayer2.source.MediaSource mediaSource, String url) {
MergingMediaSource mergedSource;
if (url != null) {
Uri subtitleUri = Uri.parse(url);
Format subtitleFormat = Format.createTextSampleFormat(
null, // An identifier for the track. May be null.
MimeTypes.TEXT_VTT, // The mime type. Must be set correctly.
Format.NO_VALUE, // Selection flags for the track.
"en"); // The subtitle language. May be null.
DefaultDataSourceFactory dataSourceFactory = new DefaultDataSourceFactory(PlayerActivity.this,
Util.getUserAgent(PlayerActivity.this, CLASS_NAME), new DefaultBandwidthMeter());
com.google.android.exoplayer2.source.MediaSource subtitleSource = new SingleSampleMediaSource
.Factory(dataSourceFactory)
.createMediaSource(subtitleUri, subtitleFormat, C.TIME_UNSET);
mergedSource = new MergingMediaSource(mediaSource, subtitleSource);
player.prepare(mergedSource, false, false);
player.setPlayWhenReady(true);
//resumePlayer();
} else {
Toast.makeText(PlayerActivity.this, "não há legenda", Toast.LENGTH_SHORT).show();
}
}
public void initVideoPlayer(String url, String type) {
if (player != null) {
player.release();
}
progressBar.setVisibility(VISIBLE);
BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
TrackSelection.Factory videoTrackSelectionFactory = new
AdaptiveTrackSelection.Factory(bandwidthMeter);
TrackSelector trackSelector = new
DefaultTrackSelector(videoTrackSelectionFactory);
player = ExoPlayerFactory.newSimpleInstance((Context) PlayerActivity.this, trackSelector);
exoPlayerView.setPlayer(player);
// below 2 lines will make screen size to fit
exoPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FILL);
player.setVideoScalingMode(C.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING);
exoPlayerView.setControllerShowTimeoutMs(5000);
player.setPlayWhenReady(true);
Uri uri = Uri.parse(url);
switch (type) {
case "hls":
mediaSource = hlsMediaSource(uri, PlayerActivity.this);
break;
/* case "youtube":
extractYoutubeUrl(url, PlayerActivity.this, 18);
break;
case "youtube-live":
extractYoutubeUrl(url, PlayerActivity.this, 133);
break;*/
case "rtmp":
mediaSource = rtmpMediaSource(uri);
break;
default:
mediaSource = mediaSource(uri, PlayerActivity.this);
break;
}
if (!type.contains("youtube")) {
player.prepare(mediaSource, true, false);
exoPlayerView.setPlayer(player);
player.setPlayWhenReady(true);
}
seekToStartPosition();
player.addListener(new Player.DefaultEventListener() {
@Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
if (playWhenReady && playbackState == Player.STATE_READY) {
isPlaying = true;
progressBar.setVisibility(View.GONE);
//create media session
// mediaSessionHelper = new MediaSessionHelper(player, PlayerActivity.this, model, isPlaying);
// mediaSessionHelper.updateMetadata();
//mediaSessionHelper.updatePlaybackState();
} else if (playbackState == Player.STATE_READY) {
isPlaying = false;
progressBar.setVisibility(View.GONE);
//add watch next card
long position = player.getCurrentPosition();
long duration = player.getDuration();
/*mediaSessionHelper.updateMetadata();
mediaSessionHelper.updatePlaybackState();*/
} else if (playbackState == Player.STATE_BUFFERING) {
isPlaying = false;
progressBar.setVisibility(VISIBLE);
player.setPlayWhenReady(true);
} else if (playbackState == Player.STATE_ENDED) {
//remove now playing card
//mediaSessionHelper.stopMediaSession();
} else {
// player paused in any state
isPlaying = false;
progressBar.setVisibility(View.GONE);
}
}
});
exoPlayerView.setControllerVisibilityListener(new PlayerControlView.VisibilityListener() {
@Override
public void onVisibilityChange(int visibility) {
visible = visibility;
}
});
}
private void seekToStartPosition() {
// Skip ahead if given a starting position.
if (mStartingPosition > -1L) {
if (player.getPlayWhenReady()) {
Log.d("VideoFragment", "Is prepped, seeking to " + mStartingPosition);
player.seekTo(mStartingPosition);
}
}
}
private com.google.android.exoplayer2.source.MediaSource mp3MediaSource(Uri uri) {
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(getApplicationContext(), "Dalvik/2.1.0 (Linux; U; Android 7.1.2; ASUS_Z01QD Build/N2G48H)");
ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
Handler mainHandler = new Handler();
return new ExtractorMediaSource(uri, dataSourceFactory, extractorsFactory, mainHandler, null);
}
private com.google.android.exoplayer2.source.MediaSource mediaSource(Uri uri, Context context) {
return new ExtractorMediaSource.Factory(
new DefaultHttpDataSourceFactory("Dalvik/2.1.0 (Linux; U; Android 7.1.2; ASUS_Z01QD Build/N2G48H)")).
createMediaSource(uri);
}
private com.google.android.exoplayer2.source.MediaSource rtmpMediaSource(Uri uri) {
com.google.android.exoplayer2.source.MediaSource videoSource = null;
RtmpDataSourceFactory dataSourceFactory = new RtmpDataSourceFactory();
videoSource = new ExtractorMediaSource.Factory(dataSourceFactory)
.createMediaSource(uri);
return videoSource;
}
/* @SuppressLint("StaticFieldLeak")
private void extractYoutubeUrl(String url, final Context context, final int tag) {
new YouTubeExtractor(context) {
@Override
public void onExtractionComplete(SparseArray<YtFile> ytFiles, VideoMeta vMeta) {
if (ytFiles != null) {
int itag = tag;
String dashUrl = ytFiles.get(itag).getUrl();
try {
com.google.android.exoplayer2.source.MediaSource source = mediaSource(Uri.parse(dashUrl), context);
player.prepare(source, true, false);
//player.setPlayWhenReady(false);
exoPlayerView.setPlayer(player);
player.setPlayWhenReady(true);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}.extract(url, true, true);
}*/
private com.google.android.exoplayer2.source.MediaSource hlsMediaSource(Uri uri, Context context) {
DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context,
Util.getUserAgent(context, "Dalvik/2.1.0 (Linux; U; Android 7.1.2; ASUS_Z01QD Build/N2G48H)"), bandwidthMeter);
com.google.android.exoplayer2.source.MediaSource videoSource = new HlsMediaSource.Factory(dataSourceFactory)
.createMediaSource(uri);
return videoSource;
}
@Override
public void onBackPressed() {
if (visible == View.GONE) {
exoPlayerView.showController();
} else {
releasePlayer();
super.onBackPressed();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
releasePlayer();
if (wakeLock != null)
wakeLock.release();
}
@Override
protected void onPause() {
super.onPause();
releasePlayer();
}
@Override
protected void onResume() {
super.onResume();
setVolumeControlStream(AudioManager.STREAM_MUSIC);
wakeLock.acquire(10 * 60 * 1000L /*10 minutes*/);
}
private void releasePlayer() {
if (player != null) {
player.setPlayWhenReady(false);
player.stop();
player.release();
player = null;
exoPlayerView.setPlayer(null);
}
}
@Override
public void onInitializationComplete() {
}
@Override
public void onInitializationFailed(UnityAds.UnityAdsInitializationError unityAdsInitializationError, String s) {
}
}