easemob / react-native-chat-sdk

MIT License
2 stars 10 forks source link

Failed to send video #27

Closed ahmedShaheer3 closed 1 year ago

ahmedShaheer3 commented 1 year ago

Description

Hey there i am sending video this is my code const uploadVideoFile = (result: ImagePickerResponse) => { console.log('image picker result:', result); if (result.assets) { if ((result.assets[result.assets.length - 1].fileSize as any) > 25000000) { return Toast.show('Image should be less then 25 mb', Toast.LONG); } const filePath = Platform.OS === 'ios' ? result.assets[0].uri?.replace('file://', '') : result.assets[0].uri?.replace('file://', ''); console.log('filePathc boefore sending image', filePath);

  // createThumbnail for video
  createThumbnail({
    url: result.assets[0].uri as string,
    timeStamp: 1000,
  })
    .then(response => {
      console.log('thunbnail response', response);
      const thumbnailPath =
        Platform.OS === 'ios'
          ? response?.path?.replace('file://', '')
          : response?.path?.replace('file://', '');
      //creating image message
      const msg = ChatMessage.createVideoMessage(convId, filePath, convType, {
        displayName: result?.assets[0]?.fileName,
        thumbnailLocalPath: `${thumbnailPath}.jpeg`,
        duration: 5,
        width: 200,
        height: 200,
      });
      setUploaderIndicator(true);
      // sending agora message
      sendingAgoraMessage({msg, indicator: true, notificationText: 'Video', msgType: 'Video'});
    })
    .catch(err => {
      console.log('error thumbnai ', err);
      setUploaderIndicator(true);
    });
} else if (result.errorCode) {
  console.log(result.errorCode);
  if (result.errorCode === 'permission') {
    return Toast.show('You need to enable camera permission from setting', Toast.LONG);
  }
  return Toast.show('Unable to upload picture try again later', Toast.LONG);
} else if (result.didCancel) {
  console.debug(result.didCancel);
  return;
}

};

but app crashed when it starts to send

Version

1.1.1

Output of npx react-native info

System: OS: macOS 13.0 CPU: (8) arm64 Apple M2 Memory: 112.17 MB / 8.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 19.7.0 - /opt/homebrew/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 9.5.0 - /opt/homebrew/bin/npm Watchman: 2023.03.06.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.12.0 - /Users/algoacepc/.rvm/gems/ruby-2.7.6/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2022.1 AI-221.6008.13.2211.9619390 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 11.0.18 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.6 => 0.70.6

Steps to reproduce

npx react-native run-android

yarn instal react-native-agora-chat

       const msg = ChatMessage.createVideoMessage(convId, filePath, convType, {
         displayName: result?.assets[0]?.fileName,
         thumbnailLocalPath: `${thumbnailPath}.jpeg`,
         duration: 5,
         width: 200,
         height: 200,
       });

Snack, code example, screenshot, or link to a repository

https://github.com

Platform

SimulatorOrDevice

iOSVersion

AsteriskZuo commented 1 year ago

You are advised to use android studio to view more detailed information in debug mode.

AsteriskZuo commented 1 year ago

You can also provide sample applications with minimal recurrence of the problem.

AsteriskZuo commented 1 year ago

Currently, the problem has been located, and it is an android native sdk problem. The next upgrade is resolved. Please wait patiently.

ahmedShaheer3 commented 1 year ago

thanku

AsteriskZuo commented 1 year ago

this is latest send and receive message for react-native-chat-agora demo. here

AsteriskZuo commented 1 year ago

fiexed 60ce60d4ec0fa40b7f3d85c0aaa63857ba0f4084

ahmedShaheer3 commented 1 year ago

is this fixed have been merged in the main brach because i am using agora-chat 1.1.1 or do i edit myself in the node module

ahmedShaheer3 commented 1 year ago

hey there iam using version 1.1.1 but still its getting crashed on sending video message

ahmedShaheer3 commented 1 year ago

hey there i have tested 1.1.2beta4 sending video message working fine but fetchHistoryMessages() is not working as expected its not getting tha latest conversation messages only old message are coming although i am seeing tha latest message in get LastMessage()

AsteriskZuo commented 1 year ago

hey there i have tested 1.1.2beta4 sending video message working fine but fetchHistoryMessages() is not working as expected its not getting tha latest conversation messages only old message are coming although i am seeing tha latest message in get LastMessage()

This is a separate issue and is not recommended here. In addition, please describe the method invocation details in detail, as well as the parameters.