Share Content

Learn how to share Images/Video/Live Camera content on to Snapchat

Snapchat Kit allows to share image, video and even live camera. Along with the sharing media, you can attach stickers of your choice and attachment links (Check next article on how to add additional data).

Sharing content can be of three types

  • eSnapchatContentType.Photo

Images must be JPG or PNG. Size must be <= 15MB

  • eSnapchatContentType.Video

Videos must be <= 15MB in size Videos must be 15 seconds or shorter. Must be MP4 format

  • eSnapchatContentType.LiveCamera

    Opens up the camera for sharing live camera content

1. Create SnapchatContent instance by passing the content type.

For Sharing Image

SnapchatContent content = new SnapchatContent(eSnapchatContentType.Photo)

For Sharing Video

SnapchatContent content = new SnapchatContent(eSnapchatContentType.Video)

For Sharing Live Camera

SnapchatContent content = new SnapchatContent(eSnapchatContentType.LiveCamera)

2. Set sharing content data

Pass file path of the sharing content to SnapchatContent instance.

content.SetContentData("PATH_TO_SHARING_CONTENT");

3. Share and receive status in callback

Pass created SnapchatContent instance to SnapchatKitManager and register for callback

SnapchatKitManager.Share(content, OnShareComplete);

Example

using VoxelBusters.SnapchatKit;

void ShareToSnapchat(string contentFilePath, bool isVideo)
{
    SnapchatContent content;
    if(isVideo)
    {
        content    =    new SnapchatContent(eSnapchatContentType.Video); 
    }
    else
    {
        content    =    new SnapchatContent(eSnapchatContentType.Photo);         
    }
    
    // Set content data
    content.SetContentData(contentFilePath);
    
    // Share
    SnapchatKitManager.Share(content, OnShareComplete);
}

private void OnShareComplete(bool success, string error)
{
	string message  =  success ? "Successfully Shared" : "Failed to share " + error;
	Debug.Log(message);
}

Last updated