CamerAwesome
CamerAwesome copied to clipboard
Call to VideoController.stopRecordingVideo() never finishes
Steps to Reproduce
- Run code at bottom of issue
- Try starting then stopping video
Expected results
Video stops
Actual results
Async call to VideoController.stopRecordingVideo() never finishes
About your device
Brand | Model | OS |
---|---|---|
Apple | iPhone Xs | 14.2 |
Code:
import 'package:flutter/material.dart';
import 'dart:io';
import 'package:camerawesome/camerawesome_plugin.dart';
import 'package:path_provider/path_provider.dart';
class WalkCamera extends StatefulWidget {
WalkCamera({Key key}) : super(key: key);
@override
_WalkCameraState createState() => _WalkCameraState();
}
class _WalkCameraState extends State<WalkCamera> {
ValueNotifier<Sensors> _sensor = ValueNotifier(Sensors.BACK);
ValueNotifier<CaptureModes> _captureMode = ValueNotifier(CaptureModes.VIDEO);
ValueNotifier<Size> _photoSize = ValueNotifier(null);
VideoController _videoController = new VideoController();
List<Size> availableSizes;
bool recording = false;
String videoPath;
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
recordVideo() async {
setState(() {
recording = true;
});
final Directory extDir = await getTemporaryDirectory();
videoPath = '${extDir.path}/${DateTime.now().millisecondsSinceEpoch}.mp4';
print('Recording $videoPath');
await _videoController.recordVideo(videoPath);
}
stopVideo() async {
setState(() {
recording = false;
});
print('Attempting stop...');
await _videoController.stopRecordingVideo();
print('Recorded $videoPath');
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black,
body: SafeArea(
bottom: false,
child: Column(
children: [
Expanded(
child: CameraAwesome(
selectDefaultSize: (availableSizes) {
this.availableSizes = availableSizes;
return availableSizes[0];
},
photoSize: _photoSize,
sensor: _sensor,
captureMode: _captureMode,
),
),
Container(
height: 100.0,
child: RaisedButton(
child:
Text(recording ? 'Stop Recording' : 'Start Recording'),
onPressed: () {
if (recording)
stopVideo();
else
recordVideo();
},
),
)
],
)));
}
}
Still having the same issue, is there a reason why this issue occurs?
This issue should be fixed with #145 Feel free to reopen if not 👍