Repository navigation
[camera_avfoundation] stopVideoRecording may wait indefinitely in some cases #132016
Copy link
Copy link
Closed
flutter/packages
#7065Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listfound in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.13Found to occur in 3.13Found to occur in 3.13has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: cameraThe camera pluginThe camera pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-iosOwned by iOS platform teamOwned by iOS platform teamtriaged-iosTriaged by iOS platform teamTriaged by iOS platform team
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
Run test sample.
Expected results
It should continue to update text up to "99 delete".
Actual results
It stops with text "... stop" which means it is indefinitely waiting on stopVideoRecording. This is because stopVideoRecordingWithResult will not send any result if _videoWriter.status is AVAssetWriterStatusUnknown:
https://github.com/flutter/packages/blob/d7ee75ad59ad7bc45e659d0599e935e9e7981ea1/packages/camera/camera_avfoundation/ios/Classes/FLTCam.m#L683-L707
Code sample
Code sample
import "dart:io";
import "package:flutter/material.dart";
import "package:camera/camera.dart";
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override Widget build(BuildContext context) => const MaterialApp(home: MyHomePage());
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
bool loading = true;
String where = "";
late CameraController camera_cont;
@override void dispose() {
camera_cont.dispose();
super.dispose();
}
@override void initState() {
super.initState();
init_camera();
}
init_camera() async {
final cameras = await availableCameras();
camera_cont = CameraController(cameras.firstWhere((camera) => camera.lensDirection == CameraLensDirection.back), ResolutionPreset.ultraHigh);
await camera_cont.initialize();
setState(() => loading = false);
await camera_cont.prepareForVideoRecording();
for(int i = 0; i < 100; i++)
{
setState(() => where = "$i start");
await camera_cont.startVideoRecording();
setState(() => where = "$i stop");
final file = await camera_cont.stopVideoRecording();
setState(() => where = "$i delete");
await File(file.path).delete();
}
}
@override Widget build(BuildContext context)
{
if(loading)return const Center(child: CircularProgressIndicator());
else return Stack(
alignment: Alignment.center,
children: [
CameraPreview(camera_cont),
Text(where),
],
);
}
}Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.10.6, on macOS 13.5 22G74 darwin-x64)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listfound in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.13Found to occur in 3.13Found to occur in 3.13has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: cameraThe camera pluginThe camera pluginpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-iosOwned by iOS platform teamOwned by iOS platform teamtriaged-iosTriaged by iOS platform teamTriaged by iOS platform team
Activity
danagbemava-nc commentedon Aug 7, 2023
Reproducible using the code sample provided above.
flutter doctor -v
flutter-triage-bot commentedon Dec 25, 2023
This issue is assigned to @hellohuanlin but has had no recent status updates. Please consider unassigning this issue if it is not going to be addressed in the near future. This allows people to have a clearer picture of what work is actually planned. Thanks!
2 remaining items
[camera_avfoundation] fix stopVideoRecording waiting indefinitely and…
github-actions commentedon Aug 19, 2024
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.[camera_avfoundation] fix stopVideoRecording waiting indefinitely and…
[camera_avfoundation] fix stopVideoRecording waiting indefinitely and…