stream-chat-react-native icon indicating copy to clipboard operation
stream-chat-react-native copied to clipboard

uploadfile does not return thumb_url for videos

Open semihcihan opened this issue 4 years ago • 4 comments

Describe the bug uploadfile API does not return thumb_url but only the file url. Therefore all uploaded videos through stream-chat-react-native or REST API shown black in the chat feed because thumb_url is undefined.

Dev environment info (please complete/provide the following information):

"stream-chat-react-native": "4.12.0" "react-native": "0.67.3"

To Reproduce Steps to reproduce the behavior:

Upload a video by selecting a video from the default image/video picker on chat from the react native client. OR Upload a video through the REST API.

var axios = require('axios');
var FormData = require('form-data');
var fs = require('fs');
var data = new FormData();
data.append('file', fs.createReadStream('some_video_file'));
data.append('contentType', 'video/mp4'); // I've tried 'video' and some other options as well 
data.append('type', 'video/mp4'); // I've tried 'video' and some other options as well 
data.append('name', 'name_of_the_video');

var config = {
  method: 'post',
  url: '...',
  headers: { 
    'Authorization': '...', 
    'stream-auth-type': 'jwt', 
    ...data.getHeaders()
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

Here is the response we get, without 'thumb_url'

{
    "duration": "2222.22ms",
    "file": "getstreamurltothevideo"
}

Expected behavior When a video is uploaded, we should get back a thumb_url as stated in the docs.

semihcihan avatar Aug 01 '22 09:08 semihcihan

Hey @semihcihan, to get the thumb_url you need to be in the CDN v2. What version of CDN are you currently using?

Thanks :)

khushal87 avatar Aug 01 '22 11:08 khushal87

Hi @khushal87 I assume I'm not using CDN v2 since it's not returning thumb_url. But it's just an assumption as I can't find anything regarding the version of the CDN, in the dashboard nor in the docs to get it. The only thing I see is, being able to use a custom CDN. Can you please point me in the right direction to read more about this?

semihcihan avatar Aug 01 '22 11:08 semihcihan

Screenshot_20220801_160115

I guess this is my CDN version. But still have the same issue, all videos in the chat have black preview

DreamakerDimas avatar Aug 01 '22 13:08 DreamakerDimas

@khushal87 Why closed? The issue was solved?

DreamakerDimas avatar Aug 03 '22 11:08 DreamakerDimas