示例#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
    }
示例#2
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());
             }
         }
     }
 }
示例#3
0
 public void onRecordingStopped(string msg)
 {
     LuYouLog.d("onRecordingStopped");
     if (RecordingStoped != null)
     {
         RecordingStoped();
     }
 }
示例#4
0
 public void onUploadStarted(string msg)
 {
     LuYouLog.d("onUploadStarted " + msg);
     if (SharerStarted != null)
     {
         JsonData JsonData = JsonMapper.ToObject(msg);
         SharerStarted((string)JsonData["videoId"]);
     }
 }
示例#5
0
 public void onUploadPrepared(string msg)
 {
     LuYouLog.d("onUploadPrepared");
     if (SharerPrepared != null)
     {
         JsonData JsonData = JsonMapper.ToObject(msg);
         SharerPrepared((string)JsonData["videoId"], (string)JsonData["shareUrl"]);
     }
 }
示例#6
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"]);
     }
 }
示例#7
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"]);
     }
 }
示例#8
0
 public void onUploadPreparing(string msg)
 {
     LuYouLog.d("onUploadPreparing msg = " + msg);
     if (SharerPreing != null)
     {
         JsonData JsonData = JsonMapper.ToObject(msg);
         SharerPreing((string)JsonData["videoId"]);
     }
 }
示例#9
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"]);
     }
 }
示例#10
0
 public void onRecordingTime(string msg)
 {
     LuYouLog.d("onRecordingTime seconds = " + msg);
     if (RecordingTime != null)
     {
         JsonData JsonData = JsonMapper.ToObject(msg);
         RecordingTime((int)JsonData["seconds"]);
     }
 }
示例#11
0
 public void OnRecordingStoped()
 {
     LuYouLog.d("LuYouExampleGUI RecordingStoped");
 }
示例#12
0
 public void OnRecordingWarning(int code, string msg)
 {
     LuYouLog.d("LuYouExampleGUI RecordingWarning code = " + code + ", msg = " + code);
 }
示例#13
0
 public void OnRecordingTime(int seconds)
 {
     LuYouLog.d("LuYouExampleGUI OnRecordingTime seconds = " + seconds);
 }
示例#14
0
 public void OnSharerComplete(string videoId)
 {
     LuYouLog.d("LuYouExampleGUI SharerComplete videoId = " + videoId);
 }
示例#15
0
 public void OnRecordingFailed(int code, string msg)
 {
     LuYouLog.d("LuYouExampleGUI RecordingFailed code = " + code + ", msg = " + code);
 }
示例#16
0
 public void OnSharerProgress(string videoId, double progress)
 {
     LuYouLog.d("LuYouExampleGUI SharerProgress videoId = " + videoId + " , progress = " + progress);
 }
示例#17
0
 public void OnSharerFailed(string videoid, int code, string msg)
 {
     LuYouLog.d("LuYouExampleGUI SharerFailed videoid = " + videoid + ",code = " + code + ", msg = " + code);
 }
示例#18
0
 public void OnSharerStarted(string videoId)
 {
     LuYouLog.d("LuYouExampleGUI SharerStarted videoId = " + videoId);
 }
示例#19
0
 public void OnSharerPrepared(string videoId, string shareUrl)
 {
     LuYouLog.d("LuYouExampleGUI SharerPrepared videoId = " + videoId + ",shareUrl = " + shareUrl);
 }
示例#20
0
 public void OnSharerPreing(string videoId)
 {
     LuYouLog.d("LuYouExampleGUI OnSharerPreing videoId = " + videoId);
 }