forked from j62/ctbrec
Add setting to switch between DASH and HLS for MFC
This commit is contained in:
parent
41e2e5ce54
commit
b12f3e5789
|
@ -12,7 +12,10 @@ import javafx.scene.control.Button;
|
|||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.ToggleGroup;
|
||||
import javafx.scene.control.Tooltip;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.Priority;
|
||||
|
||||
|
@ -74,6 +77,10 @@ public class MyFreeCamsConfigUI extends AbstractConfigUI {
|
|||
GridPane.setColumnSpan(password, 2);
|
||||
layout.add(password, 1, row++);
|
||||
|
||||
Button createAccount = new Button("Create new Account");
|
||||
createAccount.setOnAction(e -> DesktopIntegration.open(myFreeCams.getAffiliateLink()));
|
||||
layout.add(createAccount, 1, row++);
|
||||
|
||||
layout.add(new Label("MyFreeCams Base URL"), 0, row);
|
||||
TextField baseUrl = new TextField();
|
||||
baseUrl.setText(Config.getInstance().getSettings().mfcBaseUrl);
|
||||
|
@ -86,22 +93,32 @@ public class MyFreeCamsConfigUI extends AbstractConfigUI {
|
|||
GridPane.setColumnSpan(baseUrl, 2);
|
||||
layout.add(baseUrl, 1, row++);
|
||||
|
||||
layout.add(new Label("Ignore upscaled stream (960p)"), 0, row);
|
||||
CheckBox ignoreUpscaled = new CheckBox();
|
||||
ignoreUpscaled.setSelected(Config.getInstance().getSettings().mfcIgnoreUpscaled);
|
||||
ignoreUpscaled.selectedProperty().addListener((obs, oldV, newV) -> {
|
||||
Config.getInstance().getSettings().mfcIgnoreUpscaled = newV;
|
||||
String desc = "If you are having A/V sync problems in the recorded videos, try HLS. But you might get blocked.";
|
||||
Tooltip streamingTechTooltip = new Tooltip(desc);
|
||||
l = new Label("Streaming technology");
|
||||
l.setTooltip(streamingTechTooltip);
|
||||
layout.add(l, 0, row);
|
||||
RadioButton useHls = new RadioButton("HLS");
|
||||
useHls.setTooltip(streamingTechTooltip);
|
||||
RadioButton useDash = new RadioButton("DASH");
|
||||
useDash.setTooltip(streamingTechTooltip);
|
||||
ToggleGroup streamingTech = new ToggleGroup();
|
||||
streamingTech.getToggles().addAll(useDash, useHls);
|
||||
useHls.setSelected(!Config.getInstance().getSettings().mfcUseDash);
|
||||
useDash.setSelected(Config.getInstance().getSettings().mfcUseDash);
|
||||
useDash.selectedProperty().addListener((obs, oldV, newV) -> {
|
||||
Config.getInstance().getSettings().mfcUseDash = newV;
|
||||
save();
|
||||
});
|
||||
layout.add(ignoreUpscaled, 1, row++);
|
||||
layout.add(useDash, 1, row);
|
||||
layout.add(useHls, 2, row);
|
||||
|
||||
Button createAccount = new Button("Create new Account");
|
||||
createAccount.setOnAction((e) -> DesktopIntegration.open(myFreeCams.getAffiliateLink()));
|
||||
layout.add(createAccount, 1, row);
|
||||
GridPane.setColumnSpan(createAccount, 2);
|
||||
GridPane.setMargin(username, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
GridPane.setMargin(password, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
GridPane.setMargin(baseUrl, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
GridPane.setMargin(ignoreUpscaled, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
GridPane.setMargin(useHls, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
GridPane.setMargin(useDash, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
GridPane.setMargin(createAccount, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
|
||||
|
||||
return layout;
|
||||
|
|
|
@ -77,6 +77,7 @@ public class Settings {
|
|||
public String mfcModelsTableSortColumn = "";
|
||||
public String mfcModelsTableSortType = "";
|
||||
public String mfcPassword = "";
|
||||
public boolean mfcUseDash = true;
|
||||
public String mfcUsername = "";
|
||||
public int minimumLengthInSeconds = 0;
|
||||
public long minimumSpaceLeftInBytes = 0;
|
||||
|
|
|
@ -106,7 +106,11 @@ public class MyFreeCamsClient {
|
|||
while (running) {
|
||||
if (ws == null && !connecting) {
|
||||
LOG.info("Websocket is null. Starting a new connection");
|
||||
Request req = new Request.Builder().url(wsUrl).addHeader(ORIGIN, "http://m.myfreecams.com").build();
|
||||
Request req = new Request.Builder()
|
||||
.url(wsUrl)
|
||||
.header(USER_AGENT, Config.getInstance().getSettings().httpUserAgentMobile)
|
||||
.header(REFERER, "http://m.myfreecams.com")
|
||||
.header(ORIGIN, "http://m.myfreecams.com").build();
|
||||
ws = createWebSocket(req);
|
||||
}
|
||||
|
||||
|
@ -574,12 +578,25 @@ public class MyFreeCamsClient {
|
|||
String phase = state.getU().getPhase() != null ? state.getU().getPhase() : "z";
|
||||
String phasePrefix = phase.equals("z") ? "" : '_' + phase;
|
||||
String server = "video" + camservString.replaceAll("^\\D+", "");
|
||||
boolean useHls = serverConfig.isOnObsServer(state);
|
||||
String streamUrl;
|
||||
boolean dontUseDash = !Config.getInstance().getSettings().mfcUseDash;
|
||||
if (serverConfig.isOnWzObsVideoServer(state) || !serverConfig.isOnObsServer(state)) {
|
||||
streamUrl = HTTPS + server + ".myfreecams.com/NxServer/ngrp:mfc" + phasePrefix + '_' + userChannel + ".f4v_mobile/playlist.m3u8";
|
||||
// wowza server
|
||||
if (useHls || dontUseDash) {
|
||||
streamUrl = HTTPS + server + ".myfreecams.com/NxServer/ngrp:mfc" + phasePrefix + '_' + userChannel + ".f4v_mobile/playlist.m3u8";
|
||||
} else {
|
||||
streamUrl = HTTPS + server + ".myfreecams.com/NxServer/ngrp:mfc" + phasePrefix + '_' + userChannel + ".f4v_desktop/manifest.mpd";
|
||||
}
|
||||
} else {
|
||||
streamUrl = HTTPS + server + ".myfreecams.com:8444/x-hls/" + cxid + '/' + userChannel + '/' + ctxenc + "/mfc" + phasePrefix + '_' + userChannel
|
||||
+ ".m3u8";
|
||||
// nginx server
|
||||
if (useHls || dontUseDash) {
|
||||
streamUrl = HTTPS + server + ".myfreecams.com:8444/x-hls/" + cxid + '/' + userChannel + '/' + ctxenc + "/mfc" + phasePrefix + '_' + userChannel
|
||||
+ ".m3u8";
|
||||
} else {
|
||||
streamUrl = HTTPS + server + ".myfreecams.com:8444/x-dsh/" + cxid + '/' + userChannel + '/' + ctxenc + "/mfc" + phasePrefix + '_' + userChannel
|
||||
+ ".mpd";
|
||||
}
|
||||
}
|
||||
return streamUrl;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue