GetStream / stream-chat-flutter

Flutter Chat SDK - Build your own chat app experience using Dart, Flutter and the Stream Chat Messaging API.
https://getstream.io/chat/sdk/flutter/
Other
937 stars 342 forks source link

Can't get thumbUrl when send video in iOS #2023

Open anhdo9797 opened 2 months ago

anhdo9797 commented 2 months ago

Which packages are you using?

stream_chat_flutter

On what platforms did you experience the issue?

iOS

What version are you using?

8.0.0

What happened?

I'm having trouble loading thumbnails after successfully uploading videos.

This is my code send video attachment

Future<void> _attachmentImageCallback(List<String> paths) async {
    List<Attachment> attachments = [];

    await Future.wait(paths.map((path) async {
      final uri = Uri.parse(path);
      File file = File(uri.path);

      final fileSize = await file.length();

      final attach = Attachment(
        type: AttachmentType.video,
        file: AttachmentFile(
          size: fileSize,
          path: file.path,
        ),
      );

      if (attach != null) {
        attachments.add(attach);
      }
    }).toList());

    if (attachments.isNotEmpty) {
      await controller.channel.value?.sendMessage(
        Message(
          attachments: attachments,
        ),
      );
    }
  }

The thumbnail appears as iOS image

android image

Debug console


════════ Exception caught by image resource service ════════════════════════════
The following HttpExceptionWithStatus was thrown resolving an image codec:
HttpException: Invalid statusCode: 404, uri = https://singapore.stream-io-cdn.com/1300380/images/f4dc0cb8-1337-4a08-91e6-00049c9760e9.575BEFAF-EA88-4FDE-B68A-113EDA8A5A3F_L0.MOV.jpg?Key-Pair-****

Steps to reproduce

**My code sent attachment**

 Future<void> _attachmentImageCallback(List<String> paths) async {
    List<Attachment> attachments = [];

    await Future.wait(paths.map((path) async {
      final uri = Uri.parse(path);
      File file = File(uri.path);

      final fileSize = await file.length();

      final attach = Attachment(
        type: AttachmentType.video,
        file: AttachmentFile(
          size: fileSize,
          path: file.path,
        ),
      );

      if (attach != null) {
        attachments.add(attach);
      }
    }).toList());

    if (attachments.isNotEmpty) {
      await controller.channel.value?.sendMessage(
        Message(
          attachments: attachments,
        ),
      );
    }
  }

### Supporting info to reproduce

_No response_

### Relevant log output

```shell
════════ Exception caught by image resource service ════════════════════════════
The following HttpExceptionWithStatus was thrown resolving an image codec:
HttpException: Invalid statusCode: 404, uri = https://singapore.stream-io-cdn.com/1300380/images/f4dc0cb8-1337-4a08-91e6-00049c9760e9.575BEFAF-EA88-4FDE-B68A-113EDA8A5A3F_L0.MOV.jpg?Key-Pair-****

### Flutter analyze output

_No response_

### Flutter doctor output

```shell
[✓] Flutter (Channel stable, 3.19.6, on macOS 14.4 23E214 darwin-arm64, locale en-VN)
    • Flutter version 3.19.6 on channel stable at /Users/phuocanh/fvm/versions/3.19.6
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (5 months ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1

[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users/phuocanh/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] VS Code (version 1.92.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.96.0

[✓] Connected device (5 available)
    • SM N950U1 (mobile) • ce0917199897c0390d7e                 • android-arm64  • Android 9 (API 28)
    • PhuocAnh (mobile)  • 00008101-0019254814D8001E            • ios            • iOS 17.3 21D50
    • iPhone 12 (mobile) • EAC2D893-F9F4-4E69-AD9E-8F8DF0BBA8B8 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-0 (simulator)
    • macOS (desktop)    • macos                                • darwin-arm64   • macOS 14.4 23E214 darwin-arm64
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 128.0.6613.120

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Code of Conduct

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 20 days with no activity.

github-actions[bot] commented 1 month ago

This issue was closed because it has been inactive for 7 days since being marked as stale.

anhdo9797 commented 3 weeks ago

Can someone help me?

github-actions[bot] commented 5 days ago

This issue is stale because it has been open for 20 days with no activity.