Interface IStreamRecorder


  • public interface IStreamRecorder
    This interface provides access to into a StreamRecorder.
    The StreamRecorder is responsible for performing the actual recording functionality of a live stream, as directed by the LiveStreamRecordManager.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      IStreamRecorderActionNotify addListener​(IStreamRecorderActionNotify listener)
      Called to add a listener for IStreamRecorderActionNotify events generated by the recorder.
      Multiple listeners can be added.
      void createRecorder()
      Called to tell the recorder to initalize itself after it has been created.
      IApplicationInstance getAppInstance()
      Called to get the application Instance the recorder is associated with
      String getBaseFilePath()
      Called to get the full path and filename used by the recorder as the PRIOR to any changes made due to the selected segmentationType and versioningOption.
      long getCurrentDuration()
      Called to get the current segment duration regardless of segmentationType.
      This value is updated continuously while the recorder state is RECORDER_STATE_RECORDING.
      String getCurrentFile()
      Called to get the current segments fully qualified file name regardless of segmentationType.
      This value is updated continuously while the recorder state is RECORDER_STATE_RECORDING.
      long getCurrentSize()
      Called to get the current segment size regardless of segmentationType
      This value is updated continuously while the recorder state is RECORDER_STATE_RECORDING.
      org.joda.time.DateTime getEndTime()
      Called to get the end time of the recording regardless of segmentationType.
      When the recording is still active, the returned value is null.
      When the recording has been stopped, the returned value is for the time when the recording stopped.
      String getErrorString()
      Called to get an error string describing the error, when the recorder state is is RECORDER_STATE_ERROR.
      String getFileFormat()
      Called to get output file format being used by the recorder.
      String getFilePath()
      Called to get the full path and filename used by the recorder AFTER changes made due to the selected segmentationType and versioningOption.
      NOTE: When the recorder is not in RECORDER_STATE_RECORDING state, the returned value will be the basefilePath value.
      IStreamRecorderFileVersionDelegate getFileVersionDelegate()
      Called to get the IStreamRecorderFileVersionDelegate being used by the recorder.
      StreamRecorderParameters getRecorderParams()
      Called to get the StreamRecorderParameters for the recorder
      This is typically used to check or set the StreamRecorderParameters used to configure a recorder.
      int getRecorderState()
      Called to get the current state of the recorder
      String getRecorderStateString()
      Called to get the current state of the recorder as a text string.
      String getSegmentationType()
      Called to get the SegmentationType being used by the recorder.
      long getSegmentDuration()
      Called to get the segment duration used by the recorder when segmentationType is set to SEGMENT_BY_DURATION.
      int getSegmentNumber()
      Called to get the current segment number regardless of segmentationType.
      This value is updated continuously while the recorder state is RECORDER_STATE_RECORDING.
      String getSegmentScheduleString()
      Called to get the segment schedule crontab string used by the recorder when segmentationType is set to SEGMENT_BY_SCHEDULE.
      long getSegmentSize()
      Called to get the segment size used by the recorder when segmentationType is set to SEGMENT_BY_SIZE.
      org.joda.time.DateTime getStartTime()
      Called to get the start time of the current recording regardless of segmentationType.
      IMediaStream getStream()
      Called to get the IMediaStream object being used by the recorder
      String getStreamName()
      Called to get the stream name being used by the recorder
      String getVersioningOption()
      Called to get the method used by the recorder to version a file when a file exists of the same name.
      boolean isMoveFirstVideoFrameToZero()
      Called to check the value of MoveFirstVideoFrameToZero being used by the recorder.
      boolean isRecordData()
      Called to check the value of RecordData being used by the recorder.
      boolean isSplitOnTcDiscontinuity()
      Called to check the value of splitOnTcDiscontinuity being used by the recorder.
      boolean isStartOnKeyFrame()
      Called to check the value of StartOnKeyFrame being used by the recorder.
      boolean removeListener​(IStreamRecorderActionNotify listener)
      Called to remove a listener from the the recorder.
      void setStream​(IMediaStream stream)
      Called to set the IMediaStream object the recorder will use
      NOTE: This method is used by LiveStreamRecordManager to manage recorders and associated IMediaStream objects and should NOT be used directly when a StreamRecorder is under the control of LiveStreamRecordManager
      void splitRecorder()
      Called to tell the recorder to stop writing to the current file, create a new file and write begin writing data to the new file.
      The recorder should start writing data to the new file beginning with a video key frame.
      void startRecorder()
      Called to tell the recorder to start recording.
      void stopRecorder()
      Called to tell the recorder to stop recording.
      void switchRecorder​(IMediaStream newStream)
      Called to tell the recorder to switch over to the data from a new IMediaStream.
      This occurs when an existing stream is replaced with a stream of the same name.
    • Method Detail

      • createRecorder

        void createRecorder()
        Called to tell the recorder to initalize itself after it has been created. This API should be called prior to calling the startRecorder() method.
      • startRecorder

        void startRecorder()
        Called to tell the recorder to start recording. This API should be called after createRecorder() method has been called to ensure the recorder has been properly initialized
      • switchRecorder

        void switchRecorder​(IMediaStream newStream)
        Called to tell the recorder to switch over to the data from a new IMediaStream.
        This occurs when an existing stream is replaced with a stream of the same name.

        For example: When a stream is published from an encoder, and then a different encoder publishes a stream using the same stream name. Called before LiveStreamRecordManager calls the recorders own switchRecorder method.

        Parameters:
        newStream - The new IMediaStream the recorder should switch to.
      • stopRecorder

        void stopRecorder()
        Called to tell the recorder to stop recording.
      • splitRecorder

        void splitRecorder()
        Called to tell the recorder to stop writing to the current file, create a new file and write begin writing data to the new file.
        The recorder should start writing data to the new file beginning with a video key frame.
      • getRecorderParams

        StreamRecorderParameters getRecorderParams()
        Called to get the StreamRecorderParameters for the recorder
        This is typically used to check or set the StreamRecorderParameters used to configure a recorder. To get the actual value used by the recorder, use the appropriate get method found below.

        See Also:
        StreamRecorderParameters
      • getAppInstance

        IApplicationInstance getAppInstance()
        Called to get the application Instance the recorder is associated with

        Returns:
        IApplicationInstance
      • getStreamName

        String getStreamName()
        Called to get the stream name being used by the recorder

        Returns:
        String Stream name
      • getStream

        IMediaStream getStream()
        Called to get the IMediaStream object being used by the recorder

        Returns:
        IMediaStream Stream object
      • setStream

        void setStream​(IMediaStream stream)
        Called to set the IMediaStream object the recorder will use
        NOTE: This method is used by LiveStreamRecordManager to manage recorders and associated IMediaStream objects and should NOT be used directly when a StreamRecorder is under the control of LiveStreamRecordManager

        Parameters:
        stream - IMediaStream The new Stream object
      • isStartOnKeyFrame

        boolean isStartOnKeyFrame()
        Called to check the value of StartOnKeyFrame being used by the recorder.

        Returns:
        boolean true, false

        See Also:
        StreamRecorderParameters.startOnKeyFrame
      • isRecordData

        boolean isRecordData()
        Called to check the value of RecordData being used by the recorder.

        Returns:
        boolean true, false

        See Also:
        StreamRecorderParameters.recordData
      • getSegmentSize

        long getSegmentSize()
        Called to get the segment size used by the recorder when segmentationType is set to SEGMENT_BY_SIZE.

        Returns:
        long Segment size in bytes

        See Also:
        StreamRecorderParameters.segmentSize
      • getSegmentDuration

        long getSegmentDuration()
        Called to get the segment duration used by the recorder when segmentationType is set to SEGMENT_BY_DURATION.

        Returns:
        long Segment duration in milliseconds

        See Also:
        StreamRecorderParameters.segmentDuration
      • getSegmentScheduleString

        String getSegmentScheduleString()
        Called to get the segment schedule crontab string used by the recorder when segmentationType is set to SEGMENT_BY_SCHEDULE.

        Returns:
        String Segment schedule

        See Also:
        StreamRecorderParameters.segmentSchedule
      • getFilePath

        String getFilePath()
        Called to get the full path and filename used by the recorder AFTER changes made due to the selected segmentationType and versioningOption.
        NOTE: When the recorder is not in RECORDER_STATE_RECORDING state, the returned value will be the basefilePath value.

        Returns:
        String Full path and filename

        See Also:
        getBaseFilePath()
      • getBaseFilePath

        String getBaseFilePath()
        Called to get the full path and filename used by the recorder as the PRIOR to any changes made due to the selected segmentationType and versioningOption.

        Returns:
        String Full path and filename

        See Also:
        getFilePath()
      • getCurrentSize

        long getCurrentSize()
        Called to get the current segment size regardless of segmentationType
        This value is updated continuously while the recorder state is RECORDER_STATE_RECORDING.

        Returns:
        long Segment size in bytes
      • getCurrentDuration

        long getCurrentDuration()
        Called to get the current segment duration regardless of segmentationType.
        This value is updated continuously while the recorder state is RECORDER_STATE_RECORDING.

        Returns:
        long Segment duration in milliseconds
      • getCurrentFile

        String getCurrentFile()
        Called to get the current segments fully qualified file name regardless of segmentationType.
        This value is updated continuously while the recorder state is RECORDER_STATE_RECORDING.

        Returns:
        String The current fully qualified file name, packets are being written to.
      • getSegmentNumber

        int getSegmentNumber()
        Called to get the current segment number regardless of segmentationType.
        This value is updated continuously while the recorder state is RECORDER_STATE_RECORDING.

        Returns:
        int Current segment number.
      • getStartTime

        org.joda.time.DateTime getStartTime()
        Called to get the start time of the current recording regardless of segmentationType.

        Returns:
        DateTime Current segment's start time.
      • getEndTime

        org.joda.time.DateTime getEndTime()
        Called to get the end time of the recording regardless of segmentationType.
        When the recording is still active, the returned value is null.
        When the recording has been stopped, the returned value is for the time when the recording stopped.

        Returns:
        DateTime Segment end time.
      • getErrorString

        String getErrorString()
        Called to get an error string describing the error, when the recorder state is is RECORDER_STATE_ERROR.

        Returns:
        String Error description string
      • addListener

        IStreamRecorderActionNotify addListener​(IStreamRecorderActionNotify listener)
        Called to add a listener for IStreamRecorderActionNotify events generated by the recorder.
        Multiple listeners can be added. All listeners will be called for each event, in the order in which they were added.

        Parameters:
        listener - An object which implements the IStreamRecorderActionNotify interface
        Returns:
        IStreamRecorderActionNotify The listener object passed in.

        See Also:
        IStreamRecorderActionNotify
      • removeListener

        boolean removeListener​(IStreamRecorderActionNotify listener)
        Called to remove a listener from the the recorder.

        Parameters:
        listener - The listener which is to be removed
        Returns:
        boolean true, if listener was found in list, else false