I am making a audio live streaming application, i have already made the server and the app but i cant figure out how to listen to the audio stream. My stream is in the rtmp format and in video format, but i only want to listen to the audio. I have tried different packages but none of them worked
For example the stream_rtmp package gives me this error: Unhandled Exception: MissingPluginException(No implementation found for method startStream on channel stream_rtmp) and i cant find any solutions for that. (it has nothing to do with video because the error comes up even when the streaming server is offline)
I have found an solution to do this.
Using the flutter_vlc_player package you can create a video player and give it the size of 0 using a SizedBox
final VlcPlayerController controller = VlcPlayerController.network(
'rtmp://url/live',
autoPlay: false
);
@override
void dispose() async {
super.dispose();
await controller.stopRendererScanning();
await controller.dispose();
}
SizedBox(
width: 0,
height: 0,
child: VlcPlayer(
controller: controller,
aspectRatio: 16/9,
placeholder:
Center(child: CircularProgressIndicator()
)),
)
and then you can control the playback using controller.play()
or controller.pause()