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()) {
|
if(response.isSuccessful()) {
|
||||||
JSONObject json = new JSONObject(response.body().string());
|
JSONObject json = new JSONObject(response.body().string());
|
||||||
JSONObject formats = json.getJSONObject("formats");
|
JSONObject formats = json.getJSONObject("formats");
|
||||||
JSONObject ws = formats.getJSONObject("mp4-ws");
|
|
||||||
JSONObject hls = formats.getJSONObject("mp4-hls");
|
JSONObject hls = formats.getJSONObject("mp4-hls");
|
||||||
|
|
||||||
// add encodings
|
// add encodings
|
||||||
|
@ -108,14 +107,17 @@ public class StreamateModel extends AbstractModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add raw source stream
|
// add raw source stream
|
||||||
JSONObject origin = hls.getJSONObject("origin");
|
if(formats.has("mp4-ws")) {
|
||||||
StreamSource src = new StreamSource();
|
JSONObject ws = formats.getJSONObject("mp4-ws");
|
||||||
src.mediaPlaylistUrl = origin.getString("location");
|
JSONObject origin = hls.getJSONObject("origin");
|
||||||
origin = ws.getJSONObject("origin"); // switch to web socket origin, because it has width, height and bitrates
|
StreamSource src = new StreamSource();
|
||||||
src.width = origin.optInt("videoWidth");
|
src.mediaPlaylistUrl = origin.getString("location");
|
||||||
src.height = origin.optInt("videoHeight");
|
origin = ws.getJSONObject("origin"); // switch to web socket origin, because it has width, height and bitrates
|
||||||
src.bandwidth = (origin.optInt("videoKbps") + origin.optInt("audioKbps")) * 1024;
|
src.width = origin.optInt("videoWidth");
|
||||||
streamSources.add(src);
|
src.height = origin.optInt("videoHeight");
|
||||||
|
src.bandwidth = (origin.optInt("videoKbps") + origin.optInt("audioKbps")) * 1024;
|
||||||
|
streamSources.add(src);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new HttpException(response.code(), response.message());
|
throw new HttpException(response.code(), response.message());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue