Replace deprecated calls
This commit is contained in:
parent
5bbd74efd8
commit
e7cbcfdb61
|
@ -4,6 +4,8 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
@ -40,14 +42,28 @@ public class RecordingDownload extends MergedFfmpegHlsDownload {
|
||||||
throws InvalidKeyException, NoSuchAlgorithmException, IllegalStateException, InterruptedException, IOException, ParseException, PlaylistException {
|
throws InvalidKeyException, NoSuchAlgorithmException, IllegalStateException, InterruptedException, IOException, ParseException, PlaylistException {
|
||||||
running = true;
|
running = true;
|
||||||
if (Config.getInstance().getSettings().requireAuthentication) {
|
if (Config.getInstance().getSettings().requireAuthentication) {
|
||||||
URL u = new URL(segmentPlaylistUri);
|
try {
|
||||||
String path = u.getPath();
|
URI uri = new URI(segmentPlaylistUri);
|
||||||
byte[] key = Config.getInstance().getSettings().key;
|
URL u = uri.toURL();
|
||||||
if (!Config.getInstance().getContextPath().isEmpty()) {
|
String path = u.getPath();
|
||||||
path = path.substring(Config.getInstance().getContextPath().length());
|
byte[] key = Config.getInstance().getSettings().key;
|
||||||
|
if (!Config.getInstance().getContextPath().isEmpty()) {
|
||||||
|
path = path.substring(Config.getInstance().getContextPath().length());
|
||||||
|
}
|
||||||
|
String hmac = Hmac.calculate(path, key);
|
||||||
|
segmentPlaylistUri = segmentPlaylistUri + "?hmac=" + hmac;
|
||||||
|
} catch (URISyntaxException e) {
|
||||||
|
throw new IllegalArgumentException("Invalid URI: " + segmentPlaylistUri, e);
|
||||||
}
|
}
|
||||||
String hmac = Hmac.calculate(path, key);
|
|
||||||
segmentPlaylistUri = segmentPlaylistUri + "?hmac=" + hmac;
|
|
||||||
|
// URL u = new URL(segmentPlaylistUri);
|
||||||
|
// String path = u.getPath();
|
||||||
|
// byte[] key = Config.getInstance().getSettings().key;
|
||||||
|
// if (!Config.getInstance().getContextPath().isEmpty()) {
|
||||||
|
// path = path.substring(Config.getInstance().getContextPath().length());
|
||||||
|
// }
|
||||||
|
// String hmac = Hmac.calculate(path, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
startFfmpegProcess(target);
|
startFfmpegProcess(target);
|
||||||
|
|
Loading…
Reference in New Issue