void onStopped() { started = false; // 停止录制后启动分享视频 (show sharing page after the recorder is stopped) ShareREC.SetText("Angry Rebot"); ShareREC.AddCustomAttr("score", "5000"); ShareREC.AddCustomAttr("name", "ShareREC Developer"); ShareREC.AddCustomAttr("brand", "hehe!"); ShareREC.AddCustomAttr("level", "10"); // 添加返回操作(add callback to handle returning operations) ShareREC.OnReturnFromShareHandler = OnReturned; ShareREC.OnPlatformSelectedHandler = OnPlatformSelected; ShareREC.AddCustomPlatform("CustomPlatform"); if (share) { ShareREC.ShowShare(); } else { ShareREC.ShowLastVideo(); } }
void OnGUI() { if (ShareREC.IsAvailable()) { GUI.skin.box.fontSize = fontSize; GUI.skin.button.fontSize = fontSize; GUI.Box(panel, "ShareREC Test"); if (started) { if (GUI.Button(btnStop, "Stop")) { // 设置停止监听 (add recorder stopped listener) ShareREC.OnRecorderStoppedHandler = onStopped; // 停止录制 (stop recording) ShareREC.StopRecorder(); } } else { if (GUI.Button(btnStart, "Start")) { // 设置启动监听(add recorder started listener) ShareREC.OnRecorderStartedHandler = onStarted; // 启动录制 (start recording) ShareREC.StartRecorder(); } else if (GUI.Button(btnProfile, "Profile")) { // 添加返回操作(add callback to handle returning operations) ShareREC.OnReturnFromProfileHandler = OnReturned; ShareREC.OnPlatformSelectedHandler = OnPlatformSelected; ShareREC.AddCustomPlatform("CustomPlatform"); // 打开个人中心 (show user profile page) ShareREC.ShowProfile(); } } } }
void OnGUI() { if (ShareREC.IsAvailable()) //if (false) { GUI.skin.box.fontSize = fontSize; GUI.skin.button.fontSize = fontSize; GUI.Box(panel, "ShareREC Test"); if (started) { if (GUI.Button(btnStop, "Stop Share")) { share = true; // 设置停止监听 (add recorder stopped listener) ShareREC.OnRecorderStoppedHandler = onStopped; // 停止录制 (stop recording) ShareREC.StopRecorder(); } else if (GUI.Button(btnStopPreview, "Stop Preview")) { share = false; // 设置停止监听 (add recorder stopped listener) ShareREC.OnRecorderStoppedHandler = onStopped; // 停止录制 (stop recording) ShareREC.StopRecorder(); } } else { if (GUI.Button(btnStart, "Start")) { // 设置启动监听(add recorder started listener) ShareREC.OnRecorderStartedHandler = onStarted; //===get the audio data real time====== //Camera camera = GetComponent<Camera>(); //ShareREC.PrepareSoundCopying (1, 44100, 2048,camera.name); //====================================== //启用监听分享的操作,对完成,取消,出错的事件回调 ShareREC.setShareActionEnable(); //启用要分享需要先上传,强制上传才可以 ShareREC.setShareAfterUpload(); //用于绑定的事件 ShareREC.OnShareCancelHandler = onShareCancel; ShareREC.OnShareCompleteHandler = onShareComplete; ShareREC.OnShareErrorHandler = onShareError; ShareREC.StartRecorder(); } else if (GUI.Button(btnProfile, "Profile")) { // 添加返回操作(add callback to handle returning operations) ShareREC.OnReturnFromProfileHandler = OnReturned; ShareREC.OnPlatformSelectedHandler = OnPlatformSelected; ShareREC.AddCustomPlatform("CustomPlatform"); // 打开个人中心 (show user profile page) ShareREC.ShowProfile(); } else if (GUI.Button(btnShowLocalVideos, "LocalVideos")) { ShareREC.ShowLocalVideos(); } } } }