Ricoh Theta Sc2 Live Preview Tester With Flutter
RICOH THETA SC2 Live Preview Tester
For V/Z1, see my other project using dio as the HTTP library.
Save Frames to Disk for Inspection
Use Within Flutter
Usage
- create a stream (for Flutter, it is easier to use StreamController
- pass stream to library
- specify number of frames to capture
- listen to stream and either write frames to disk or display to screen
Example
Code example with Flutter
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
StreamController controller = StreamController();
sc2GetLivePreview(controller, frames: 300);
return Scaffold(
// your ui
//
Expanded(
flex: 8,
child: StreamBuilder(
stream: controller.stream,
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.hasData) {
var imageData = Uint8List.fromList(snapshot.data);
return Image.memory(
imageData,
gaplessPlayback: true,
);
} else {
return Container();
}
}),
),