public void ShareRecording() { // Create a share payload with video path var payload = new SharePayload(); payload.AddMedia(lastVideoPath); // Present native share dialog payload.Commit(); }
// Invoked by NatCorder video recorder once video recording is complete private void OnRecording(string path) { Debug.Log($"Saved recording to: {path}"); var prefix = Application.platform == RuntimePlatform.IPhonePlayer ? "file://" : ""; if (shareRecording) { using (var payload = new SharePayload()) payload.AddMedia(path); } else { Handheld.PlayFullScreenMovie($"{prefix}{path}"); } }
/// <summary> /// Raises the share button click event. /// </summary> public async void OnShareButtonClick() { Debug.Log("OnShareButtonClick ()"); if (isVideoPlaying || isVideoRecording || isFinishWriting || string.IsNullOrEmpty(videoPath)) { return; } var mes = ""; #if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR try { SharePayload payload = new SharePayload(); payload.AddText("User shared video! [NatCorderWithOpenCVForUnity Example](" + NatCorderWithOpenCVForUnityExample.GetNatCorderVersion() + ")"); payload.AddMedia(videoPath); var success = await payload.Commit(); mes = $"Successfully shared items: {success}"; } catch (ApplicationException e) { mes = e.Message; } #else mes = "NatShare Error: SharePayload is not supported on this platform."; await Task.Delay(100); #endif Debug.Log(mes); if (fpsMonitor != null) { fpsMonitor.Toast(mes); } }