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

Sending media #13

Open
mpwsh opened this issue Jan 21, 2019 · 0 comments
Open

Sending media #13

mpwsh opened this issue Jan 21, 2019 · 0 comments

Comments

@mpwsh
Copy link

mpwsh commented Jan 21, 2019

Hi wiomoc, i'm having a hard time figuring out how to send media files with the new version of the library.
The media.rs example is not working anymore, because of some deprecated calls.
Can you give me a hint on how to do it now?

let mut file = Vec::new();
            let contents = File::open("path/to/image.jpg").unwrap();
            let contents_2 = contents.try_clone().unwrap();
            contents_2.read_to_string(&mut file).unwrap();

            let connection0 = connection.clone();
            let (thumbnail, size) = crypto::encrypt_media_message(MediaType::Video, &file);
            let thumbnail = Arc::new(thumbnail);

            connection0.request_file_upload(&file, MediaType::Video, Box::new(move |file_info| {                
               connection0.send_message(ChatMessageContent::Image(file_info.unwrap(), size, thumbnail.to_vec()), accepted_jid);
        }));

tried this way but its not working

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

1 participant