Skip to content

Commit 40c2cd4

Browse files
committed
v1.7.1
Updated NatCorder version to 1.7.1. Updated NatShare version to 1.2.2.
1 parent 803dfb9 commit 40c2cd4

File tree

7 files changed

+64
-24
lines changed

7 files changed

+64
-24
lines changed

Assets/NatCorderWithOpenCVForUnityExample/NatCorderWithOpenCVForUnityExample.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class NatCorderWithOpenCVForUnityExample : MonoBehaviour
99
{
1010
public static string GetNatCorderVersion()
1111
{
12-
return "1.7.0";
12+
return "1.7.1";
1313
}
1414

1515
public Text exampleTitle;
-1.45 KB
Binary file not shown.
-1.45 KB
Binary file not shown.
-1.46 KB
Binary file not shown.

Assets/NatCorderWithOpenCVForUnityExample/VideoRecordingExample/VideoRecordingExample.cs

Lines changed: 57 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using NatCorder;
2-
using NatCorder.Clocks;
3-
using NatCorder.Inputs;
4-
using NatShare;
1+
using NatSuite.Recorders;
2+
using NatSuite.Recorders.Clocks;
3+
using NatSuite.Recorders.Inputs;
4+
using NatSuite.Sharing;
55
using OpenCVForUnity.CoreModule;
66
using OpenCVForUnity.ImgprocModule;
77
using OpenCVForUnity.UnityUtils;
@@ -833,43 +833,79 @@ public void OnPlayVideoFullScreenButtonClick()
833833
/// <summary>
834834
/// Raises the share button click event.
835835
/// </summary>
836-
public void OnShareButtonClick()
836+
public async void OnShareButtonClick()
837837
{
838838
Debug.Log("OnShareButtonClick ()");
839839

840840
if (isVideoPlaying || isVideoRecording || isFinishWriting || string.IsNullOrEmpty(videoPath))
841841
return;
842842

843-
using (var payload = new SharePayload("NatCorderWithOpenCVForUnityExample",
844-
completionHandler: () =>
845-
{
846-
Debug.Log("User shared video!");
847-
}
848-
))
843+
var mes = "";
844+
845+
#if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR
846+
try
847+
{
848+
var success = await new SharePayload()
849+
.AddText("User shared video! [NatCorderWithOpenCVForUnity Example](" + NatCorderWithOpenCVForUnityExample.GetNatCorderVersion() + ")")
850+
.AddMedia(videoPath)
851+
.Commit();
852+
853+
mes = $"Successfully shared items: {success}";
854+
}
855+
catch (ApplicationException e)
856+
{
857+
mes = e.Message;
858+
}
859+
#else
860+
mes = "NatShare Error: SharePayload is not supported on this platform";
861+
#endif
862+
863+
Debug.Log(mes);
864+
865+
if (fpsMonitor != null)
849866
{
850-
payload.AddText("User shared video!");
851-
payload.AddMedia(videoPath);
867+
fpsMonitor.consoleText = mes;
868+
await Task.Delay(2000);
869+
fpsMonitor.consoleText = "";
852870
}
853871
}
854872

855873
/// <summary>
856874
/// Raises the save to camera roll button click event.
857875
/// </summary>
858-
public void OnSaveToCameraRollButtonClick()
876+
public async void OnSaveToCameraRollButtonClick()
859877
{
860878
Debug.Log("OnSaveToCameraRollButtonClick ()");
861879

862880
if (isVideoPlaying || isVideoRecording || isFinishWriting || string.IsNullOrEmpty(videoPath))
863881
return;
864882

865-
using (var payload = new SavePayload("NatCorderWithOpenCVForUnityExample",
866-
completionHandler: () =>
867-
{
868-
Debug.Log("User saved video to camera roll!");
869-
}
870-
))
883+
var mes = "";
884+
885+
#if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR
886+
try
887+
{
888+
var success = await new SavePayload("NatCorderWithOpenCVForUnityExample")
889+
.AddMedia(videoPath)
890+
.Commit();
891+
892+
mes = $"Successfully saved items: {success}";
893+
}
894+
catch (ApplicationException e)
895+
{
896+
mes = e.Message;
897+
}
898+
#else
899+
mes = "NatShare Error: SavePayload is not supported on this platform";
900+
#endif
901+
902+
Debug.Log(mes);
903+
904+
if (fpsMonitor != null)
871905
{
872-
payload.AddMedia(videoPath);
906+
fpsMonitor.consoleText = mes;
907+
await Task.Delay(2000);
908+
fpsMonitor.consoleText = "";
873909
}
874910
}
875911

-1.45 KB
Binary file not shown.

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
* Anddroid (Pixel) / iOS (iPhone8, iPhone6s)
99
* Unity >= 2018.3+ (Unity 2019.2 or higher is recommended due to [the Unity issue](https://issuetracker.unity3d.com/issues/android-video-player-cannot-play-files-located-in-the-persistent-data-directory-on-android-10?_ga=2.235187912.870386860.1577555830-195736471.1541757609))
1010
* Scripting backend MONO / IL2CPP
11-
* [NatCorder - Video Recording API](https://assetstore.unity.com/packages/tools/integration/natcorder-video-recording-api-102645?aid=1011l4ehR) 1.7.0+
12-
* [NatShare - Mobile Sharing API](https://assetstore.unity.com/packages/tools/integration/natshare-mobile-sharing-api-117705?aid=1011l4ehR) 1.2.1+
11+
* [NatCorder - Video Recording API](https://assetstore.unity.com/packages/tools/integration/natcorder-video-recording-api-102645?aid=1011l4ehR) 1.7.1+
12+
* [NatShare - Mobile Sharing API](https://assetstore.unity.com/packages/tools/integration/natshare-mobile-sharing-api-117705?aid=1011l4ehR) 1.2.2+
1313
* [OpenCV for Unity](https://assetstore.unity.com/packages/tools/integration/opencv-for-unity-21088?aid=1011l4ehR) 2.3.8+
1414

1515

@@ -36,6 +36,10 @@
3636
1. Build and Deploy to Android and iOS.
3737

3838

39+
## Android Instructions
40+
Build requires Android SDK Platform 29 or higher.
41+
42+
3943
## iOS Instructions
4044
After building an Xcode project from Unity, add the following keys to the `Info.plist` file with a good description:
4145
- `NSPhotoLibraryUsageDescription`

0 commit comments

Comments
 (0)