Skip to content

Repository files navigation

MLTwitter

Twitter client primarily targeted to Magic Leap on Unity.

Sample Code

// Read video file from storage
byte[] video = File.ReadAllBytes(videoFilePath);

// Upload the video to Twitter (this is just a media upload; not a tweet)
string videoMediaId = await _client.UploadVideo(video, (upload, encode) =>
{
    Debug.Log($"Uploading: {upload * 100:0}% done, encoding: {encode * 100:0}% done...");
});

// Tweet the video
await _client.UpdateStatus("Uploading a video capture", videoMediaId);

Features

Demo

Demo recorded footage

  1. User authentication (3-legged OAuth) using Helio
  2. Fetch and present a user profile on Unity UI
  3. Capture and upload video to Twitter media server
  4. Tweet with entities: URL links and media

To run the demo on your own:

  • Instantiate Demo/CredentialRepository.cs
    • Right click → CreateScriptable Object
  • Fill in the repository's text fields with your Twitter app credentials
  • Pass the repository to DemoController in Demo/DemoScene.scene
  • Run that scene on Magic Leap

Requirements

  • Unity version 2019.1 and later
  • C# 7 language features
  • UniRx

Disclaimer

  • Primarily for myself and developing inconsistently (issues & PRs are appreciated)
  • MIT license

Motivation

  • I couldn't find any loyalty-free cross-platform Twitter clients for Unity (except broken ones) so decided to make my own. The core is completely managed in .NET Standard 2.0 and survives IL2CPP so it should be portable to the majority of platforms including upcoming smartglasses; as PoC it works in Lumin runtime.

About

Twitter client for Unity Magic Leap

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages