Skip to content
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

error while exporting gif #46

Open
2 of 7 tasks
bhatakeed opened this issue Sep 28, 2024 · 4 comments
Open
2 of 7 tasks

error while exporting gif #46

bhatakeed opened this issue Sep 28, 2024 · 4 comments

Comments

@bhatakeed
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Package/Plugin version

0.3.0

Platforms

  • Android
  • iOS
  • Linux
  • MacOS
  • Web
  • Windows

Flutter doctor

[✓] Flutter (Channel stable, 3.24.0, on macOS 14.5 23F79 darwin-arm64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] Android Studio (version 2023.2)
[✓] VS Code (version 1.92.2)
[✓] Connected device (5 available)
[✓] Network resources

• No issues found!

Minimal code example

var gif = await controller.exporter.exportGif();
if (gif == null) {
throw Exception();
}

Current Behavior

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: RangeError (length): Invalid value: Not in inclusive range 0..255: 65423
#0 Int32List.[] (dart:typed_data-patch/typed_data_patch.dart)
#1 NeuralQuantizer._inxSearch (package:image/src/util/neural_quantizer.dart:141:22)
#2 NeuralQuantizer.getColorIndex (package:image/src/util/neural_quantizer.dart:68:12)
#3 Quantizer.getIndexImage (package:image/src/util/quantizer.dart:36:14)
#4 ditherImage (package:image/src/filter/dither_image.dart:69:22)
#5 quantize (package:image/src/filter/quantize.dart:26:10)
#6 Exporter._encodeGifWIthTransparency (package:screen_recorder/src/exporter.dart:109:28)
#7 Exporter._exportGif (package:screen_recorder/src/exporter.dart:79:9)

Expected Behavior

it should generate the gif like in android

Steps To Reproduce

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: RangeError (length): Invalid value: Not in inclusive range 0..255: 65423
#0 Int32List.[] (dart:typed_data-patch/typed_data_patch.dart)
#1 NeuralQuantizer._inxSearch (package:image/src/util/neural_quantizer.dart:141:22)
#2 NeuralQuantizer.getColorIndex (package:image/src/util/neural_quantizer.dart:68:12)
#3 Quantizer.getIndexImage (package:image/src/util/quantizer.dart:36:14)
#4 ditherImage (package:image/src/filter/dither_image.dart:69:22)
#5 quantize (package:image/src/filter/quantize.dart:26:10)
#6 Exporter._encodeGifWIthTransparency (package:screen_recorder/src/exporter.dart:109:28)
#7 Exporter._exportGif (package:screen_recorder/src/exporter.dart:79:9)

Aditional information

No response

@BrianTran24
Copy link

I'm facing a similar issue. I'm recording the camera view. Everything works fine on the emulator, but I'm getting errors on a real device.

@ueman
Copy link
Contributor

ueman commented Sep 30, 2024

Problems with platform views are a known issue: https://github.com/Baseflow/screenrecorder?tab=readme-ov-file#%EF%B8%8F-known-issues-and-limitations It's nothing this library can fix, since it's a limitation of Flutter itself.

@BrianTran24
Copy link

@ueman I agree with your point, however, I still maintain that the package is buggy when running on a real device. I've verified this by downloading the example provided by the package. It still exhibits the same error, whereas the emulator works fine.
I'm tesed on Iphon 12 Pro.

@BrianTran24
Copy link

@bhatakeed @ueman
After several hours, I discovered that the issue lies in the image format of the iPhone. Images captured from the iPhone return in a 64-bit color image format. Meanwhile, the image package that the library depends on only supports 32-bit color. I have fixed this in a this pull request #47 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants