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

[BUG] createVideoMessageFromFullPath return java.lang.NullPointerException #54

Closed
OrrinHatch opened this issue Nov 8, 2024 · 3 comments

Comments

@OrrinHatch
Copy link
Contributor

OpenIM Server Version

3.8.0

Operating System and CPU Architecture

Linux (AMD)

Deployment Method

Docker Deployment

Bug Description and Steps to Reproduce

log:

-----视频消息参数: {"duration": 4676, "snapshotPath": "/data/user/0/com.sass_crm_rn_cn/cache/VideoThumbnails/65e8900a-47b0-4545-a0b5-f5cf49736ba5.jpg", "videoPath": "/data/user/0/com.sass_crm_rn_cn/cache/ImagePicker/0096f501-412a-464d-ac11-2f63dba47a71.mp4", "videoType": "mp4"}

 OpenIMSDKRN.createVideoMessageFromFullPath(options, uuidv4()).then((data: MessageItem) => {
              console.log('创建视频消息,返回结果:', data);
              if(data) {
                sendMessage({ message: data });
              }
            });

android code:

 @ReactMethod
  public void createVideoMessage(ReadableMap options, String operationID, Promise promise) {
    String videoPath = options.getString("videoPath");
    String videoType = options.getString("videoType");
    int duration = options.getInt("duration");
    String snapshotPath = options.getString("snapshotPath");

    String message = Open_im_sdk.createVideoMessage(operationID, videoPath, videoType, duration, snapshotPath);
    try {
      JSONObject obj = JSON.parseObject(message);
      promise.resolve(emitter.convertJsonToMap(obj));
    } catch (Exception e) {
      // error: output: Connot convert argument of type class java.lang.NullPointerException
      promise.resolve(message);
    }
  }

  @ReactMethod
  public void createVideoMessageFromFullPath(ReadableMap options, String operationID, Promise promise) {
    String videoPath = options.getString("videoPath");
    String videoType = options.getString("videoType");
    int duration = options.getInt("duration");
    String snapshotPath = options.getString("snapshotPath");

    String message = Open_im_sdk.createVideoMessage(operationID, videoPath, videoType, duration, snapshotPath);
    try {
      JSONObject obj = JSON.parseObject(message);
      promise.resolve(emitter.convertJsonToMap(obj));
    } catch (Exception e) {
       // error: output: Connot convert argument of type class java.lang.NullPointerException
      promise.resolve(message);
    }
  }

TS Type definition error:
截屏2024-11-08 12 00 33

Screenshots Link

No response

@lgz5689
Copy link
Member

lgz5689 commented Nov 8, 2024

Ok, thank you for reminding me, this type error will be fixed in the next update.

@OrrinHatch
Copy link
Contributor Author

好的,谢谢提醒,下次更新时会修复这个类型错误。

The most important thing is that video messages cannot be created.

@lgz5689
Copy link
Member

lgz5689 commented Nov 11, 2024

  1. Try to use createVideoMessageFromFullPath method, and in the android source code to modify the SDK, the method of confirm createVideoMessageFromFullPath return content at the same time is a JSON string
    image

  2. Regarding the type declaration, this issue has been updated in previous versions to use the latest version
    image

  3. If there is still a problem, please provide more logs about sdk-core, or you try adding more logs manually, otherwise the problem cannot be located.

@lgz5689 lgz5689 closed this as completed Nov 29, 2024
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

2 participants