forked from j62/ctbrec
Add origin stream source only, if mp4-ws sources are available
This commit is contained in:
parent
3d7fc64bf5
commit
1e47432714
|
@ -91,7 +91,6 @@ public class StreamateModel extends AbstractModel {
|
|||
if(response.isSuccessful()) {
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
JSONObject formats = json.getJSONObject("formats");
|
||||
JSONObject ws = formats.getJSONObject("mp4-ws");
|
||||
JSONObject hls = formats.getJSONObject("mp4-hls");
|
||||
|
||||
// add encodings
|
||||
|
@ -108,6 +107,8 @@ public class StreamateModel extends AbstractModel {
|
|||
}
|
||||
|
||||
// add raw source stream
|
||||
if(formats.has("mp4-ws")) {
|
||||
JSONObject ws = formats.getJSONObject("mp4-ws");
|
||||
JSONObject origin = hls.getJSONObject("origin");
|
||||
StreamSource src = new StreamSource();
|
||||
src.mediaPlaylistUrl = origin.getString("location");
|
||||
|
@ -116,6 +117,7 @@ public class StreamateModel extends AbstractModel {
|
|||
src.height = origin.optInt("videoHeight");
|
||||
src.bandwidth = (origin.optInt("videoKbps") + origin.optInt("audioKbps")) * 1024;
|
||||
streamSources.add(src);
|
||||
}
|
||||
} else {
|
||||
throw new HttpException(response.code(), response.message());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue