-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[image_picker] "Camera is already in use" error message #84521
Comments
Hi @jcblancomartinez minimal code sampleimport 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:image_picker/image_picker.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Material App',
home: Test(),
);
}
}
class Test extends StatelessWidget {
final ImagePicker _picker = ImagePicker();
@override
Widget build(BuildContext context) {
return Scaffold(
body: IconButton(
icon: Icon(Icons.video_camera_back),
onPressed: () {
showDialog(
context: context,
builder: (BuildContext context) =>
_buildPopupDialogVideo(context),
);
}));
}
Widget _buildPopupDialogVideo(BuildContext context) {
return new AlertDialog(
title: const Text('Select Video'),
content: new Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start),
actions: <Widget>[
new TextButton(
onPressed: () {
Navigator.pop(context);
_onVideoButtonPressed(ImageSource.gallery);
},
child: const Text('From Gallery'),
),
new TextButton(
onPressed: () {
Navigator.pop(context);
_onVideoButtonPressed(ImageSource.camera);
},
child: const Text('Record Video'),
),
],
);
}
void _onVideoButtonPressed(ImageSource source) async {
PickedFile? _pickedFile = await _picker.getVideo(
source: source, maxDuration: const Duration(minutes: 30));
print(_pickedFile?.path);
}
}
flutter doctor -v[✓] Flutter (Channel stable, 2.2.2, on Microsoft Windows [Version 10.0.19043.1055], locale en-US)
• Flutter version 2.2.2 at C:\Users\Taha\Code\flutter_stable
• Framework revision d79295af24 (3 days ago), 2021-06-11 08:56:01 -0700
• Engine revision 91c9fc8fe0
• Dart version 2.13.3
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\Taha\Code\SDK
• Platform android-30, build-tools 30.0.3
• ANDROID_SDK_ROOT = C:\Users\Taha\Code\SDK
• Java binary at: C:\Users\Taha\Code\openjdk\bin\java.exe
• Java version OpenJDK Runtime Environment (build 1.8.0-262-b10)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.10.1)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.10.31402.337
• Windows 10 SDK version 10.0.19041.0
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[✓] IntelliJ IDEA Community Edition (version 2021.1)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.1.1
• Flutter plugin version 57.0.5
• Dart plugin version 211.7233
[✓] VS Code (version 1.57.0)
• VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.23.0
[✓] Connected device (4 available)
• IN2011 (mobile) • c9d8ee0c • android-arm64 • Android 11 (API 30)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19043.1055]
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.101
• Edge (web) • edge • web-javascript • Microsoft Edge 91.0.864.48
! Doctor found issues in 1 category. I'm unable to reproduce the issue on Android 10 and 11 devices. Is this specific to Android 8? |
Hi @TahaTesser, I'm not able to reproduce the issue with Android 8.1. emulator either. Is there any chance you can have access to a device with Android 8.1.? Thanks. |
Hi @jcblancomartinez |
Hi @TahaTesser , Do you see anything strange in Logcat logs that could give us some hint about what's going on? Thanks. |
Steps to Reproduce
BQ Aquaris V (Android 8.1.0) and image_picker 0.8.0+3. It works as expected with emulator (Android 11.0).
Expected results:
Record button works any time without getting "Camera is already in use" error message
Actual results:
Recording of the video doesn't work. We get a "Camera is already in use" error message.
Logs
Logs accessed using Logcat:
The text was updated successfully, but these errors were encountered: