Example #1
0
    void Start()
    {
#if UNITY_ANDROID && !(UNITY_2_6 || UNITY_2_6_1 || UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1)
        AndroidJavaClass  jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        AndroidJavaObject currentActivity = jc.GetStatic <AndroidJavaObject>("currentActivity");
        core     = new AndroidJavaClass("com.luyousdk.core.LYCore");
        recorder = new AndroidJavaClass("com.luyousdk.core.LYCore$Recorder");
        sharer   = new AndroidJavaClass("com.luyousdk.core.LYCore$Sharer");
        core.CallStatic("initialize", new object[] { currentActivity });
        core.CallStatic("appKey", new object[] { packageKey });
        if (showLuyouUI)
        {
            AndroidJavaClass fc = new AndroidJavaClass("com.luyousdk.core.ui.FloatViewUtils");
            floatViewUtils = fc.CallStatic <AndroidJavaObject> ("getInstance");
            floatViewUtils.Call("initFloatView", new object[] { currentActivity });
            floatViewUtils.Call("showFloatView");
        }
#elif UNITY_IPHONE
#endif
        LuYouLog.d("start init ");
        LuYouImpl().Start(this, Screen.width, Screen.height);
        LuYouImpl().SetMaxRecordingTime(maximumRecordingTime);
        LuYouImpl().SetMinRecordingTime(minimumRecordingTime);
        LuYouLog.d("start init end");
#if UNITY_ANDROID && !(UNITY_2_6 || UNITY_2_6_1 || UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_5)
        InitializeRenderCamera("Pre");
        InitializeRenderCamera("Post");
#endif
    }
Example #2
0
    private static LuYouImplement LuYouImpl()
    {
        if (luYouImpl_ == null)
        {
            if ((iOSEnabled_ || androidEnabled_) &&
                (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer))
            {
#if UNITY_ANDROID && !(UNITY_2_6 || UNITY_2_6_1 || UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1)
                LuYouLog.i("Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer");
                if (androidEnabled_ && LuYouAndroidImplementation.getSDKVersion() >= 14)
                {
                    LuYouLog.i("ndroidEnabled_ && LuYouAndroidImplementation.getSDKVersion() >= 14");
                    luYouImpl_ = new LuYouAndroidImplementation();
                    LuYouLog.i("luYouImpl_ = " + luYouImpl_);
                }
#elif UNITY_IPHONE
                if (iOSEnabled_)
                {
                }
#endif
            }
            if (luYouImpl_ == null)
            {
                luYouImpl_ = new LuYouImplement();
            }
        }
        return(luYouImpl_);
    }
Example #3
0
 void OnGUI()
 {
     if (support < 0)
     {
         support = LuYou.IsSupported();
     }
     else
     {
         if (!LuYou.IsRecording() && !LuYou.IsPaused())
         {
             if (GUI.Button(RecordButtonRect1, "Record"))
             {
                 LuYou.SetMaxRecordingTime(30);
                 LuYou.SetMinRecordingTime(5);
                 LuYou.StartRecording();
                 Debug.Log("Record LuYou.IsRecording() = " + LuYou.IsRecording() + " , LuYou.IsPaused() = " + LuYou.IsPaused());
             }
             if (GUI.Button(SharerButtonRect, "share"))
             {
                 string path1 = LuYou.GetLastRecordingFile();
                 LuYouLog.d("LastRecordingFile" + path1);
                 LuYouLog.d("loadThumbnailFromFilePath" + LuYou.LoadThumbnailFromFilePath(path1));
                 string videoId = path1;
                 LuYou.PublishVideo(videoId, path1, "testTitle", "testDescription");
             }
         }
         else if (LuYou.IsRecording())
         {
             if (GUI.Button(RecordButtonRect1, "Stop"))
             {
                 Dictionary <string, string> OthelloDict =
                     new Dictionary <string, string>();
                 OthelloDict.Add("test key", "test value");
                 OthelloDict.Add("test key1", "test value1");
                 OthelloDict.Add("test key2", "test value2");
                 LuYou.SetMetadatas(OthelloDict);
                 LuYou.StopRecording();
                 Debug.Log("Stop LuYou.IsRecording() = " + LuYou.IsRecording() + " , LuYou.IsPaused() = " + LuYou.IsPaused());
             }
             if (GUI.Button(RecordButtonRect2, "Pause"))
             {
                 LuYou.PauseRecording();
                 Debug.Log("Pause LuYou.IsRecording() = " + LuYou.IsRecording() + " , LuYou.IsPaused() = " + LuYou.IsPaused());
             }
         }
         else if (LuYou.IsPaused())
         {
             if (GUI.Button(RecordButtonRect1, "Stop"))
             {
                 LuYou.StopRecording();
                 Debug.Log("Stop LuYou.IsRecording() = " + LuYou.IsRecording() + " , LuYou.IsPaused() = " + LuYou.IsPaused());
             }
             if (GUI.Button(RecordButtonRect2, "Resume"))
             {
                 LuYou.ResumeRecording();
                 Debug.Log("Resume LuYou.IsRecording() = " + LuYou.IsRecording() + " , LuYou.IsPaused() = " + LuYou.IsPaused());
             }
         }
     }
 }
