[Issue]: Encountering an Exception when streaming Time in Flutter. Error Message: 'PlatformException(failed_to_start_stream, java.lang.IllegalArgumentException: Only one audio stream is supported by FLV, null, null)'. This issue is a significant roadblock in our current project, rendering it unable to run. Seeking assistance from the community to resolve this critical issue. Any support in resolving this matter would be greatly appreciated
////creating live stream controller instance
ApiVideoLiveStreamController createLiveStreamController(
BuildContext context) {
return ApiVideoLiveStreamController(
initialAudioConfig: config.audio,
initialVideoConfig: config.video,
onConnectionSuccess: () {
log('Connection succeeded');
},
onConnectionFailed: (error) {
log('on error failed1: $error');
Utils.showCustomDialog(context, 'Connection failed',
"Something went wrong, Please try again later"
// error
);
if (isStreaming) {
manualStopButtonClicked(context);
} else {
setIsStreaming(false);
}
// if (mounted) {
// }
},
onDisconnection: () async {
log('on error failed:2 ');
// Utils.snackBar('Disconnected', context);
// if (mounted) {
if (isStreaming) {
manualStopButtonClicked(context);
} else {
setIsStreaming(false);
}
// }
},
onError: (error) {
log('on error failed:3 $error');
// Get error such as missing permission,...
Utils.showCustomDialog(
context, 'Error', 'Something went wrong, Please try again later');
// if (mounted) {
if (isStreaming) {
manualStopButtonClicked(context);
} else {
setIsStreaming(false);
}
// }
});
}
//initialize controller
await _controller.initialize().catchError((exception) {
Utils.snackBar('Something went wrong, Please try again Later', context);
});
This the code for start stream
void onStartStreamingButtonPressed(BuildContext context) async {
_isStreamingStarted = true;
await _controller.setAudioConfig(config.audio);
startStreaming().then((_) {
setIsStreaming(true);
_isStreamingStarted = false;
notifyListeners();
startTimer();
Utils.snackBar("Streaming Started..!", context);
}).catchError((error) {
_isStreamingStarted = false;
if (error is PlatformException) {
log("strat stream 1 $error");
;
Utils.showCustomDialog(context, "Error",
"Something went wrong in server side, Please try again Later");
} else {
log("strat stream 2 $error");
Utils.showCustomDialog(
context, "Error", "Something went wrong , Please try again Later");
}
});
notifyListeners();
}
0 comments:
Post a Comment
Thanks