package com.tencent.liteav.txcvodplayer.b; import android.os.Handler; import android.os.Looper; import android.os.Message; import com.tencent.liteav.base.util.LiteavLog; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import org.json.JSONException; import org.json.JSONObject; public final class d { /* renamed from: a reason: collision with root package name */ public e f31840a; /* renamed from: b reason: collision with root package name */ public f f31841b; /* renamed from: c reason: collision with root package name */ public boolean f31842c; /* renamed from: d reason: collision with root package name */ private final String f31843d = "http://playvideo.qcloud.com/getplayinfo/v2"; /* renamed from: e reason: collision with root package name */ private final String f31844e = "https://playvideo.qcloud.com/getplayinfo/v2"; /* renamed from: f reason: collision with root package name */ private final int f31845f = 0; /* renamed from: g reason: collision with root package name */ private final int f31846g = 1; /* renamed from: h reason: collision with root package name */ private Thread f31847h; /* renamed from: i reason: collision with root package name */ private Handler f31848i = new Handler(Looper.getMainLooper()) { /* class com.tencent.liteav.txcvodplayer.b.d.AnonymousClass1 */ public final void handleMessage(Message message) { d dVar = d.this; e eVar = dVar.f31840a; if (eVar != null) { int i10 = message.what; if (i10 == 0) { eVar.a(dVar); } else if (i10 == 1) { eVar.a(dVar, (String) message.obj, message.arg1); } } } }; /* renamed from: j reason: collision with root package name */ private String f31849j = "{\"code\":0,\"message\":\"\",\"playerInfo\":{\"playerId\":\"0\",\"name\":\"初始播放器\",\"defaultVideoClassification\":\"SD\",\"videoClassification\":[{\"id\":\"FLU\",\"name\":\"流畅\",\"definitionList\":[10,510,210,610,10046,710]},{\"id\":\"SD\",\"name\":\"标清\",\"definitionList\":[20,520,220,620,10047,720]},{\"id\":\"HD\",\"name\":\"高清\",\"definitionList\":[30,530,230,630,10048,730]},{\"id\":\"FHD\",\"name\":\"全高清\",\"definitionList\":[40,540,240,640,10049,740]},{\"id\":\"2K\",\"name\":\"2K\",\"definitionList\":[70,570,270,670,370,770]},{\"id\":\"4K\",\"name\":\"4K\",\"definitionList\":[80,580,280,680,380,780]}],\"logoLocation\":\"1\",\"logoPic\":\"\",\"logoUrl\":\"\"},\"coverInfo\":{\"coverUrl\":\"http://1255566655.vod2.myqcloud.com/7e9cee55vodtransgzp1255566655/8f5fbff14564972818519602447/coverBySnapshot/1513156403_1311093072.100_0.jpg?t=5c08d9fa&us=someus&sign=95f34beb353fe32cfe7f8b5e79cc28b1\"},\"imageSpriteInfo\":{\"imageSpriteList\":[{\"definition\":10,\"height\":80,\"width\":142,\"totalCount\":4,\"imageUrls\":[\"http://1255566655.vod2.myqcloud.com/ca754badvodgzp1255566655/8f5fbff14564972818519602447/imageSprite/1513156058_533711271_00001.jpg?t=5c08d9fa&us=someus&sign=79449db4e1fb05a3becfa096613659c3\"],\"webVttUrl\":\"http://1255566655.vod2.myqcloud.com/ca754badvodgzp1255566655/8f5fbff14564972818519602447/imageSprite/1513156058_533711271.vtt?t=5c08d9fa&us=someus&sign=79449db4e1fb05a3becfa096613659c3\"}]},\"videoInfo\":{\"sourceVideo\":{\"url\":\"http://1255566655.vod2.myqcloud.com/ca754badvodgzp1255566655/8f5fbff14564972818519602447/uAnXX0OMLSAA.wmv?t=5c08d9fa&us=someus&sign=659af5dd3f27eb92dc4ed74eb561daa4\",\"definition\":0,\"duration\":30,\"floatDuration\":30.093000411987305,\"size\":26246026,\"bitrate\":6134170,\"height\":720,\"width\":1280,\"container\":\"asf\",\"md5\":\"\",\"videoStreamList\":[{\"bitrate\":5942130,\"height\":720,\"width\":1280,\"codec\":\"vc1\",\"fps\":29}],\"audioStreamList\":[{\"samplingRate\":44100,\"bitrate\":192040,\"codec\":\"wmav2\"}]},\"mas©terPlayList1\":{\"idrAligned\":false,\"url\":\"http://1255566655.vod2.myqcloud.com/7e9cee55vodtransgzp1255566655/8f5fbff14564972818519602447/master_playlist.m3u8?t=5c08d9fa&us=someus&sign=66290475b7182c89193f03b8f74a979d\",\"definition\":10000,\"md5\":\"23ecc2cfe4cb7c8f87af41993ba8c09c\"},\"transcodeList\":[{\"url\":\"http://1255566655.vod2.myqcloud.com/7e9cee55vodtransgzp1255566655/8f5fbff14564972818519602447/v.f220.m3u8?t=5c08d9fa&us=someus&sign=66290475b7182c89193f03b8f74a979d\",\"definition\":220,\"duration\":30,\"floatDuration\":30.08329963684082,\"size\":796,\"bitrate\":646036,\"height\":360,\"width\":640,\"container\":\"hls,applehttp\",\"md5\":\"dce044407826b4d809c16b6d1a9e9f13\",\"videoStreamList\":[{\"bitrate\":607449,\"height\":360,\"width\":640,\"codec\":\"h264\",\"fps\":24}],\"audioStreamList\":[{\"samplingRate\":44100,\"bitrate\":38587,\"codec\":\"aac\"}]},{\"url\":\"http://1255566655.vod2.myqcloud.com/7e9cee55vodtransgzp1255566655/8f5fbff14564972818519602447/v.f230.m3u8?t=5c08d9fa&us=someus&sign=66290475b7182c89193f03b8f74a979d\",\"definition\":230,\"duration\":30,\"floatDuration\":30.04170036315918,\"size\":802,\"bitrate\":1224776,\"height\":720,\"width\":1280,\"container\":\"hls,applehttp\",\"md5\":\"f07bb0be9e2fee967d87b6c310d3c036\",\"videoStreamList\":[{\"bitrate\":1186189,\"height\":720,\"width\":1280,\"codec\":\"h264\",\"fps\":24}],\"audioStreamList\":[{\"samplingRate\":44100,\"bitrate\":38587,\"codec\":\"aac\"}]},{\"url\":\"http://1255566655.vod2.myqcloud.com/7e9cee55vodtransgzp1255566655/8f5fbff14564972818519602447/v.f240.m3u8?t=5c08d9fa&us=someus&sign=66290475b7182c89193f03b8f74a979d\",\"definition\":240,\"duration\":30,\"floatDuration\":0,\"size\":809,\"bitrate\":2866685,\"height\":1080,\"width\":1920,\"container\":\"hls,applehttp\",\"md5\":\"ff8190cf07afceb8ed053b198453e954\",\"videoStreamList\":[{\"bitrate\":2828098,\"height\":1080,\"width\":1920,\"codec\":\"h264\",\"fps\":24}],\"audioStreamList\":[{\"samplingRate\":44100,\"bitrate\":38587,\"codec\":\"aac\"}]},{\"url\":\"http://1255566655.vod2.myqcloud.com/7e9cee55vodtransgzp1255566655/8f5fbff14564972818519602447/v.f210.m3u8?t=5c08d9fa&us=someus&sign=66290475b7182c89193f03b8f74a979d\",\"definition\":210,\"duration\":30,\"floatDuration\":30.08329963684082,\"size\":788,\"bitrate\":358908,\"height\":180,\"width\":320,\"container\":\"hls,applehttp\",\"md5\":\"5fa784e0a588c51dc2d7428ad6787079\",\"videoStreamList\":[{\"bitrate\":320321,\"height\":180,\"width\":320,\"codec\":\"h264\",\"fps\":24}],\"audioStreamList\":[{\"samplingRate\":44100,\"bitrate\":38587,\"codec\":\"aac\"}]},{\"url\":\"http://1255566655.vod2.myqcloud.com/7e9cee55vodtransgzp1255566655/8f5fbff14564972818519602447/v.f10.mp4?t=5c08d9fa&us=someus&sign=66290475b7182c89193f03b8f74a979d\",\"definition\":10,\"duration\":30,\"floatDuration\":30.139400482177734,\"size\":1169168,\"bitrate\":303916,\"height\":180,\"width\":320,\"container\":\"mov,mp4,m4a,3gp,3g2,mj2\",\"md5\":\"85002ed20125acf150d014b192cf39a0\",\"videoStreamList\":[{\"bitrate\":255698,\"height\":180,\"width\":320,\"codec\":\"h264\",\"fps\":24}],\"audioStreamList\":[{\"samplingRate\":44100,\"bitrate\":48218,\"codec\":\"aac\"}]},{\"url\":\"http://1255566655.vod2.myqcloud.com/7e9cee55vodtransgzp1255566655/8f5fbff14564972818519602447/v.f20.mp4?t=5c08d9fa&us=someus&sign=66290475b7182c89193f03b8f74a979d\",\"definition\":20,\"duration\":30,\"floatDuration\":30.139400482177734,\"size\":2158411,\"bitrate\":566647,\"height\":360,\"width\":640,\"container\":\"mov,mp4,m4a,3gp,3g2,mj2\",\"md5\":\"cba3630e5f92325041da7fee336246b6\",\"videoStreamList\":[{\"bitrate\":518429,\"height\":360,\"width\":640,\"codec\":\"h264\",\"fps\":24}],\"audioStreamList\":[{\"samplingRate\":44100,\"bitrate\":48218,\"codec\":\"aac\"}]}]}}"; public final int a(final int i10, final String str, final String str2, final String str3, final int i14, final String str4) { if (i10 == 0 || str == null) { return -1; } if ((str2 != null || i14 > 0) && str4 == null) { return -1; } AnonymousClass2 r04 = new Thread("getPlayInfo") { /* class com.tencent.liteav.txcvodplayer.b.d.AnonymousClass2 */ /* JADX WARNING: Removed duplicated region for block: B:48:0x0151 A[SYNTHETIC, Splitter:B:48:0x0151] */ /* JADX WARNING: Removed duplicated region for block: B:54:0x015e A[SYNTHETIC, Splitter:B:54:0x015e] */ /* JADX WARNING: Removed duplicated region for block: B:58:0x0164 A[SYNTHETIC, Splitter:B:58:0x0164] */ /* JADX WARNING: Removed duplicated region for block: B:70:? A[RETURN, SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:71:? A[RETURN, SYNTHETIC] */ public final void run() { Throwable th3; Exception e14; String str; BufferedReader bufferedReader = null; try { Looper.prepare(); if (d.this.f31842c) { str = String.format("%s/%d/%s", "https://playvideo.qcloud.com/getplayinfo/v2", Integer.valueOf(i10), str); } else { str = String.format("%s/%d/%s", "http://playvideo.qcloud.com/getplayinfo/v2", Integer.valueOf(i10), str); } String str2 = str2; String str3 = str3; int i10 = i14; String str4 = str4; StringBuilder sb3 = new StringBuilder(); if (str2 != null) { sb3.append("t=" + str2 + "&"); } if (str3 != null) { sb3.append("us=" + str3 + "&"); } if (str4 != null) { sb3.append("sign=" + str4 + "&"); } if (i10 >= 0) { sb3.append("exper=" + i10 + "&"); } if (sb3.length() > 1) { sb3.deleteCharAt(sb3.length() - 1); } String sb4 = sb3.toString(); if (sb4 != null) { str = str + "?" + sb4; } URL url = new URL(str); LiteavLog.d("TXCVodPlayerNetApi", "getplayinfo: ".concat(String.valueOf(str))); HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection(); httpURLConnection.connect(); if (httpURLConnection.getResponseCode() == 200) { BufferedReader bufferedReader2 = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream())); try { StringBuilder sb5 = new StringBuilder(); while (true) { String readLine = bufferedReader2.readLine(); if (readLine == null) { break; } sb5.append(readLine); } d.a(d.this, sb5.toString()); bufferedReader = bufferedReader2; } catch (JSONException unused) { bufferedReader = bufferedReader2; d.this.a("Incorrect format", -2); if (bufferedReader == null) { try { bufferedReader.close(); return; } catch (IOException unused2) { return; } } else { return; } } catch (Exception e15) { e14 = e15; bufferedReader = bufferedReader2; try { LiteavLog.d("TXCVodPlayerNetApi", "http exception: " + e14.getMessage()); d.this.a("The request was exceptional", -2); if (bufferedReader == null) { try { bufferedReader.close(); return; } catch (IOException unused3) { return; } } else { return; } } catch (Throwable th4) { th3 = th4; if (bufferedReader != null) { try { bufferedReader.close(); } catch (IOException unused4) { } } throw th3; } } catch (Throwable th5) { th3 = th5; bufferedReader = bufferedReader2; if (bufferedReader != null) { } throw th3; } } else { d.this.a("Request failed", -1); } if (bufferedReader != null) { try { bufferedReader.close(); } catch (IOException unused5) { } } } catch (JSONException unused6) { d.this.a("Incorrect format", -2); if (bufferedReader == null) { } } catch (Exception e16) { e14 = e16; LiteavLog.d("TXCVodPlayerNetApi", "http exception: " + e14.getMessage()); d.this.a("The request was exceptional", -2); if (bufferedReader == null) { } } } }; this.f31847h = r04; r04.start(); return 0; } public final void a(String str, int i10) { Message message = new Message(); message.what = 1; message.arg1 = i10; message.obj = str; this.f31848i.sendMessage(message); } public final void a(e eVar) { this.f31840a = eVar; } public final f a() { return this.f31841b; } public static /* synthetic */ void a(d dVar, String str) throws JSONException { JSONObject jSONObject = new JSONObject(str); int i10 = jSONObject.getInt("code"); if (i10 != 0) { String string = jSONObject.getString("message"); LiteavLog.e("TXCVodPlayerNetApi", string); dVar.a(string, i10); return; } f fVar = new f(jSONObject); dVar.f31841b = fVar; if (fVar.a() == null) { dVar.a("No playback address", -3); } else { dVar.f31848i.sendEmptyMessage(0); } } }