Class RestServiceBase

java.lang.Object
io.antmedia.rest.RestServiceBase
Direct Known Subclasses:
BroadcastRestService, RootRestService, VoDRestService, WhipEndpoint

public abstract class RestServiceBase extends Object
  • Field Details

  • Constructor Details

    • RestServiceBase

      public RestServiceBase()
  • Method Details

    • setAppCtx

      public void setAppCtx(ApplicationContext appCtx)
    • getAppContext

      @Nullable public ApplicationContext getAppContext()
    • setApplication

      public void setApplication(AntMediaApplicationAdapter app)
      this is for testing
      Parameters:
      app -
    • getApplication

      public AntMediaApplicationAdapter getApplication()
    • getScope

      public IScope getScope()
    • setScope

      public void setScope(IScope scope)
    • getDataStore

      public DataStore getDataStore()
    • setDataStore

      public void setDataStore(DataStore dataStore)
    • getDataStoreFactory

      public DataStoreFactory getDataStoreFactory()
    • setDataStoreFactory

      public void setDataStoreFactory(DataStoreFactory dataStoreFactory)
    • createBroadcastWithStreamID

      public Broadcast createBroadcastWithStreamID(Broadcast broadcast)
    • saveBroadcast

      public static Broadcast saveBroadcast(Broadcast broadcast, String status, String scopeName, DataStore dataStore, String settingsListenerHookURL, ServerSettings serverSettings, long absoluteStartTimeMs)
    • updatePlayListItemDurationsIfApplicable

      public static void updatePlayListItemDurationsIfApplicable(List<Broadcast.PlayListItem> playListItemList, String streamId)
    • getAppSettings

      public AppSettings getAppSettings()
    • setAppSettings

      public void setAppSettings(AppSettings appSettings)
    • getServerSettings

      public ServerSettings getServerSettings()
    • setServerSettings

      public void setServerSettings(ServerSettings serverSettings)
    • deleteBroadcast

      protected Result deleteBroadcast(String id, Boolean deleteSubtracks)
    • deleteSubtracks

      private boolean deleteSubtracks(Broadcast broadcast)
    • deleteBroadcasts

      protected Result deleteBroadcasts(String[] streamIds)
    • lookupBroadcast

      protected Broadcast lookupBroadcast(String id)
    • updateBroadcast

      protected Result updateBroadcast(String streamId, BroadcastUpdate updatedBroadcast)
    • removeEmptyPlayListItems

      private static void removeEmptyPlayListItems(List<Broadcast.PlayListItem> playListItemList)
    • isStreaming

      public boolean isStreaming(Broadcast broadcast)
    • updateStreamSource

      protected Result updateStreamSource(String streamId, BroadcastUpdate updatedBroadcast, Broadcast broadcastInDB)
      Update Stream Source or IP Camera info
      Parameters:
      updatedBroadcast -
      socialNetworksToPublish -
      Returns:
    • checkStopStreaming

      public boolean checkStopStreaming(Broadcast broadcast)
    • waitStopStreaming

      public boolean waitStopStreaming(Broadcast broadcast, Boolean resultStopStreaming)
    • addEndpoint

      @Deprecated public Result addEndpoint(String id, String rtmpUrl)
      Deprecated.
    • addEndpoint

      public Result addEndpoint(String id, Endpoint endpoint)
    • removeEndpoint

      @Deprecated public Result removeEndpoint(String id, String rtmpUrl)
      Deprecated.
    • removeRTMPEndpoint

      public Result removeRTMPEndpoint(String id, Endpoint endpoint)
    • isInSameNodeInCluster

      public boolean isInSameNodeInCluster(String originAddress)
    • processRTMPEndpoint

      public Result processRTMPEndpoint(String streamId, String originAddress, String rtmpUrl, boolean addEndpoint, int resolution)
    • importLiveStreams2Stalker

      public Result importLiveStreams2Stalker()
    • runStalkerImportQuery

      private boolean runStalkerImportQuery(String query, String stalkerDBServer, String stalkerDBUsername, String stalkerDBPassword)
    • getProcess

      private Process getProcess(String query, String stalkerDBServer, String stalkerDBUsername, String stalkerDBPassword)
    • importVoDsToStalker

      public Result importVoDsToStalker()
    • getProcessBuilderFactory

      protected RestServiceBase.ProcessBuilderFactory getProcessBuilderFactory()
    • setProcessBuilderFactory

      public void setProcessBuilderFactory(RestServiceBase.ProcessBuilderFactory processBuilderFactory)
    • getWebRTCAdaptor

      public IWebRTCAdaptor getWebRTCAdaptor()
    • addIPCamera

      public Result addIPCamera(Broadcast stream)
    • addStreamSource

      public Result addStreamSource(Broadcast stream)
    • connectToCamera

      public Result connectToCamera(String ipAddr, String username, String password)
    • validateStreamURL

      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 well
      Parameters:
      url -
      Returns:
    • validateIPaddress

      protected static boolean validateIPaddress(String ipaddress)
    • checkStreamUrl

      public boolean checkStreamUrl(String url)
    • addSource

      protected Result addSource(Broadcast stream)
    • getWebRTCClientStatsList

      protected List<WebRTCClientStats> getWebRTCClientStatsList(int offset, int size, String streamId)
    • deleteVoD

      protected Result deleteVoD(String id)
    • deleteVoDs

      protected Result deleteVoDs(String[] vodIds)
    • getStreamsDirectory

      protected String getStreamsDirectory(String appScopeName)
    • uploadVoDFile

      protected Result uploadVoDFile(String fileName, InputStream inputStream)
    • startVoDScriptProcess

      public void startVoDScriptProcess(String vodUploadFinishScript, File savedFile, VoD newVod, String vodId)
    • getProcess

      public Process getProcess(String command) throws IOException
      Throws:
      IOException
    • synchUserVodList

      protected Result synchUserVodList()
    • getMuxAdaptor

      public MuxAdaptor getMuxAdaptor(String streamId)
    • getMp4Muxer

      @Nullable protected Mp4Muxer getMp4Muxer(MuxAdaptor muxAdaptor)
    • startRecord

      protected RecordMuxer startRecord(String streamId, RecordType recordType, int resolutionHeight)
    • stopRecord

      @Nullable protected RecordMuxer stopRecord(String streamId, RecordType recordType, int resolutionHeight)
      Parameters:
      streamId -
      recordType -
      resolutionHeight -
      Returns:
    • getBroadcastStatistics

      protected RestServiceBase.BroadcastStatistics getBroadcastStatistics(String id)
    • getBroadcastTotalStatistics

      protected RestServiceBase.AppBroadcastStatistics getBroadcastTotalStatistics()
    • getCameraErrorById

      protected Result getCameraErrorById(String streamId)
    • startStreamSource

      public Result startStreamSource(String id)
    • playNextItem

      public Result playNextItem(String id, Integer index)
    • stopBroadcastInternal

      private Result stopBroadcastInternal(Broadcast broadcast, boolean stopSubrtracks)
    • stopStreaming

      public Result stopStreaming(String id, Boolean stopSubtracks)
    • searchOnvifDevices

      protected String[] searchOnvifDevices()
    • getOnvifDeviceProfiles

      protected String[] getOnvifDeviceProfiles(String id)
    • getIPArray

      public String[] getIPArray(List<URL> onvifDevices)
    • moveRelative

      protected boolean moveRelative(String id, float valueX, float valueY, float valueZoom)
    • moveAbsolute

      protected boolean moveAbsolute(String id, float valueX, float valueY, float valueZoom)
    • moveContinous

      protected boolean moveContinous(String id, float valueX, float valueY, float valueZoom)
    • getDetectionList

      protected List<TensorFlowObject> getDetectionList(String id, int offset, int size)
    • getTokenService

      protected ITokenService getTokenService()
    • getToken

      protected Object getToken(String streamId, long expireDate, String type, String roomId)
    • getJwtToken

      protected Object getJwtToken(String streamId, long expireDate, String type, String roomId)
    • validateToken

      protected Token validateToken(Token token)
    • revokeTokens

      protected Result revokeTokens(String streamId)
    • getVoD

      protected VoD getVoD(String id)
    • getSoftwareVersion

      public static Version 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 room
      streamId - : The id of the room to be extracted from the list. It's generally the publisher stream id in websocket communication
      store - : 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

      public static void setResultSuccess(Result result, boolean success, String failMessage)
    • logWarning

      public static void logWarning(String message, String... arguments)
    • addSubTrack

      public static Result addSubTrack(String mainTrackId, String subTrackId, DataStore store)
    • removeSubTrack

      public static Result removeSubTrack(String id, String subTrackId, DataStore store)
    • isMainTrack

      public static boolean isMainTrack(String streamId, DataStore store)
    • sendDataChannelMessage

      public static Result sendDataChannelMessage(String id, String message, AntMediaApplicationAdapter application, DataStore store)
    • logFailedOperation

      public static String logFailedOperation(boolean enableRecording, String streamId, RecordType type)
    • enableRecordMuxing

      public Result enableRecordMuxing(String streamId, boolean enableRecording, String type, int resolutionHeight)
    • isAlreadyRecording

      public boolean isAlreadyRecording(String streamId, RecordType recordType, int resolutionHeight)
    • importVoDs

      public Result importVoDs(String directory)
    • unlinksVoD

      public Result unlinksVoD(String directory)
    • replaceCharsForSecurity

      public static String replaceCharsForSecurity(String value)