Skip to content

Commit

Permalink
Bugfix for LoadImageAtPathAsync and GetVideoThumbnailAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
yasirkula committed Mar 24, 2023
1 parent fd8dcbb commit ce6dd85
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions Plugins/NativeCamera/NativeCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,11 @@ public static async Task<Texture2D> LoadImageAtPathAsync( string imagePath, int
maxSize = SystemInfo.maxTextureSize;

#if !UNITY_EDITOR && UNITY_ANDROID
string loadPath = await TryCallNativeAndroidFunctionOnSeparateThread( () => AJC.CallStatic<string>( "LoadImageAtPath", Context, imagePath, TemporaryImagePath, maxSize ) );
string temporaryImagePath = TemporaryImagePath; // Must be accessed from main thread
string loadPath = await TryCallNativeAndroidFunctionOnSeparateThread( () => AJC.CallStatic<string>( "LoadImageAtPath", Context, imagePath, temporaryImagePath, maxSize ) );
#elif !UNITY_EDITOR && UNITY_IOS
string loadPath = await Task.Run( () => _NativeCamera_LoadImageAtPath( imagePath, TemporaryImagePath, maxSize ) );
string temporaryImagePath = TemporaryImagePath; // Must be accessed from main thread
string loadPath = await Task.Run( () => _NativeCamera_LoadImageAtPath( imagePath, temporaryImagePath, maxSize ) );
#else
string loadPath = imagePath;
#endif
Expand Down Expand Up @@ -496,9 +498,11 @@ public static async Task<Texture2D> GetVideoThumbnailAsync( string videoPath, in
maxSize = SystemInfo.maxTextureSize;

#if !UNITY_EDITOR && UNITY_ANDROID
string thumbnailPath = await TryCallNativeAndroidFunctionOnSeparateThread( () => AJC.CallStatic<string>( "GetVideoThumbnail", Context, videoPath, TemporaryImagePath + ".png", false, maxSize, captureTimeInSeconds ) );
string temporaryImagePath = TemporaryImagePath; // Must be accessed from main thread
string thumbnailPath = await TryCallNativeAndroidFunctionOnSeparateThread( () => AJC.CallStatic<string>( "GetVideoThumbnail", Context, videoPath, temporaryImagePath + ".png", false, maxSize, captureTimeInSeconds ) );
#elif !UNITY_EDITOR && UNITY_IOS
string thumbnailPath = await Task.Run( () => _NativeCamera_GetVideoThumbnail( videoPath, TemporaryImagePath + ".png", maxSize, captureTimeInSeconds ) );
string temporaryImagePath = TemporaryImagePath; // Must be accessed from main thread
string thumbnailPath = await Task.Run( () => _NativeCamera_GetVideoThumbnail( videoPath, temporaryImagePath + ".png", maxSize, captureTimeInSeconds ) );
#else
string thumbnailPath = null;
#endif
Expand Down
2 changes: 1 addition & 1 deletion Plugins/NativeCamera/README.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Native Camera for Android & iOS (v1.3.7) =
= Native Camera for Android & iOS (v1.3.8) =

Online documentation & example code available at: https://github.com/yasirkula/UnityNativeCamera
E-mail: [email protected]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.yasirkula.nativecamera",
"displayName": "Native Camera",
"version": "1.3.7",
"version": "1.3.8",
"documentationUrl": "https://github.com/yasirkula/UnityNativeCamera",
"changelogUrl": "https://github.com/yasirkula/UnityNativeCamera/releases",
"licensesUrl": "https://github.com/yasirkula/UnityNativeCamera/blob/master/LICENSE.txt",
Expand Down

0 comments on commit ce6dd85

Please sign in to comment.