Media Attachment Guide

Media Attachment is a general purpose class used across GetSocial SDK to attach images, videos and GIFs.

Supported Formats and Size Limitations

Supported Formats Size Limitation
Images jpg, png, webp, cr2, tif, bmp 20 Mb
GIFs gif 20 Mb
Videos mp4, m4v, mkv, webm, mov, avi, wmv, mpg, flv, 3gp 20 Mb

If media size is bigger than the size limitation -it is ignored.

Attach Images

The image can be attached as a binary file, or as URL reference. Binary files are uploaded to GetSocial backend and optimized to serve back to the SDK.

1
2
3
4
val activityImage : Bitmap = ... // Load image here
val imageAttachment = MediaAttachment.image(activityImage)

val urlAttachment = MediaAttachment.imageUrl("https://docs.getsocial.im/images/logo.png")
1
2
3
4
let postImage: UIImage = ... // Load image here
let imageAttachment = MediaAttachment.image(postImage);

let urlAttachment = MediaAttachment.imageUrl("https://docs.getsocial.im/images/logo.png") 
1
2
3
4
Texture2D postImage = ...; // load image here
var imageAttachment = MediaAttachment.WithImage(postImage);

var urlAttachment = MediaAttachment.WithImageUrl("https://docs.getsocial.im/images/logo.png");
1
2
3
4
var postImage = ...; // Base64 encoded image
var imageAttachment = MediaAttachment.withBase64Image(postImage);

var urlAttachment = MediaAttachment.withImageUrl('https://docs.getsocial.im/images/logo.png');
1
2
3
4
const postImage = ...; // Base64 encoded image
const imageAttachment = MediaAttachment.withBase64Image(postImage);

const urlAttachment = MediaAttachment.withImageUrl('https://docs.getsocial.im/images/logo.png');

Attach GIFs

To attach GIF:

1
2
val gifBinary = ... // Load gif as byte array
val gifAttachment = MediaAttachment.video(gifBinary)
1
2
let gifBinary: Data = ... // Load gif as Data
let gifAttachment = MediaAttachment.video(binary)
1
2
byte[] videoData = ... // load gif as byte[]
var gifAttachment = MediaAttachment.WithVideo(videoData);
1
2
var base64Video = ...; // Base64 encoded video
var gifAttachment = MediaAttachment.withBase64Video(base64Video);
1
2
const base64Video = .../ Base64 encoded video
const gifAttachment = MediaAttachment.withBase64Video(base64Video);

Attach Videos

Video can be attached as a binary file using the same method as for GIFs, or as URL reference. Binary files are uploaded to GetSocial backend and optimized to serve back to the SDK.

Give us your feedback! Was this article helpful?

😀 🙁