Fix streamate stream source parsing
This commit is contained in:
parent
d78f96fef6
commit
a0d9835192
|
@ -93,6 +93,7 @@ public class StreamateModel extends AbstractModel {
|
|||
try (Response response = site.getHttpClient().execute(req)) {
|
||||
if (response.isSuccessful()) {
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
//LOG.debug(json.toString(2));
|
||||
JSONObject formats = json.getJSONObject("formats");
|
||||
JSONObject hls = formats.getJSONObject("mp4-hls");
|
||||
|
||||
|
@ -110,11 +111,10 @@ public class StreamateModel extends AbstractModel {
|
|||
}
|
||||
|
||||
// add raw source stream
|
||||
if (hls.has(ORIGIN)) {
|
||||
if (hls.has(ORIGIN) && !hls.isNull(ORIGIN)) {
|
||||
JSONObject origin = hls.getJSONObject(ORIGIN);
|
||||
StreamSource src = new StreamSource();
|
||||
src.mediaPlaylistUrl = origin.getString("location");
|
||||
origin = hls.getJSONObject(ORIGIN);
|
||||
src.width = origin.optInt("videoWidth");
|
||||
src.height = origin.optInt("videoHeight");
|
||||
src.bandwidth = (origin.optInt("videoKbps") + origin.optInt("audioKbps")) * 1024;
|
||||
|
|
Loading…
Reference in New Issue