public abstract class VideoStream extends MediaStream
MODE_MEDIACODEC_API, MODE_MEDIACODEC_API_2, MODE_MEDIARECORDER_API, PIPE_API_LS, PIPE_API_PFD| Constructor and Description |
|---|
VideoStream()
Don't use this class directly.
|
VideoStream(int camera)
Don't use this class directly
|
| Modifier and Type | Method and Description |
|---|---|
void |
configure()
Configures the stream.
|
int |
getCamera()
Returns the id of the camera currently selected.
|
boolean |
getFlashState()
Indicates whether or not the flash of the phone is on.
|
abstract java.lang.String |
getSessionDescription()
Returns a description of the stream using SDP.
|
VideoQuality |
getVideoQuality()
Returns the quality of the stream.
|
void |
setCamera(int camera)
Sets the camera that will be used to capture video.
|
void |
setFlashState(boolean state)
Turns the LED on or off if phone has one.
|
void |
setPreferences(SharedPreferences prefs)
Some data (SPS and PPS params) needs to be stored when
getSessionDescription() is called |
void |
setPreviewOrientation(int orientation)
Sets the orientation of the preview.
|
void |
setSurfaceView(SurfaceView view)
Sets a Surface to show a preview of recorded media (video).
|
void |
setVideoQuality(VideoQuality videoQuality)
Sets the configuration of the stream.
|
void |
start()
Starts the stream.
|
void |
startPreview() |
void |
stop()
Stops the stream.
|
void |
stopPreview()
Stops the preview.
|
void |
switchCamera()
Switch between the front facing and the back facing camera of the phone.
|
void |
toggleFlash()
Toggles the LED of the phone if it has one.
|
getBitrate, getDestinationPorts, getLocalPorts, getPacketizer, getSSRC, getStreamingMethod, isStreaming, setDestinationAddress, setDestinationPorts, setDestinationPorts, setOutputStream, setStreamingMethod, setTimeToLivepublic VideoStream()
public VideoStream(int camera)
camera - Can be either CameraInfo.CAMERA_FACING_BACK or CameraInfo.CAMERA_FACING_FRONTpublic void setCamera(int camera)
camera - Can be either CameraInfo.CAMERA_FACING_BACK or CameraInfo.CAMERA_FACING_FRONTpublic void switchCamera()
throws java.lang.RuntimeException,
java.io.IOException
startPreview() has been called, the preview will be briefly interrupted.
If start() has been called, the stream will be briefly interrupted.
You should not call this method from the main thread if you are already streaming.java.io.IOExceptionjava.lang.RuntimeExceptionpublic int getCamera()
CameraInfo#CAMERA_FACING_BACK or
CameraInfo#CAMERA_FACING_FRONT.public void setSurfaceView(SurfaceView view)
start().public void setFlashState(boolean state)
public void toggleFlash()
getFlashState().public boolean getFlashState()
public void setPreviewOrientation(int orientation)
orientation - The orientation of the previewpublic void setVideoQuality(VideoQuality videoQuality)
configure().videoQuality - Quality of the streampublic VideoQuality getVideoQuality()
public void setPreferences(SharedPreferences prefs)
getSessionDescription() is calledprefs - The SharedPreferences that will be used to save SPS and PPS parameterspublic void configure()
throws java.lang.IllegalStateException,
java.io.IOException
getSessionDescription()
to apply your configuration of the stream.configure in interface Streamconfigure in class MediaStreamjava.lang.IllegalStateExceptionjava.io.IOExceptionpublic void start()
throws java.lang.IllegalStateException,
java.io.IOException
startPreview() has not already been called.start in interface Streamstart in class MediaStreamjava.lang.IllegalStateExceptionjava.io.IOExceptionpublic void stop()
stop in interface Streamstop in class MediaStreampublic void startPreview()
throws CameraInUseException,
InvalidSurfaceException,
java.lang.RuntimeException
CameraInUseExceptionInvalidSurfaceExceptionjava.lang.RuntimeExceptionpublic void stopPreview()
public abstract java.lang.String getSessionDescription()
throws java.lang.IllegalStateException
Stream.configure().getSessionDescription in interface StreamgetSessionDescription in class MediaStreamjava.lang.IllegalStateException - Thrown when Stream.configure() wa not called.