Package io.antmedia.rest
Class RestServiceBase
java.lang.Object
io.antmedia.rest.RestServiceBase
- Direct Known Subclasses:
BroadcastRestService,ClusterNotificationService,RootRestService,VoDRestService,WhipEndpoint
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassclassstatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ApplicationContextprotected AntMediaApplicationAdapterprivate AppSettingsstatic final StringKey for Manifest entry of Build number.static final Stringprotected DataStoreFactoryprivate DataStorestatic final Stringstatic final Stringstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final Stringstatic final intstatic final Stringprotected static org.slf4j.Loggerstatic final Stringprivate static final Stringstatic final intstatic final intstatic final intstatic final intstatic final Stringstatic final Stringstatic final Stringprotected IScopeprivate ServerSettingsprotected jakarta.servlet.ServletContextprivate static Version -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddEndpoint(String id, Endpoint endpoint) addIPCamera(Broadcast stream) protected ResultaddStreamSource(Broadcast stream) static ResultaddSubTrack(String mainTrackId, String subTrackId, DataStore store) booleancheckStopStreaming(Broadcast broadcast) booleancheckStreamUrl(String url) connectToCamera(String ipAddr, String username, String password) createBroadcastWithStreamID(Broadcast broadcast) protected ResultdeleteBroadcast(String id, Boolean deleteSubtracks) protected ResultdeleteBroadcasts(String[] streamIds) private booleandeleteSubtracks(Broadcast broadcast) protected Resultprotected ResultdeleteVoDs(String[] vodIds) enableRecordMuxing(String streamId, boolean enableRecording, String type, int resolutionHeight) enableRecordMuxing(String streamId, boolean enableRecording, String type, int resolutionHeight, String fileName) private ResultenableRecordMuxingInternal(String streamId, boolean enableRecording, String type, int resolutionHeight, String fileName) protected RestServiceBase.BroadcastStatisticsprotected RestServiceBase.AppBroadcastStatisticsstatic StringgetBuildNumber(String manifestPath) protected ResultgetCameraErrorById(String streamId) String[]getIPArray(List<URL> onvifDevices) protected ObjectgetJwtToken(String streamId, long expireDate, String type, String roomId) protected Mp4MuxergetMp4Muxer(MuxAdaptor muxAdaptor) getMuxAdaptor(String streamId) protected String[]getProcess(String command) protected RestServiceBase.ProcessBuilderFactorygetRoomInfoFromConference(Broadcast broadcastRoom, String streamId, DataStore store) Get the active streams in the roomgetScope()static Versionprotected StringgetStreamsDirectory(String appScopeName) protected Objectprotected ITokenServiceprotected VoDprotected List<WebRTCClientStats>getWebRTCClientStatsList(int offset, int size, String streamId) importVoDs(String directory) booleanisAlreadyRecording(String streamId, RecordType recordType, int resolutionHeight) static booleanbooleanisInSameNodeInCluster(String originAddress) static booleanisMainTrack(String streamId, DataStore store) booleanisStreaming(Broadcast broadcast) static StringlogFailedOperation(boolean enableRecording, String streamId, RecordType type) static voidlogWarning(String message, String... arguments) protected booleanmoveAbsolute(String id, float valueX, float valueY, float valueZoom) protected booleanmoveContinous(String id, float valueX, float valueY, float valueZoom) protected booleanmoveRelative(String id, float valueX, float valueY, float valueZoom) playNextItem(String id, Integer index) processEndpoint(String streamId, String originAddress, String endpointUrl, boolean addEndpoint, int resolution) private static voidremoveEmptyPlayListItems(List<Broadcast.PlayListItem> playListItemList) removeRTMPEndpoint(String id, Endpoint endpoint) static ResultremoveSubTrack(String id, String subTrackId, DataStore store) static StringreplaceCharsForSecurity(String value) protected ResultrevokeTokens(String streamId) protected StringsanitizeAndStripExtension(String fileName, RecordType recordType) static BroadcastsaveBroadcast(Broadcast broadcast, String status, String scopeName, DataStore dataStore, String settingsListenerHookURL, ServerSettings serverSettings, long absoluteStartTimeMs) protected String[]static ResultsendDataChannelMessage(String id, String message, AntMediaApplicationAdapter application, DataStore store) voidsetAppCtx(ApplicationContext appCtx) voidthis is for testingvoidsetAppSettings(AppSettings appSettings) voidsetDataStore(DataStore dataStore) voidsetDataStoreFactory(DataStoreFactory dataStoreFactory) voidsetProcessBuilderFactory(RestServiceBase.ProcessBuilderFactory processBuilderFactory) static voidsetResultSuccess(Result result, boolean success, String failMessage) voidvoidsetServerSettings(ServerSettings serverSettings) protected RecordMuxerstartRecord(String streamId, RecordType recordType, int resolutionHeight) protected RecordMuxerstartRecord(String streamId, RecordType recordType, int resolutionHeight, String baseFileName) voidstartVoDScriptProcess(String vodUploadFinishScript, File savedFile, VoD newVod, String vodId) private ResultstopBroadcastInternal(Broadcast broadcast, boolean stopSubrtracks, String subscriberId) protected RecordMuxerstopRecord(String streamId, RecordType recordType, int resolutionHeight) stopStreaming(String id, Boolean stopSubtracks, String subscriberId) unlinksVoD(String directory) protected ResultupdateBroadcast(String streamId, BroadcastUpdate updatedBroadcast) static voidupdatePlayListItemDurationsIfApplicable(List<Broadcast.PlayListItem> playListItemList, String streamId) protected ResultupdateStreamSource(String streamId, BroadcastUpdate updatedBroadcast, Broadcast broadcastInDB) Update Stream Source or IP Camera infouploadVoDFile(String fileName, InputStream inputStream) uploadVoDFile(String fileName, InputStream inputStream, String metadata) protected static booleanvalidateIPaddress(String ipaddress) protected static booleanvalidateStreamURL(String url) Parse the string to check it's a valid url It can parse protocol://username:[email protected]/stream format as wellprotected TokenvalidateToken(Token token) booleanwaitStopStreaming(Broadcast broadcast)
-
Field Details
-
MAIN_TRACK_OF_THE_STREAM
- See Also:
-
REPLACE_CHARS_FOR_SECURITY
- See Also:
-
BUILD_NUMBER
Key for Manifest entry of Build number. It should match with the value in pom.xml- See Also:
-
ENTERPRISE_EDITION
- See Also:
-
COMMUNITY_EDITION
- See Also:
-
MAX_ITEM_IN_ONE_LIST
public static final int MAX_ITEM_IN_ONE_LIST- See Also:
-
ERROR_SOCIAL_ENDPOINT_UNDEFINED_CLIENT_ID
public static final int ERROR_SOCIAL_ENDPOINT_UNDEFINED_CLIENT_ID- See Also:
-
ERROR_SOCIAL_ENDPOINT_UNDEFINED_ENDPOINT
public static final int ERROR_SOCIAL_ENDPOINT_UNDEFINED_ENDPOINT- See Also:
-
ERROR_SOCIAL_ENDPOINT_EXCEPTION_IN_ASKING_AUTHPARAMS
public static final int ERROR_SOCIAL_ENDPOINT_EXCEPTION_IN_ASKING_AUTHPARAMS- See Also:
-
RECORD_ENABLE
public static final int RECORD_ENABLE- See Also:
-
RECORD_DISABLE
public static final int RECORD_DISABLE- See Also:
-
RECORD_NO_SET
public static final int RECORD_NO_SET- See Also:
-
HIGH_CPU_ERROR
public static final int HIGH_CPU_ERROR- See Also:
-
FETCHER_NOT_STARTED_ERROR
public static final int FETCHER_NOT_STARTED_ERROR- See Also:
-
INVALID_STREAM_NAME_ERROR
public static final int INVALID_STREAM_NAME_ERROR- See Also:
-
FETCH_REQUEST_REDIRECTED_TO_ORIGIN
public static final int FETCH_REQUEST_REDIRECTED_TO_ORIGIN- See Also:
-
HTTP
- See Also:
-
RTSP
- See Also:
-
ENDPOINT_GENERIC
- See Also:
-
logger
protected static org.slf4j.Logger logger -
processBuilderFactory
-
IPV4_REGEX
- See Also:
-
LOOPBACK_REGEX
- See Also:
-
REPLACE_CHARS
- See Also:
-
servletContext
@Context protected jakarta.servlet.ServletContext servletContext -
dataStoreFactory
-
dbStore
-
appCtx
-
scope
-
appInstance
-
appSettings
-
serverSettings
-
version
-
-
Constructor Details
-
RestServiceBase
public RestServiceBase()
-
-
Method Details
-
setAppCtx
-
getAppContext
-
setApplication
this is for testing- Parameters:
app-
-
getApplication
-
getScope
-
setScope
-
getDataStore
-
setDataStore
-
getDataStoreFactory
-
setDataStoreFactory
-
createBroadcastWithStreamID
-
saveBroadcast
-
updatePlayListItemDurationsIfApplicable
public static void updatePlayListItemDurationsIfApplicable(List<Broadcast.PlayListItem> playListItemList, String streamId) -
getAppSettings
-
setAppSettings
-
getServerSettings
-
setServerSettings
-
deleteBroadcast
-
deleteSubtracks
-
deleteBroadcasts
-
lookupBroadcast
-
updateBroadcast
-
removeEmptyPlayListItems
-
isStreaming
-
updateStreamSource
protected Result updateStreamSource(String streamId, BroadcastUpdate updatedBroadcast, Broadcast broadcastInDB) Update Stream Source or IP Camera info- Parameters:
updatedBroadcast-socialNetworksToPublish-- Returns:
-
checkStopStreaming
-
waitStopStreaming
-
addEndpoint
-
removeRTMPEndpoint
-
isInSameNodeInCluster
-
processEndpoint
-
getProcessBuilderFactory
-
setProcessBuilderFactory
-
getWebRTCAdaptor
-
addIPCamera
-
addStreamSource
-
connectToCamera
-
validateStreamURL
Parse the string to check it's a valid url It can parse protocol://username:[email protected]/stream format as well- Parameters:
url-- Returns:
-
validateIPaddress
-
checkStreamUrl
-
addSource
-
getWebRTCClientStatsList
-
deleteVoD
-
deleteVoDs
-
getStreamsDirectory
-
uploadVoDFile
-
uploadVoDFile
-
startVoDScriptProcess
-
getProcess
- Throws:
IOException
-
getMuxAdaptor
-
getMp4Muxer
-
startRecord
-
startRecord
protected RecordMuxer startRecord(String streamId, RecordType recordType, int resolutionHeight, String baseFileName) -
stopRecord
@Nullable protected RecordMuxer stopRecord(String streamId, RecordType recordType, int resolutionHeight) - Parameters:
streamId-recordType-resolutionHeight-- Returns:
-
getBroadcastStatistics
-
getBroadcastTotalStatistics
-
getCameraErrorById
-
startStreamSource
-
playNextItem
-
stopBroadcastInternal
-
stopStreaming
-
searchOnvifDevices
-
getOnvifDeviceProfiles
-
getIPArray
-
moveRelative
-
moveAbsolute
-
moveContinous
-
getTokenService
-
getToken
-
getJwtToken
-
validateToken
-
revokeTokens
-
getVoD
-
getSoftwareVersion
-
getBuildNumber
-
isEnterprise
public static boolean isEnterprise() -
getRoomInfoFromConference
public static Map<String,String> getRoomInfoFromConference(Broadcast broadcastRoom, String streamId, DataStore store) Get the active streams in the room- Parameters:
roomId- : It's the id of the roomstreamId- : The id of the room to be extracted from the list. It's generally the publisher stream id in websocket communicationstore- : Datastore object to run the query- Returns:
- null if there is no room recorded in the database, returns map filled with the active streams. Key is the streamId, value is the name
-
setResultSuccess
-
logWarning
-
addSubTrack
-
removeSubTrack
-
isMainTrack
-
sendDataChannelMessage
public static Result sendDataChannelMessage(String id, String message, AntMediaApplicationAdapter application, DataStore store) -
logFailedOperation
-
enableRecordMuxing
-
isAlreadyRecording
-
importVoDs
-
unlinksVoD
-
replaceCharsForSecurity
-
enableRecordMuxing
-
enableRecordMuxingInternal
-
sanitizeAndStripExtension
-