package m1; import android.app.Activity; import android.content.Context; import android.content.res.AssetFileDescriptor; import android.media.MediaPlayer; import busidol.mobile.tower.MainActivity; import com.google.android.gms.ads.RequestConfiguration; import i1.k; import java.io.IOException; /* loaded from: classes.dex */ public class a { /* renamed from: a, reason: collision with root package name */ public k f11762a; /* renamed from: b, reason: collision with root package name */ public MediaPlayer f11763b; /* renamed from: d, reason: collision with root package name */ public MediaPlayer.OnPreparedListener f11765d; /* renamed from: e, reason: collision with root package name */ public Context f11766e; /* renamed from: f, reason: collision with root package name */ public Activity f11767f; /* renamed from: c, reason: collision with root package name */ AssetFileDescriptor f11764c = null; /* renamed from: g, reason: collision with root package name */ public String f11768g = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED; /* renamed from: m1.a$a, reason: collision with other inner class name */ class C0186a implements MediaPlayer.OnPreparedListener { C0186a() { } @Override // android.media.MediaPlayer.OnPreparedListener public void onPrepared(MediaPlayer mediaPlayer) { a.this.f11763b.start(); } } public a(k kVar) { this.f11762a = kVar; } public void a() { MediaPlayer mediaPlayer = this.f11763b; if (mediaPlayer == null || !mediaPlayer.isPlaying()) { return; } this.f11763b.stop(); this.f11763b.release(); this.f11763b = null; } public void b() { MainActivity mainActivity = this.f11762a.f10741c; this.f11766e = mainActivity; this.f11767f = mainActivity; this.f11763b = new MediaPlayer(); C0186a c0186a = new C0186a(); this.f11765d = c0186a; this.f11763b.setOnPreparedListener(c0186a); this.f11763b.setLooping(true); } public void c() { d(this.f11768g); } public void d(String str) { String str2; if (str == null || str.isEmpty()) { return; } if (this.f11763b.isPlaying() && (str2 = this.f11768g) != null && str2.equals(str)) { return; } try { this.f11764c = this.f11766e.getAssets().openFd(this.f11762a.f10740b.f10662p + str); this.f11763b.reset(); this.f11763b.setDataSource(this.f11764c.getFileDescriptor(), this.f11764c.getStartOffset(), this.f11764c.getLength()); this.f11763b.setLooping(true); this.f11763b.prepare(); this.f11768g = str; } catch (IOException e10) { e10.printStackTrace(); e10.toString(); } } public void e() { MediaPlayer mediaPlayer = this.f11763b; if (mediaPlayer == null || !mediaPlayer.isPlaying()) { return; } this.f11763b.stop(); } }