CAG v5.7.4版本的 MD5 值为:bc57ead76a7a30559f0708e9d60d749f
以下内容为反编译后的 WebViewYouTubePlayer.java 源代码,内容仅作参考
package com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.util.AttributeSet;
import android.webkit.WebView;
import com.google.android.gms.common.internal.ServiceSpecificExtraArgs;
import i.p.a.a.a.b;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import kotlin.Metadata;
import n.i.a.l;
import n.i.b.h;
import org.apache.lucene.analysis.wikipedia.WikipediaTokenizer;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000h\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0007\n\u0002\b\u0006\n\u0002\u0010\b\n\u0002\b\u0007\n\u0002\u0010\u001e\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\n\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\b\u0000\u0018\u00002\u00020\u00012\u00020\u00022\u00020\u0003B%\u0012\u0006\u00109\u001a\u000208\u0012\n\b\u0002\u0010;\u001a\u0004\u0018\u00010:\u0012\b\b\u0002\u0010<\u001a\u00020\u0012¢\u0006\u0004\b=\u0010>J\u000f\u0010\u0005\u001a\u00020\u0004H\u0016¢\u0006\u0004\b\u0005\u0010\u0006J\u000f\u0010\u0007\u001a\u00020\u0002H\u0016¢\u0006\u0004\b\u0007\u0010\bJ\u001f\u0010\r\u001a\u00020\u00042\u0006\u0010\n\u001a\u00020\t2\u0006\u0010\f\u001a\u00020\u000bH\u0016¢\u0006\u0004\b\r\u0010\u000eJ\u001f\u0010\u000f\u001a\u00020\u00042\u0006\u0010\n\u001a\u00020\t2\u0006\u0010\f\u001a\u00020\u000bH\u0016¢\u0006\u0004\b\u000f\u0010\u000eJ\u000f\u0010\u0010\u001a\u00020\u0004H\u0016¢\u0006\u0004\b\u0010\u0010\u0006J\u000f\u0010\u0011\u001a\u00020\u0004H\u0016¢\u0006\u0004\b\u0011\u0010\u0006J\u0017\u0010\u0014\u001a\u00020\u00042\u0006\u0010\u0013\u001a\u00020\u0012H\u0016¢\u0006\u0004\b\u0014\u0010\u0015J\u0017\u0010\u0017\u001a\u00020\u00042\u0006\u0010\u0016\u001a\u00020\u000bH\u0016¢\u0006\u0004\b\u0017\u0010\u0018J\u000f\u0010\u0019\u001a\u00020\u0004H\u0016¢\u0006\u0004\b\u0019\u0010\u0006J\u0015\u0010\u001c\u001a\b\u0012\u0004\u0012\u00020\u001b0\u001aH\u0016¢\u0006\u0004\b\u001c\u0010\u001dJ\u0017\u0010 \u001a\u00020\u001f2\u0006\u0010\u001e\u001a\u00020\u001bH\u0016¢\u0006\u0004\b \u0010!J\u0017\u0010\"\u001a\u00020\u001f2\u0006\u0010\u001e\u001a\u00020\u001bH\u0016¢\u0006\u0004\b\"\u0010!J\u0017\u0010$\u001a\u00020\u00042\u0006\u0010#\u001a\u00020\u0012H\u0014¢\u0006\u0004\b$\u0010\u0015R\u0016\u0010(\u001a\u00020%8\u0002@\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b&\u0010'R\"\u0010/\u001a\u00020\u001f8\u0000@\u0000X\u0080\u000e¢\u0006\u0012\n\u0004\b)\u0010*\u001a\u0004\b+\u0010,\"\u0004\b-\u0010.R\u001c\u00103\u001a\b\u0012\u0004\u0012\u00020\u001b008\u0002@\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b1\u00102R\"\u00107\u001a\u000e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u0004048\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b5\u00106¨\u0006?"}, d2 = {"Lcom/pierfrancescosoffritti/androidyoutubeplayer/core/player/views/WebViewYouTubePlayer;", "Landroid/webkit/WebView;", "Li/p/a/a/a/a;", "Li/p/a/a/a/b$a;", "Ln/e;", "a", "()V", "getInstance", "()Li/p/a/a/a/a;", "", "videoId", "", "startSeconds", "f", "(Ljava/lang/String;F)V", "d", "play", "pause", "", "volumePercent", "setVolume", "(I)V", "time", i.d.a.k.e.f9530u, "(F)V", "destroy", "", "Li/p/a/a/a/c/d;", "getListeners", "()Ljava/util/Collection;", ServiceSpecificExtraArgs.CastExtraArgs.LISTENER, "", WikipediaTokenizer.CATEGORY, "(Li/p/a/a/a/c/d;)Z", "b", "visibility", "onWindowVisibilityChanged", "Landroid/os/Handler;", "k", "Landroid/os/Handler;", "mainThreadHandler", "l", "Z", "isBackgroundPlaybackEnabled$youtubeplayer_release", "()Z", "setBackgroundPlaybackEnabled$youtubeplayer_release", "(Z)V", "isBackgroundPlaybackEnabled", "Ljava/util/HashSet;", "j", "Ljava/util/HashSet;", "youTubePlayerListeners", "Lkotlin/Function1;", WikipediaTokenizer.ITALICS, "Ln/i/a/l;", "youTubePlayerInitListener", "Landroid/content/Context;", "context", "Landroid/util/AttributeSet;", "attrs", "defStyleAttr", "<init>", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "youtubeplayer_release"}, k = 1, mv = {1, 4, 1})
public final class WebViewYouTubePlayer extends WebView implements i.p.a.a.a.a, b.a {
public l<? super i.p.a.a.a.a, n.e> f3893i;
public final HashSet<i.p.a.a.a.c.d> f3894j;
public final Handler f3895k;
public boolean f3896l;
public static final class a implements Runnable {
public final String f3898j;
public final float f3899k;
public a(String str, float f2) {
this.f3898j = str;
this.f3899k = f2;
}
@Override
public final void run() {
WebViewYouTubePlayer webViewYouTubePlayer = WebViewYouTubePlayer.this;
StringBuilder J = i.a.b.a.a.J("javascript:cueVideo('");
J.append(this.f3898j);
J.append("', ");
J.append(this.f3899k);
J.append(')');
webViewYouTubePlayer.loadUrl(J.toString());
}
}
public static final class b implements Runnable {
public final String f3901j;
public final float f3902k;
public b(String str, float f2) {
this.f3901j = str;
this.f3902k = f2;
}
@Override
public final void run() {
WebViewYouTubePlayer webViewYouTubePlayer = WebViewYouTubePlayer.this;
StringBuilder J = i.a.b.a.a.J("javascript:loadVideo('");
J.append(this.f3901j);
J.append("', ");
J.append(this.f3902k);
J.append(')');
webViewYouTubePlayer.loadUrl(J.toString());
}
}
public static final class c implements Runnable {
public c() {
}
@Override
public final void run() {
WebViewYouTubePlayer.this.loadUrl("javascript:pauseVideo()");
}
}
public static final class d implements Runnable {
public d() {
}
@Override
public final void run() {
WebViewYouTubePlayer.this.loadUrl("javascript:playVideo()");
}
}
public static final class e implements Runnable {
public final float f3906j;
public e(float f2) {
this.f3906j = f2;
}
@Override
public final void run() {
WebViewYouTubePlayer webViewYouTubePlayer = WebViewYouTubePlayer.this;
StringBuilder J = i.a.b.a.a.J("javascript:seekTo(");
J.append(this.f3906j);
J.append(')');
webViewYouTubePlayer.loadUrl(J.toString());
}
}
public static final class f implements Runnable {
public final int f3908j;
public f(int i2) {
this.f3908j = i2;
}
@Override
public final void run() {
WebViewYouTubePlayer webViewYouTubePlayer = WebViewYouTubePlayer.this;
StringBuilder J = i.a.b.a.a.J("javascript:setVolume(");
J.append(this.f3908j);
J.append(')');
webViewYouTubePlayer.loadUrl(J.toString());
}
}
public WebViewYouTubePlayer(Context context, AttributeSet attributeSet, int i2) {
super(context, attributeSet, i2);
h.e(context, "context");
this.f3894j = new HashSet<>();
this.f3895k = new Handler(Looper.getMainLooper());
}
@Override
public void a() {
l<? super i.p.a.a.a.a, n.e> lVar = this.f3893i;
if (lVar != null) {
lVar.invoke(this);
} else {
h.l("youTubePlayerInitListener");
throw null;
}
}
@Override
public boolean b(i.p.a.a.a.c.d dVar) {
h.e(dVar, ServiceSpecificExtraArgs.CastExtraArgs.LISTENER);
return this.f3894j.remove(dVar);
}
@Override
public boolean c(i.p.a.a.a.c.d dVar) {
h.e(dVar, ServiceSpecificExtraArgs.CastExtraArgs.LISTENER);
return this.f3894j.add(dVar);
}
@Override
public void d(String str, float f2) {
h.e(str, "videoId");
this.f3895k.post(new a(str, f2));
}
@Override
public void destroy() {
this.f3894j.clear();
this.f3895k.removeCallbacksAndMessages(null);
super.destroy();
}
@Override
public void e(float f2) {
this.f3895k.post(new e(f2));
}
@Override
public void f(String str, float f2) {
h.e(str, "videoId");
this.f3895k.post(new b(str, f2));
}
@Override
public i.p.a.a.a.a getInstance() {
return this;
}
@Override
public Collection<i.p.a.a.a.c.d> getListeners() {
Collection<i.p.a.a.a.c.d> unmodifiableCollection = Collections.unmodifiableCollection(new HashSet(this.f3894j));
h.d(unmodifiableCollection, "Collections.unmodifiable…(youTubePlayerListeners))");
return unmodifiableCollection;
}
@Override
public void onWindowVisibilityChanged(int i2) {
if (this.f3896l && (i2 == 8 || i2 == 4)) {
return;
}
super.onWindowVisibilityChanged(i2);
}
@Override
public void pause() {
this.f3895k.post(new c());
}
@Override
public void play() {
this.f3895k.post(new d());
}
public final void setBackgroundPlaybackEnabled$youtubeplayer_release(boolean z) {
this.f3896l = z;
}
public void setVolume(int i2) {
if (i2 >= 0 && i2 <= 100) {
this.f3895k.post(new f(i2));
return;
}
throw new IllegalArgumentException("Volume must be between 0 and 100".toString());
}
}