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 }
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()); } } } }
public void onRecordingStopped(string msg) { LuYouLog.d("onRecordingStopped"); if (RecordingStoped != null) { RecordingStoped(); } }
public void onUploadStarted(string msg) { LuYouLog.d("onUploadStarted " + msg); if (SharerStarted != null) { JsonData JsonData = JsonMapper.ToObject(msg); SharerStarted((string)JsonData["videoId"]); } }
public void onUploadPrepared(string msg) { LuYouLog.d("onUploadPrepared"); if (SharerPrepared != null) { JsonData JsonData = JsonMapper.ToObject(msg); SharerPrepared((string)JsonData["videoId"], (string)JsonData["shareUrl"]); } }
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"]); } }
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"]); } }
public void onUploadPreparing(string msg) { LuYouLog.d("onUploadPreparing msg = " + msg); if (SharerPreing != null) { JsonData JsonData = JsonMapper.ToObject(msg); SharerPreing((string)JsonData["videoId"]); } }
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"]); } }
public void onRecordingTime(string msg) { LuYouLog.d("onRecordingTime seconds = " + msg); if (RecordingTime != null) { JsonData JsonData = JsonMapper.ToObject(msg); RecordingTime((int)JsonData["seconds"]); } }
public void OnRecordingStoped() { LuYouLog.d("LuYouExampleGUI RecordingStoped"); }
public void OnRecordingWarning(int code, string msg) { LuYouLog.d("LuYouExampleGUI RecordingWarning code = " + code + ", msg = " + code); }
public void OnRecordingTime(int seconds) { LuYouLog.d("LuYouExampleGUI OnRecordingTime seconds = " + seconds); }
public void OnSharerComplete(string videoId) { LuYouLog.d("LuYouExampleGUI SharerComplete videoId = " + videoId); }
public void OnRecordingFailed(int code, string msg) { LuYouLog.d("LuYouExampleGUI RecordingFailed code = " + code + ", msg = " + code); }
public void OnSharerProgress(string videoId, double progress) { LuYouLog.d("LuYouExampleGUI SharerProgress videoId = " + videoId + " , progress = " + progress); }
public void OnSharerFailed(string videoid, int code, string msg) { LuYouLog.d("LuYouExampleGUI SharerFailed videoid = " + videoid + ",code = " + code + ", msg = " + code); }
public void OnSharerStarted(string videoId) { LuYouLog.d("LuYouExampleGUI SharerStarted videoId = " + videoId); }
public void OnSharerPrepared(string videoId, string shareUrl) { LuYouLog.d("LuYouExampleGUI SharerPrepared videoId = " + videoId + ",shareUrl = " + shareUrl); }
public void OnSharerPreing(string videoId) { LuYouLog.d("LuYouExampleGUI OnSharerPreing videoId = " + videoId); }