feat(markers): add save endpoint with markers

This commit is contained in:
2026-07-02 19:09:07 +01:00
parent 2cac1770f9
commit ba378680c6
2 changed files with 32 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ package com.ddf.vodsystem.services;
import com.ddf.vodsystem.dto.ClipOptions;
import com.ddf.vodsystem.dto.Job;
import com.ddf.vodsystem.dto.JobState;
import com.ddf.vodsystem.entities.Marker;
import com.ddf.vodsystem.entities.User;
import com.ddf.vodsystem.exceptions.NotAuthenticated;
import com.ddf.vodsystem.services.media.CompressionService;
@@ -32,12 +33,13 @@ public class MediaService {
private static final int HLS_SEGMENT_LENGTH = 3;
private final StreamActionsService streamActionsService;
private final VodService vodService;
private final MarkerService markerService;
public MediaService(JobRegistryService jobRegistryService,
DirectoryService directoryService,
CompressionService compressionService,
UserService userService,
ClipService clipService, StreamActionsService streamActionsService, VodService vodService) {
ClipService clipService, StreamActionsService streamActionsService, VodService vodService, MarkerService markerService) {
this.jobRegistryService = jobRegistryService;
this.directoryService = directoryService;
this.compressionService = compressionService;
@@ -45,6 +47,7 @@ public class MediaService {
this.clipService = clipService;
this.streamActionsService = streamActionsService;
this.vodService = vodService;
this.markerService = markerService;
}
/**
@@ -149,6 +152,18 @@ public class MediaService {
);
}
public Job saveSection(
Long startMarkerId,
Long endMarkerId,
String title,
String description
) throws IOException {
Marker start = markerService.getMarkerById(startMarkerId);
Marker end = markerService.getMarkerById(endMarkerId);
return saveSection(start.getTimestamp(), end.getTimestamp(), title, description);
}
/**
* Saves the last {@code duration} seconds of the currently authenticated user's live stream as a clip.
* <p>