startPreview method
Future<void>
startPreview({
- required String imgset,
- required String streamKey,
- IvsQuality quality = IvsQuality.q720,
- CameraType cameraType = CameraType.BACK,
- bool autoReconnect = false,
Starts the camera preview for the broadcast with the specified settings.
imgset
: The image set identifier for the broadcast.streamKey
: The stream key for the broadcast.quality
: The desired broadcast quality, default is IvsQuality.q720.cameraType
: The camera to use for the preview, default is CameraType.BACK.
Returns a Future that completes when the preview has started.
Implementation
Future<void> startPreview({
required String imgset,
required String streamKey,
IvsQuality quality = IvsQuality.q720,
CameraType cameraType = CameraType.BACK,
bool autoReconnect = false,
}) async {
return await broadcater.startPreview(
imgset: imgset,
streamKey: streamKey,
cameraType: cameraType,
quality: quality,
autoReconnect: autoReconnect,
onData: (data) {
if (data is String) {
_parseRawData(jsonDecode(data));
} else {
_parseRawData(data);
}
},
onError: (error) {
// Handle error scenarios here, if needed.
},
);
}