Class AndroidFileSink
Android-specific implementation of IMediaSink that writes media samples to an MP4 file using the Android MediaMuxer API. Supports file rotation and delayed start.
public class AndroidFileSink : IMediaSink, IDisposable, IUriRotatable
- Inheritance
-
AndroidFileSink
- Implements
- Inherited Members
Constructors
AndroidFileSink()
Create new instance of FileSink
public AndroidFileSink()
Properties
Capabilities
Gets the list of sink capabilities
public List<SinkCapability> Capabilities { get; }
Property Value
IsNetworkSink
Gets whether it's a network or local sink. Necessary to apply longer timeouts in media session processing logic. Always false for this class.
public bool IsNetworkSink { get; }
Property Value
NextUri
Gets or sets the function which returns next URI to be opened. Either Uri or NextUri shall be specified. Necessary for sinks with dynamically generated URI or file chunking. Exact URI syntax depends on the implementation.
public Func<string> NextUri { get; set; }
Property Value
Parameters
Gets or sets sink parameters
public SinkParameters Parameters { get; set; }
Property Value
RotationPeriod
Gets or sets the rotation period in seconds after which the NextUri function will be called and sink will be re-created with the newly provided uri. Value 0 means no rotation.
public int RotationPeriod { get; set; }
Property Value
State
Gets the current sink state.
public MediaState State { get; }
Property Value
UniqueId
Gets or sets the unique identifier for this sink instance.
public Guid UniqueId { get; set; }
Property Value
Uri
Gets or sets the URI (file path) to be opened. Either Uri or NextUri shall be specified. Exact URI syntax depends on the implementation.
public string Uri { get; set; }
Property Value
Methods
AddStream(int, MediaType)
Add media stream for pushing
public void AddStream(int streamIndex, MediaType mediaType)
Parameters
Dispose()
Disposes used resources
public void Dispose()
Open()
Open sink using specified URI
public void Open()
PushMedia(int, VersatileBuffer)
Push media sample
public void PushMedia(int streamIndex, VersatileBuffer sample)
Parameters
streamIndexintStream index
sampleVersatileBufferMedia sample
Start(bool)
Start media pushing
public void Start(bool delayedStart = false)
Parameters
delayedStartboolFalse if media samples are expected immediately. True if first media sample is expected after significant time interval (e.g. tens of seconds)
Stop()
Stop media pushing
public void Stop()
Events
Error
Error occurred
public event EventHandler<ErrorEventArgs> Error
Event Type
StateChanged
Sink state changed
public event EventHandler<MediaState> StateChanged
Event Type
UriRotated
Output URI has been rotated
public event EventHandler<UriRotatedEventArgs> UriRotated