This is a wrap for this github project. Especially the Client part (Stream the camera to a streamingserver)
Streaming
Author: DonManfred (wrapper)
Version: 1.3
This library is Donationware. You can download the library, you can test the library. But if you want to USE the library in your App you need to Donate for it.
Please click here to donate (You can donate any amount you want to donate for the library (or my work building the wrapper))
Streaming
Author: DonManfred (wrapper)
Version: 1.3
- AudioQuality
Methods:- Initialize (samplingRate As Int, bitRate As Int)
Represents a quality for an audio stream.
samplingRate: The sampling rate
bitRate: The bitrate in bit per seconds - IsInitialized As Boolean
- Initialize (samplingRate As Int, bitRate As Int)
- RtspClient
Methods:- Initialize (EventName As String)
- IsInitialized As Boolean
- isStreaming As Boolean
- release
- setCredentials (username As String, password As String) As RtspClientWrapper
If authentication is enabled on the server, you need to call this with a valid login/password pair.
Only implements Digest Access Authentication according to RFC 2069.
username: The login
password: The password - setServerAddress (host As String, port As Int) As RtspClientWrapper
Sets the destination address of the RTSP server.
host: The destination address
port: The destination port - setSession (session As Session) As RtspClientWrapper
The {@link Session} that will be used to stream to the server.
If not called before {@link #startStream()}, a it will be created.
Return type: @return: - setStreamPath (path As String) As RtspClientWrapper
The path to which the stream will be sent to.
path: The path - setTransportMode (mode As Int) As RtspClientWrapper
Call this with {@link #TRANSPORT_TCP} or {@value #TRANSPORT_UDP} to choose the
transport protocol that will be used to send RTP/RTCP packets.
Not ready yet ! - startStream
Connects to the RTSP server to publish the stream, and the effectively starts streaming.
You need to call {@link #setServerAddress(String, int)} and optionally {@link #setSession(Session)}
and {@link #setCredentials(String, String)} before calling this.
Should be called of the main thread ! - stopStream
Stops the stream, and informs the RTSP server.
- Session As Session [read only]
- SessionBuilder
Events:- onBitrateUpdate (bitrate As Long)
- onPreviewStarted ( As )
- onSessionStarted ( As )
- onSessionStopped ( As )
- onSessionconfigured ( As )
- onSesstionError (reason As Int, StreamType As Int, message As String, info As String)
- Initialize (EventName As String) As SessionBuilderWrapper
- IsInitialized As Boolean
- build As Session
Creates a new {@link Session}.
Return type: @return:The new Session - clone As SessionBuilder
Returns a new {@link SessionBuilder} with the same configuration. - setAudioEncoder (encoder As Int) As SessionBuilderWrapper
Sets the audio encoder. - setAudioQuality (quality As AudioQuality) As SessionBuilderWrapper
Sets the audio quality. - setCamera (camera As Int) As SessionBuilderWrapper
- setDestination (destination As String) As SessionBuilderWrapper
Sets the destination of the session. - setFlashEnabled (enabled As Boolean) As SessionBuilderWrapper
- setOrigin (origin As String) As SessionBuilderWrapper
Sets the origin of the session. It appears in the SDP of the session. - setPreviewOrientation (orientation As Int) As SessionBuilderWrapper
Sets the orientation of the preview.
orientation: The orientation of the preview - setSurfaceView (surfaceView As SurfaceView) As SessionBuilderWrapper
Sets the SurfaceView required to preview the video stream. - setTimeToLive (ttl As Int) As SessionBuilderWrapper
- setVideoEncoder (encoder As Int) As SessionBuilderWrapper
Sets the default video encoder. - setVideoQuality (quality As VideoQuality) As SessionBuilderWrapper
Sets the video stream quality.
- AudioEncoder As Int [read only]
Returns the audio encoder set with {@link #setAudioEncoder(int)}. - AudioQuality As AudioQuality [read only]
Returns the AudioQuality set with {@link #setAudioQuality(AudioQuality)}. - Camera As Int [read only]
Returns the id of the {@link android.hardware.Camera} set with {@link #setCamera(int)}. - Context As Context [read only]
Returns the context set with {@link #setContext(Context)} - Destination As String [read only]
Returns the destination ip address set with {@link #setDestination(String)}. - FlashState As Boolean [read only]
Returns the flash state set with {@link #setFlashEnabled(boolean)}. - Origin As String [read only]
Returns the origin ip address set with {@link #setOrigin(String)}. - SurfaceView As SurfaceView [read only]
Returns the SurfaceView set with {@link #setSurfaceView(SurfaceView)}. - TimeToLive As Int [read only]
Returns the time to live set with {@link #setTimeToLive(int)}. - VideoEncoder As Int [read only]
Returns the video encoder set with {@link #setVideoEncoder(int)}. - VideoQuality As VideoQuality [read only]
Returns the VideoQuality set with {@link #setVideoQuality(VideoQuality)}.
- SurfaceView
Fields:- ba As BA
- BringToFront
- DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
- Initialize (EventName As String)
- Invalidate
- Invalidate2 (arg0 As Rect)
- Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- IsInitialized As Boolean
- RemoveView
- RequestFocus As Boolean
- SendToBack
- SetBackgroundImage (arg0 As Bitmap)
- SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
- SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- addMediaCodecSurface (surface As Surface)
- removeMediaCodecSurface
- requestAspectRatio (aspectRatio As Double)
Requests a certain aspect ratio for the preview. You don't have to call this yourself,
the {@link VideoStream} will do it when it's needed. - run
- startGLThread
- AspectRatioMode As Int [write only]
- Background As Drawable
- Color As Int [write only]
- Enabled As Boolean
- Height As Int
- Left As Int
- Parent As Object [read only]
- SurfaceTexture As SurfaceTexture [read only]
- Tag As Object
- Top As Int
- Visible As Boolean
- Width As Int
- VideoQuality
Methods:- Initialize (resX As Int, resY As Int, framerate As Int, bitrate As Int)
Represents a quality for a video stream.
resX: The horizontal resolution
resY: The vertical resolution
framerate: The framerate in frame per seconds
bitrate: The bitrate in bit per seconds - IsInitialized As Boolean
- Initialize (resX As Int, resY As Int, framerate As Int, bitrate As Int)
B4X:
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim sBuilder As SessionBuilder
Private Surface As SurfaceView
Dim client As RtspClient
Private btnStart As Button
Private btnStop As Button
Dim AQuality As AudioQuality
Dim VQuality As VideoQuality
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Layout1")
'session.Initialize("").
AQuality.Initialize(16000,32000)
VQuality.Initialize(176,144,20,500000)
sBuilder.Initialize("rtsp").setOrigin("/videochat").setSurfaceView(Surface).setCamera(1).setTimeToLive(64).setDestination("ipofstreamingserver").setVideoEncoder(1).setVideoQuality(VQuality).setPreviewOrientation(90) .setAudioEncoder(3)
client.Initialize("rtspclient")
client.setSession(sBuilder.build).setServerAddress("ipadress",1900).setStreamPath("/videochat/test") '.setCredentials("username","password")
End Sub
This library is Donationware. You can download the library, you can test the library. But if you want to USE the library in your App you need to Donate for it.
Please click here to donate (You can donate any amount you want to donate for the library (or my work building the wrapper))
Attachments
Last edited: