MultiFromFile
Created by pedro on 17/7/24.
Experiment class.
Support multiple streams in rtmp and rtsp at same time. You must set the same number of ConnectChecker that you want use.
For example. 2 RTMP and 1 RTSP: stream1, stream2, stream3 (stream1 and stream2 are ConnectChecker for RTMP. stream3 is ConnectChecker for RTSP)
MultiFromFile multiFromFile = new MultiFromFile(context, new ConnectChecker[]{ stream1, stream2 }, new ConnectChecker[]{ stream3 });
You can set an empty array or null if you don't want use a protocol new MultiFromFile(context, new ConnectChecker[]{ stream1, stream2 }, null); //RTSP protocol is not used
In order to use start, stop and other calls you must send type of stream and index to execute it. Example (using previous example interfaces):
multiFromFile.startStream(MultiType.RTMP, 1, endpoint); //stream2 is started multiFromFile.stopStream(MultiType.RTSP, 0); //stream3 is stopped multiFromFile.getStreamClient(MultiType.RTMP, 0).retry(delay, reason, backupUrl) //retry stream1
NOTE: If you call this methods nothing is executed:
multiFromFile.startStream(endpoint); multiFromFile.stopStream();
The rest of methods without MultiType and index means that you will execute that command in all streams. Read class code if you need info about any method.
Constructors
Functions
Force stream to work with fps selected in prepareVideo method. Must be called before prepareVideo. This is not recommend because could produce fps problems.
Get record state.
Set a callback to know errors related with Video/Audio encoders
If you want reproduce video in loop. This mode clear all effects or stream object when video is restarted. TODO: No clear it.
Set the mode to calculate timestamp. By default CLOCK. Must be called before startRecord/startStream or it will be ignored.
Set video bitrate of H264 in bits per second while stream.
Starts recording a MP4 video.
Need be called after @prepareVideo.
Stop record MP4 video started with @startRecord. If you don't call it file will be unreadable.
Stop stream started with @startStream.