Package io.antmedia.rest
Class RestServiceBase
java.lang.Object
io.antmedia.rest.RestServiceBase
- Direct Known Subclasses:
BroadcastRestService
,RootRestService
,VoDRestService
,WhipEndpoint
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
class
static interface
-
Field Summary
Modifier and TypeFieldDescriptionprotected ApplicationContext
protected AntMediaApplicationAdapter
private AppSettings
static final String
Key for Manifest entry of Build number.static final String
protected DataStoreFactory
private DataStore
static final String
static final String
static final int
static final int
static final int
static final int
static final int
static final int
static final String
static final int
static final String
protected static org.slf4j.Logger
static final String
private static final String
static final int
static final int
static final int
static final int
static final String
static final String
static final String
protected IScope
private ServerSettings
protected jakarta.servlet.ServletContext
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddEndpoint
(String id, Endpoint endpoint) addEndpoint
(String id, String rtmpUrl) Deprecated.addIPCamera
(Broadcast stream) protected Result
addStreamSource
(Broadcast stream) static Result
addSubTrack
(String mainTrackId, String subTrackId, DataStore store) boolean
checkStopStreaming
(Broadcast broadcast) boolean
checkStreamUrl
(String url) connectToCamera
(String ipAddr, String username, String password) createBroadcastWithStreamID
(Broadcast broadcast) protected Result
deleteBroadcast
(String id, Boolean deleteSubtracks) protected Result
deleteBroadcasts
(String[] streamIds) private boolean
deleteSubtracks
(Broadcast broadcast) protected Result
protected Result
deleteVoDs
(String[] vodIds) enableRecordMuxing
(String streamId, boolean enableRecording, String type, int resolutionHeight) protected RestServiceBase.BroadcastStatistics
protected RestServiceBase.AppBroadcastStatistics
protected Result
getCameraErrorById
(String streamId) protected List<TensorFlowObject>
getDetectionList
(String id, int offset, int size) String[]
getIPArray
(List<URL> onvifDevices) protected Object
getJwtToken
(String streamId, long expireDate, String type, String roomId) protected Mp4Muxer
getMp4Muxer
(MuxAdaptor muxAdaptor) getMuxAdaptor
(String streamId) protected String[]
getProcess
(String command) private Process
getProcess
(String query, String stalkerDBServer, String stalkerDBUsername, String stalkerDBPassword) protected RestServiceBase.ProcessBuilderFactory
getRoomInfoFromConference
(Broadcast broadcastRoom, String streamId, DataStore store) Deprecated, for removal: This API element is subject to removal in a future version.getScope()
static Version
protected String
getStreamsDirectory
(String appScopeName) protected Object
protected ITokenService
protected VoD
protected List<WebRTCClientStats>
getWebRTCClientStatsList
(int offset, int size, String streamId) importVoDs
(String directory) boolean
isAlreadyRecording
(String streamId, RecordType recordType, int resolutionHeight) static boolean
boolean
isInSameNodeInCluster
(String originAddress) static boolean
isMainTrack
(String streamId, DataStore store) boolean
isStreaming
(Broadcast broadcast) static String
logFailedOperation
(boolean enableRecording, String streamId, RecordType type) static void
logWarning
(String message, String... arguments) protected Broadcast
protected boolean
moveAbsolute
(String id, float valueX, float valueY, float valueZoom) protected boolean
moveContinous
(String id, float valueX, float valueY, float valueZoom) protected boolean
moveRelative
(String id, float valueX, float valueY, float valueZoom) playNextItem
(String id, Integer index) processRTMPEndpoint
(String streamId, String originAddress, String rtmpUrl, boolean addEndpoint, int resolution) private static void
removeEmptyPlayListItems
(List<Broadcast.PlayListItem> playListItemList) removeEndpoint
(String id, String rtmpUrl) Deprecated.removeRTMPEndpoint
(String id, Endpoint endpoint) static Result
removeSubTrack
(String id, String subTrackId, DataStore store) static String
replaceCharsForSecurity
(String value) protected Result
revokeTokens
(String streamId) private boolean
runStalkerImportQuery
(String query, String stalkerDBServer, String stalkerDBUsername, String stalkerDBPassword) static Broadcast
saveBroadcast
(Broadcast broadcast, String status, String scopeName, DataStore dataStore, String settingsListenerHookURL, ServerSettings serverSettings, long absoluteStartTimeMs) protected String[]
static Result
sendDataChannelMessage
(String id, String message, AntMediaApplicationAdapter application, DataStore store) void
setAppCtx
(ApplicationContext appCtx) void
this is for testingvoid
setAppSettings
(AppSettings appSettings) void
setDataStore
(DataStore dataStore) void
setDataStoreFactory
(DataStoreFactory dataStoreFactory) void
setProcessBuilderFactory
(RestServiceBase.ProcessBuilderFactory processBuilderFactory) static void
setResultSuccess
(Result result, boolean success, String failMessage) void
void
setServerSettings
(ServerSettings serverSettings) protected RecordMuxer
startRecord
(String streamId, RecordType recordType, int resolutionHeight) void
startVoDScriptProcess
(String vodUploadFinishScript, File savedFile, VoD newVod, String vodId) private Result
stopBroadcastInternal
(Broadcast broadcast, boolean stopSubrtracks) protected RecordMuxer
stopRecord
(String streamId, RecordType recordType, int resolutionHeight) stopStreaming
(String id, Boolean stopSubtracks) protected Result
unlinksVoD
(String directory) protected Result
updateBroadcast
(String streamId, BroadcastUpdate updatedBroadcast) static void
updatePlayListItemDurationsIfApplicable
(List<Broadcast.PlayListItem> playListItemList, String streamId) protected Result
updateStreamSource
(String streamId, BroadcastUpdate updatedBroadcast, Broadcast broadcastInDB) Update Stream Source or IP Camera infoprotected Result
uploadVoDFile
(String fileName, InputStream inputStream) protected static boolean
validateIPaddress
(String ipaddress) protected static boolean
validateStreamURL
(String url) Parse the string to check it's a valid url It can parse protocol://username:passwrd@server.fqdn/stream format as wellprotected Token
validateToken
(Token token) boolean
waitStopStreaming
(Broadcast broadcast, Boolean resultStopStreaming)
-
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
-
-
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
Deprecated. -
addEndpoint
-
removeEndpoint
Deprecated. -
removeRTMPEndpoint
-
isInSameNodeInCluster
-
processRTMPEndpoint
-
importLiveStreams2Stalker
-
runStalkerImportQuery
-
getProcess
-
importVoDsToStalker
-
getProcessBuilderFactory
-
setProcessBuilderFactory
-
getWebRTCAdaptor
-
addIPCamera
-
addStreamSource
-
connectToCamera
-
validateStreamURL
Parse the string to check it's a valid url It can parse protocol://username:passwrd@server.fqdn/stream format as well- Parameters:
url
-- Returns:
-
validateIPaddress
-
checkStreamUrl
-
addSource
-
getWebRTCClientStatsList
-
deleteVoD
-
deleteVoDs
-
getStreamsDirectory
-
uploadVoDFile
-
startVoDScriptProcess
-
getProcess
- Throws:
IOException
-
synchUserVodList
-
getMuxAdaptor
-
getMp4Muxer
-
startRecord
-
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
-
getDetectionList
-
getTokenService
-
getToken
-
getJwtToken
-
validateToken
-
revokeTokens
-
getVoD
-
getSoftwareVersion
-
isEnterprise
public static boolean isEnterprise() -
getRoomInfoFromConference
@Deprecated(forRemoval=true, since="2.9.1") public static Map<String,String> getRoomInfoFromConference(Broadcast broadcastRoom, String streamId, DataStore store) Deprecated, for removal: This API element is subject to removal in a future version.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
-