WebPlayerView$TwitchStreamVideoTask.smali
.class Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;
.super Landroid/os/AsyncTask;
.source "WebPlayerView.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lim/tpelyyftgw/ui/components/WebPlayerView;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x2
name = "TwitchStreamVideoTask"
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"Landroid/os/AsyncTask<",
"Ljava/lang/Void;",
"Ljava/lang/Void;",
"Ljava/lang/String;",
">;"
}
.end annotation
# instance fields
.field private canRetry:Z
.field private currentUrl:Ljava/lang/String;
.field private results:[Ljava/lang/String;
.field final synthetic this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;
.field private videoId:Ljava/lang/String;
# direct methods
.method static constructor <clinit>()V
.registers 1
return-void
.end method
.method public constructor <init>(Lim/tpelyyftgw/ui/components/WebPlayerView;Ljava/lang/String;Ljava/lang/String;)V
.registers 4
.param p2, "url" # Ljava/lang/String;
.param p3, "vid" # Ljava/lang/String;
.line 1015
iput-object p1, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;
invoke-direct {p0}, Landroid/os/AsyncTask;-><init>()V
.line 1012
const/4 p1, 0x1
iput-boolean p1, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->canRetry:Z
.line 1013
const/4 p1, 0x2
new-array p1, p1, [Ljava/lang/String;
iput-object p1, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->results:[Ljava/lang/String;
.line 1016
iput-object p3, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->videoId:Ljava/lang/String;
.line 1017
iput-object p2, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->currentUrl:Ljava/lang/String;
.line 1018
return-void
.end method
# virtual methods
.method protected bridge synthetic doInBackground([Ljava/lang/Object;)Ljava/lang/Object;
.registers 2
.line 1008
check-cast p1, [Ljava/lang/Void;
invoke-virtual {p0, p1}, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->doInBackground([Ljava/lang/Void;)Ljava/lang/String;
move-result-object p1
return-object p1
.end method
.method protected varargs doInBackground([Ljava/lang/Void;)Ljava/lang/String;
.registers 20
.param p1, "voids" # [Ljava/lang/Void;
.line 1021
move-object/from16 v1, p0
const-string v0, "UTF-8"
new-instance v2, Ljava/util/HashMap;
invoke-direct {v2}, Ljava/util/HashMap;-><init>()V
.line 1022
.local v2, "headers":Ljava/util/HashMap;, "Ljava/util/HashMap<Ljava/lang/String;Ljava/lang/String;>;"
const-string v3, "Client-ID"
const-string v4, "jzkbprff40iqj646a697cyrvl0zt2m6"
invoke-virtual {v2, v3, v4}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
.line 1024
iget-object v3, v1, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->videoId:Ljava/lang/String;
const/16 v4, 0x26
invoke-virtual {v3, v4}, Ljava/lang/String;->indexOf(I)I
move-result v3
move v4, v3
.local v4, "idx":I
const/4 v5, 0x0
if-lez v3, :cond_24
.line 1025
iget-object v3, v1, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->videoId:Ljava/lang/String;
invoke-virtual {v3, v5, v4}, Ljava/lang/String;->substring(II)Ljava/lang/String;
move-result-object v3
iput-object v3, v1, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->videoId:Ljava/lang/String;
.line 1027
:cond_24
iget-object v3, v1, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;
sget-object v6, Ljava/util/Locale;->US:Ljava/util/Locale;
const/4 v7, 0x1
new-array v8, v7, [Ljava/lang/Object;
iget-object v9, v1, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->videoId:Ljava/lang/String;
aput-object v9, v8, v5
const-string v9, "https://api.twitch.tv/kraken/streams/%s?stream_type=all"
invoke-static {v6, v9, v8}, Ljava/lang/String;->format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v6
invoke-virtual {v3, v1, v6, v2, v5}, Lim/tpelyyftgw/ui/components/WebPlayerView;->downloadUrlContent(Landroid/os/AsyncTask;Ljava/lang/String;Ljava/util/HashMap;Z)Ljava/lang/String;
move-result-object v3
.line 1028
.local v3, "streamCode":Ljava/lang/String;
invoke-virtual/range {p0 .. p0}, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->isCancelled()Z
move-result v6
const/4 v8, 0x0
if-eqz v6, :cond_41
.line 1029
return-object v8
.line 1032
:cond_41
:try_start_41
new-instance v6, Lorg/json/JSONObject;
invoke-direct {v6, v3}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V
.line 1033
.local v6, "obj":Lorg/json/JSONObject;
const-string v9, "stream"
invoke-virtual {v6, v9}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;
move-result-object v9
.line 1034
.local v9, "stream":Lorg/json/JSONObject;
iget-object v10, v1, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;
sget-object v11, Ljava/util/Locale;->US:Ljava/util/Locale;
const-string v12, "https://api.twitch.tv/api/channels/%s/access_token"
new-array v13, v7, [Ljava/lang/Object;
iget-object v14, v1, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->videoId:Ljava/lang/String;
aput-object v14, v13, v5
invoke-static {v11, v12, v13}, Ljava/lang/String;->format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v11
invoke-virtual {v10, v1, v11, v2, v5}, Lim/tpelyyftgw/ui/components/WebPlayerView;->downloadUrlContent(Landroid/os/AsyncTask;Ljava/lang/String;Ljava/util/HashMap;Z)Ljava/lang/String;
move-result-object v10
.line 1035
.local v10, "accessTokenCode":Ljava/lang/String;
new-instance v11, Lorg/json/JSONObject;
invoke-direct {v11, v10}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V
.line 1036
.local v11, "accessToken":Lorg/json/JSONObject;
const-string v12, "sig"
invoke-virtual {v11, v12}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;
move-result-object v12
invoke-static {v12, v0}, Ljava/net/URLEncoder;->encode(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
move-result-object v12
.line 1037
.local v12, "sig":Ljava/lang/String;
const-string v13, "token"
invoke-virtual {v11, v13}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;
move-result-object v13
invoke-static {v13, v0}, Ljava/net/URLEncoder;->encode(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
move-result-object v13
.line 1038
.local v13, "token":Ljava/lang/String;
new-instance v14, Ljava/lang/StringBuilder;
invoke-direct {v14}, Ljava/lang/StringBuilder;-><init>()V
const-string v15, "https://youtube.googleapis.com/v/"
invoke-virtual {v14, v15}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
iget-object v15, v1, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->videoId:Ljava/lang/String;
invoke-virtual {v14, v15}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v14}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v14
invoke-static {v14, v0}, Ljava/net/URLEncoder;->encode(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
.line 1039
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
const-string v14, "allow_source=true&allow_audio_only=true&allow_spectre=true&player=twitchweb&segment_preference=4&p="
invoke-virtual {v0, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
.line 1044
invoke-static {}, Ljava/lang/Math;->random()D
move-result-wide v14
const-wide v16, 0x416312d000000000L # 1.0E7
mul-double v14, v14, v16
double-to-int v14, v14
invoke-virtual {v0, v14}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
const-string v14, "&sig="
invoke-virtual {v0, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v0, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v14, "&token="
invoke-virtual {v0, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v0, v13}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
.line 1047
.local v0, "params":Ljava/lang/String;
sget-object v14, Ljava/util/Locale;->US:Ljava/util/Locale;
const-string v15, "https://usher.ttvnw.net/api/channel/hls/%s.m3u8?%s"
const/4 v8, 0x2
new-array v8, v8, [Ljava/lang/Object;
iget-object v7, v1, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->videoId:Ljava/lang/String;
aput-object v7, v8, v5
const/4 v7, 0x1
aput-object v0, v8, v7
invoke-static {v14, v15, v8}, Ljava/lang/String;->format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
move-result-object v7
.line 1048
.local v7, "m3uUrl":Ljava/lang/String;
iget-object v8, v1, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->results:[Ljava/lang/String;
aput-object v7, v8, v5
.line 1049
iget-object v8, v1, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->results:[Ljava/lang/String;
const-string v14, "hls"
const/4 v15, 0x1
aput-object v14, v8, v15
:try_end_d9
.catch Ljava/lang/Exception; {:try_start_41 .. :try_end_d9} :catch_da
.line 1052
.end local v0 # "params":Ljava/lang/String;
.end local v6 # "obj":Lorg/json/JSONObject;
.end local v7 # "m3uUrl":Ljava/lang/String;
.end local v9 # "stream":Lorg/json/JSONObject;
.end local v10 # "accessTokenCode":Ljava/lang/String;
.end local v11 # "accessToken":Lorg/json/JSONObject;
.end local v12 # "sig":Ljava/lang/String;
.end local v13 # "token":Ljava/lang/String;
goto :goto_de
.line 1050
:catch_da
move-exception v0
.line 1051
.local v0, "e":Ljava/lang/Exception;
invoke-static {v0}, Lim/tpelyyftgw/messenger/FileLog;->e(Ljava/lang/Throwable;)V
.line 1053
.end local v0 # "e":Ljava/lang/Exception;
:goto_de
invoke-virtual/range {p0 .. p0}, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->isCancelled()Z
move-result v0
if-eqz v0, :cond_e6
const/4 v8, 0x0
goto :goto_ea
:cond_e6
iget-object v0, v1, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->results:[Ljava/lang/String;
aget-object v8, v0, v5
:goto_ea
return-object v8
.end method
.method protected bridge synthetic onPostExecute(Ljava/lang/Object;)V
.registers 2
.line 1008
check-cast p1, Ljava/lang/String;
invoke-virtual {p0, p1}, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->onPostExecute(Ljava/lang/String;)V
return-void
.end method
.method protected onPostExecute(Ljava/lang/String;)V
.registers 5
.param p1, "result" # Ljava/lang/String;
.line 1058
if-eqz p1, :cond_33
.line 1059
iget-object v0, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;
const/4 v1, 0x1
invoke-static {v0, v1}, Lim/tpelyyftgw/ui/components/WebPlayerView;->access$1302(Lim/tpelyyftgw/ui/components/WebPlayerView;Z)Z
.line 1060
iget-object v0, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;
invoke-static {v0, p1}, Lim/tpelyyftgw/ui/components/WebPlayerView;->access$1402(Lim/tpelyyftgw/ui/components/WebPlayerView;Ljava/lang/String;)Ljava/lang/String;
.line 1061
iget-object v0, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;
iget-object v2, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->results:[Ljava/lang/String;
aget-object v2, v2, v1
invoke-static {v0, v2}, Lim/tpelyyftgw/ui/components/WebPlayerView;->access$1502(Lim/tpelyyftgw/ui/components/WebPlayerView;Ljava/lang/String;)Ljava/lang/String;
.line 1062
iget-object v0, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;
invoke-static {v0}, Lim/tpelyyftgw/ui/components/WebPlayerView;->access$1700(Lim/tpelyyftgw/ui/components/WebPlayerView;)Z
move-result v0
if-eqz v0, :cond_23
.line 1063
iget-object v0, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;
invoke-static {v0}, Lim/tpelyyftgw/ui/components/WebPlayerView;->access$1800(Lim/tpelyyftgw/ui/components/WebPlayerView;)V
.line 1065
:cond_23
iget-object v0, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;
const/4 v2, 0x0
invoke-static {v0, v2, v1}, Lim/tpelyyftgw/ui/components/WebPlayerView;->access$1900(Lim/tpelyyftgw/ui/components/WebPlayerView;ZZ)V
.line 1066
iget-object v0, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;
invoke-static {v0}, Lim/tpelyyftgw/ui/components/WebPlayerView;->access$100(Lim/tpelyyftgw/ui/components/WebPlayerView;)Lim/tpelyyftgw/ui/components/WebPlayerView$ControlsView;
move-result-object v0
invoke-virtual {v0, v1, v1}, Lim/tpelyyftgw/ui/components/WebPlayerView$ControlsView;->show(ZZ)V
goto :goto_3e
.line 1067
:cond_33
invoke-virtual {p0}, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->isCancelled()Z
move-result v0
if-nez v0, :cond_3e
.line 1068
iget-object v0, p0, Lim/tpelyyftgw/ui/components/WebPlayerView$TwitchStreamVideoTask;->this$0:Lim/tpelyyftgw/ui/components/WebPlayerView;
invoke-static {v0}, Lim/tpelyyftgw/ui/components/WebPlayerView;->access$2000(Lim/tpelyyftgw/ui/components/WebPlayerView;)V
.line 1070
:cond_3e
:goto_3e
return-void
.end method