createStream method Null safety
Create a new streaming Mount-point type = rtp|live|ondemand|rtsp rtp = stream originated by an external tool (e.g., gstreamer or ffmpeg) and sent to the plugin via RTP live = local file streamed live to multiple viewers (multiple viewers = same streaming context) ondemand = local file streamed on-demand to a single listener (multiple viewers = different streaming contexts) rtsp = stream originated by an external RTSP feed (only available if libcurl support was compiled)
Implementation
Future<StreamingMount?> createStream(String type,
{String? name, String? description, String? metadata, int? id, String? pin, List<CreateMediaItem>? media, String? secret, bool? isPrivate, bool? permanent, String? adminKey}) async {
var payload = {
"request": "create",
"type": type,
if (adminKey != null) "admin_key": adminKey,
if (id != null) "id": id,
if (name != null) "name": name,
if (description != null) "description": description,
if (metadata != null) "metadata": metadata,
if (secret != null) "secret": secret,
if (pin != null) "pin": pin,
if (isPrivate != null) "is_private": isPrivate,
if (permanent != null) "permanent": permanent,
if (media != null) "media": media,
};
var response = await this.send(data: payload);
if (response['streaming'] == 'created') {
return StreamingMount.fromJson(response);
}
return null;
}