streaming_radio_flutter_plugin 1.0.0 streaming_radio_flutter_plugin: ^1.0.0 copied to clipboard
A streaming audio player plugin
import 'package:flutter/material.dart';
import 'package:streaming_radio_flutter_plugin_example_project/StreamingController.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
var streamingController = StreamingController();
@override
void initState() {
super.initState();
streamingController.config(url:"http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p");
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Column(
children: <Widget>[
FlatButton(
onPressed: () { streamingController.play(); },
child: Text( "Play",),
),
FlatButton(
onPressed: () { streamingController.pause(); },
child: Text( "Pause",),
),
FlatButton(
onPressed: () { streamingController.stop(); },
child: Text( "Stop",),
),
StreamBuilder(
stream: streamingController.streamingController.stream,
builder: (BuildContext context, snapshot) {
if(snapshot.hasData){
return new Text(
snapshot.data,
style: Theme.of(context).textTheme.display1,
);
}else{
return new Text(
"",
style: Theme.of(context).textTheme.display1,
);
}
},
),
],
),
),
),
);
}
}