Class ICameraController


  • public class ICameraController
    extends java.lang.Object
    An ICamera controller to control start, stop, pause, and some status with the given camera instance.

    Note: this class is not thread-safe, so when it's used in multi-threading environment, the developer should handle the threading issue.

    Author:
    katherine
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ICamera build()
      Returns the immutable camera instance that the controller to build with.
      boolean isPaused()
      Returns whether camera is paused.
      boolean isRecording()
      Returns whether camera is recording.
      boolean isStopped()
      Returns whether camera is stopped.
      static ICameraController of​(ICamera owner)
      Returns the controller instance with the given camera
      void pause()
      Pauses recording.
      void requestCamera()
      Ask user for permissions to get media stream from camera and microphone.
      void resume()
      Resumes recording.
      void snapshot()
      Takes a snapshot.
      void snapshot​(double delay)
      Takes a snapshot.
      void start()
      Starts recording.
      void start​(double delay)
      Starts recording.
      void stop()
      Stops recording.
      void stopStreaming()
      Stops getting media stream from user's camera and microphone.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • start

        public void start()
        Starts recording.
      • start

        public void start​(double delay)
        Starts recording. When camera is off (never call $requestCamera() before), after calling this method, it will request camera permission from user at first, the delay parameter indicates the duration between user permission obtaining and record starting in seconds.
        Parameters:
        delay - the duration between user permission obtaining and record starting in seconds, only meaningful when camera is off
      • stop

        public void stop()
        Stops recording.
      • pause

        public void pause()
        Pauses recording.
      • resume

        public void resume()
        Resumes recording.
      • requestCamera

        public void requestCamera()
        Ask user for permissions to get media stream from camera and microphone.
      • stopStreaming

        public void stopStreaming()
        Stops getting media stream from user's camera and microphone.
      • snapshot

        public void snapshot()
        Takes a snapshot.
      • snapshot

        public void snapshot​(double delay)
        Takes a snapshot. When camera is off (never call $requestCamera() before), after calling this method, it will request camera permission from user at first, the delay parameter indicates the duration between user permission obtaining and taking snapshot in seconds.
        Parameters:
        delay - the duration between user permission obtaining and taking snapshot in seconds, only meaningful when camera is off
      • of

        public static ICameraController of​(ICamera owner)
        Returns the controller instance with the given camera
        Parameters:
        owner - The controller to control with
      • build

        public ICamera build()
        Returns the immutable camera instance that the controller to build with.
      • isStopped

        public boolean isStopped()
        Returns whether camera is stopped.
        Returns:
        true if the camera is stopped.
      • isPaused

        public boolean isPaused()
        Returns whether camera is paused.
        Returns:
        true if the camera is paused.
      • isRecording

        public boolean isRecording()
        Returns whether camera is recording.
        Returns:
        true if the camera is recording.