Skip to content

Commit

Permalink
Added markTextureNonReadable parameter to GetVideoThumbnail
Browse files Browse the repository at this point in the history
  • Loading branch information
yasirkula committed Sep 3, 2020
1 parent 74b330c commit 32c4cde
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ Beginning with *6.0 Marshmallow*, Android apps must request runtime permissions
- **generateMipmaps** determines whether texture should have mipmaps or not
- **linearColorSpace** determines whether texture should be in linear color space or sRGB color space

`Texture2D NativeCamera.GetVideoThumbnail( string videoPath, int maxSize = -1, double captureTimeInSeconds = -1.0 )`: creates a Texture2D thumbnail from a video file and returns it. Returns *null*, if something goes wrong.
`Texture2D NativeCamera.GetVideoThumbnail( string videoPath, int maxSize = -1, double captureTimeInSeconds = -1.0, bool markTextureNonReadable = true )`: creates a Texture2D thumbnail from a video file and returns it. Returns *null*, if something goes wrong.
- **maxSize** determines the maximum size of the returned Texture2D in pixels. Larger thumbnails will be down-scaled. If untouched, its value will be set to *SystemInfo.maxTextureSize*. It is recommended to set a proper maxSize for better performance
- **captureTimeInSeconds** determines the frame of the video that the thumbnail is captured from. If untouched, OS will decide this value
- **markTextureNonReadable** (see *LoadImageAtPath*)

## EXAMPLE CODE

Expand Down
4 changes: 2 additions & 2 deletions Plugins/NativeCamera/NativeCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public static Texture2D LoadImageAtPath( string imagePath, int maxSize = -1, boo
return result;
}

public static Texture2D GetVideoThumbnail( string videoPath, int maxSize = -1, double captureTimeInSeconds = -1.0 )
public static Texture2D GetVideoThumbnail( string videoPath, int maxSize = -1, double captureTimeInSeconds = -1.0, bool markTextureNonReadable = true )
{
if( maxSize <= 0 )
maxSize = SystemInfo.maxTextureSize;
Expand All @@ -345,7 +345,7 @@ public static Texture2D GetVideoThumbnail( string videoPath, int maxSize = -1, d
#endif

if( !string.IsNullOrEmpty( thumbnailPath ) )
return LoadImageAtPath( thumbnailPath, maxSize );
return LoadImageAtPath( thumbnailPath, maxSize, markTextureNonReadable );
else
return null;
}
Expand Down
3 changes: 2 additions & 1 deletion Plugins/NativeCamera/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ Texture2D NativeCamera.LoadImageAtPath( string imagePath, int maxSize = -1, bool
// Creates a Texture2D thumbnail from a video file and returns it. Returns null, if something goes wrong
// maxSize: determines the maximum size of the returned Texture2D in pixels. Larger thumbnails will be down-scaled. If untouched, its value will be set to SystemInfo.maxTextureSize. It is recommended to set a proper maxSize for better performance
// captureTimeInSeconds: determines the frame of the video that the thumbnail is captured from. If untouched, OS will decide this value
Texture2D NativeCamera.GetVideoThumbnail( string videoPath, int maxSize = -1, double captureTimeInSeconds = -1.0 );
// markTextureNonReadable: see LoadImageAtPath
Texture2D NativeCamera.GetVideoThumbnail( string videoPath, int maxSize = -1, double captureTimeInSeconds = -1.0, bool markTextureNonReadable = true );

// Returns an ImageProperties instance that holds the width, height and mime type information of an image file without creating a Texture2D object. Mime type will be null, if it can't be determined
NativeCamera.ImageProperties NativeCamera.GetImageProperties( string imagePath );
Expand Down

0 comments on commit 32c4cde

Please sign in to comment.