My video thumbnail plugin for Cordova, PKVideoThumbnail, has been updated to version 2.0.1, with the following features:
- Support for cordova-ios 4.x, and cordova-android 5.x
Resize the thumbnail to the desired size, while still maintaining the aspect ratio. On Android you do have to be careful not to ask for too large a thumbnail (512×384 is the max). Of course, at some point, anything above that really isn’t a thumbnail anymore.
Choose desired JPEG quality for the thumbnail. If you don’t specify anything, 80% is assumed.
The earlier version could only write the thumbnail out to a file. This version can return an
ArrayBufferor a Base64-encoded string suitable for inlining with an image tag.
cdvfile://. Because of this, the File API plugin is now a dependency. The plugin should also work with other file system schemes as well, but I didn’t test that.
If your environment supports ES6 Promises, you can have a promise returned instead of using callbacks. Yay!
On iOS, you can specify the desired timestamp for the thumbnail. You’re ultimately restricted to keyframes, but still nice to have. Android does not support this feature, unfortunately.
To install you can use the following:
$ cordova plugin add cordova-plugin-photokandy-video-thumbnail --save