okamura0510 / SocialWorker

【UnityAsset】SocialWorker - Twitter、Facebook、Line、Instagram、メールへの個別連携
https://tempura-kingdom.jp/socialworker/
MIT License
29 stars 13 forks source link

Sharing video to instagram #1

Closed phatal closed 8 years ago

phatal commented 8 years ago

Is it possible to sharing video to instagram, same like we sharing image?

okamura0510 commented 8 years ago

No. Image only. But it may be possible.

phatal commented 8 years ago

I already write my own small solution to do that :) But I think it will be useful if you can add posibility load video to your plugin, if I understand right it's just need to change type of data from "image/png" or "image/jpg" to "video/mp4" My soluition:

private IEnumerator ShareVideo(string pathToFile)
{
    isProcessing = true;
    yield return new WaitForEndOfFrame();

    if (!Application.isEditor)
    {

        AndroidJavaClass intentClass = new AndroidJavaClass("android.content.Intent");
        AndroidJavaObject intentObject = new AndroidJavaObject("android.content.Intent");
        intentObject.Call<AndroidJavaObject>("setAction", intentClass.GetStatic<string> ("ACTION_SEND"));
        AndroidJavaClass uriClass = new AndroidJavaClass("android.net.Uri");
        AndroidJavaObject uriObject = uriClass.CallStatic<AndroidJavaObject>("parse", pathToFile);
        intentObject.Call<AndroidJavaObject>("putExtra", intentClass.GetStatic<string>("EXTRA_STREAM"), uriObject);
        intentObject.Call<AndroidJavaObject>("putExtra", intentClass.GetStatic<string>("EXTRA_TEXT"), shareText + gameLink);
        intentObject.Call<AndroidJavaObject>("putExtra", intentClass.GetStatic<string>("EXTRA_SUBJECT"), subject);
        intentObject.Call<AndroidJavaObject>("setType", "video/mp4");
        AndroidJavaClass unity = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        AndroidJavaObject currentActivity = unity.GetStatic<AndroidJavaObject>("currentActivity");

        currentActivity.Call("startActivity", intentObject);

    }

    isProcessing = false;

}`
okamura0510 commented 8 years ago

Great! I'm happy :) Thanks, your soluition. I will modify instagram plugin. Just a moment, I'm preparing right now.

okamura0510 commented 8 years ago

Sorry, I've changed my mind. I'd like to support only a message and a image with SocialWorker. So I can't support video with SocialWorker. Many thanks.

phatal commented 8 years ago

it is a pity, thank you for taking your time to me!