Example #4
0
 public void onRecordingStopped(string msg)
 {
     LuYouLog.d("onRecordingStopped");
     if (RecordingStoped != null)
     {
         RecordingStoped();
     }
 }
Example #5
0
 public void onUploadStarted(string msg)
 {
     LuYouLog.d("onUploadStarted " + msg);
     if (SharerStarted != null)
     {
         JsonData JsonData = JsonMapper.ToObject(msg);
         SharerStarted((string)JsonData["videoId"]);
     }
 }
Example #6
0
 public void onUploadPrepared(string msg)
 {
     LuYouLog.d("onUploadPrepared");
     if (SharerPrepared != null)
     {
         JsonData JsonData = JsonMapper.ToObject(msg);
         SharerPrepared((string)JsonData["videoId"], (string)JsonData["shareUrl"]);
     }
 }
Example #7
0
 public void onUploadFailed(string msg)
 {
     LuYouLog.d("onUploadFailed seconds = " + msg);
     if (SharerFailed != null)
     {
         JsonData JsonData = JsonMapper.ToObject(msg);
         SharerFailed((string)JsonData["videoId"], (int)JsonData["errCode"], (string)JsonData["errMsg"]);
     }
 }
Example #8
0
 public void onUploadProgress(string msg)
 {
     LuYouLog.d("onUploadProgress msg = " + msg);
     if (SharerProgress != null)
     {
         JsonData JsonData = JsonMapper.ToObject(msg);
         SharerProgress((string)JsonData["videoId"], (double)JsonData["progress"]);
     }
 }
Example #9
0
 public void onUploadPreparing(string msg)
 {
     LuYouLog.d("onUploadPreparing msg = " + msg);
     if (SharerPreing != null)
     {
         JsonData JsonData = JsonMapper.ToObject(msg);
         SharerPreing((string)JsonData["videoId"]);
     }
 }
Example #10
0
 public void onRecordingWarning(string msg)
 {
     LuYouLog.d("onRecordingWarning msg = " + msg);
     if (RecordingWarning != null)
     {
         JsonData JsonData = JsonMapper.ToObject(msg);
         RecordingWarning((int)JsonData["errCode"], (string)JsonData["errMsg"]);
     }
 }
Example #11
0
 public void onRecordingTime(string msg)
 {
     LuYouLog.d("onRecordingTime seconds = " + msg);
     if (RecordingTime != null)
     {
         JsonData JsonData = JsonMapper.ToObject(msg);
         RecordingTime((int)JsonData["seconds"]);
     }
 }
Example #12
0
 public void OnRecordingStoped()
 {
     LuYouLog.d("LuYouExampleGUI RecordingStoped");
 }
Example #13
0
 public void OnRecordingWarning(int code, string msg)
 {
     LuYouLog.d("LuYouExampleGUI RecordingWarning code = " + code + ", msg = " + code);
 }
Example #14
0
 public void OnRecordingTime(int seconds)
 {
     LuYouLog.d("LuYouExampleGUI OnRecordingTime seconds = " + seconds);
 }
Example #15
0
 public void OnRecordingFailed(int code, string msg)
 {
     LuYouLog.d("LuYouExampleGUI RecordingFailed code = " + code + ", msg = " + code);
 }
Example #16
0
 public void OnSharerPreing(string videoId)
 {
     LuYouLog.d("LuYouExampleGUI OnSharerPreing videoId = " + videoId);
 }
Example #17
0
 public void OnSharerComplete(string videoId)
 {
     LuYouLog.d("LuYouExampleGUI SharerComplete videoId = " + videoId);
 }
Example #18
0
 public void OnSharerProgress(string videoId, double progress)
 {
     LuYouLog.d("LuYouExampleGUI SharerProgress videoId = " + videoId + " , progress = " + progress);
 }
Example #19
0
 public void OnSharerFailed(string videoid, int code, string msg)
 {
     LuYouLog.d("LuYouExampleGUI SharerFailed videoid = " + videoid + ",code = " + code + ", msg = " + code);
 }
Example #20
0
 public void OnSharerStarted(string videoId)
 {
     LuYouLog.d("LuYouExampleGUI SharerStarted videoId = " + videoId);
 }
Example #21
0
 public void OnSharerPrepared(string videoId, string shareUrl)
 {
     LuYouLog.d("LuYouExampleGUI SharerPrepared videoId = " + videoId + ",shareUrl = " + shareUrl);
 }