photokandystudios / pkvideothumbnail Goto Github PK
View Code? Open in Web Editor NEWVideo Thumbnailing Plugin for Android and iOS
License: MIT License
Video Thumbnailing Plugin for Android and iOS
License: MIT License
It seems that it won't save my poster at:
target = cordova.file.dataDirectory + videoFile.name + ".PNG"
source: file:///storage/emulated/0/DCIM/Camera/VID_20160411_192016.mp4
target: file:///data/data/com.phonegap.vimifydev/files/VID_20160411_192016.mp4.PNG
error: "/data/data/com.phonegap.vimifydev/files/VID_20160411_192016.mp4.PNG"
Cordova: Android 5.1.0
Phone: Nexus 5
Android OS Version: 5.1
Anything look weird?
Hi,
I am having an issue using the plugin, any help would be appreciated.
My code:
window.PKVideoThumbnail.createThumbnail({
sourceVideoPath: 'file://' + filePath,
targetThumbnailPath: 'file://' + cordova.file.dataDirectory + 'file.jpg',
options: { base64: true },
})
.then((data) => {
console.log(data);
})
.catch((error) => {
console.log(error);
});
The error message:
Uncaught Error: Missing target URI for thumbnail image.
at Object.PKVideoThumbnail.createThumbnail (PKVideoThumbnail.js:31)
at index.min.js:593
at Object.callbackFromNative (cordova.js:295)
at <anonymous>:1:9
It doesn't want to read a video file in the path format of:
file:/storage/emulated/0/DCIM/Camera/VID_20160407_171709.mp4
_snapVideo: function () {
console.warn( 'snapVideo >' )
window.plugins.videocaptureplus.captureVideo( this.capturedVideo, function ( err ) {
console.error( 'snapVideo > ERR >', err )
}, {
limit: 1,
duration: 10,
highquality: true,
} )
},
capturedVideo: _.debounce( function ( media ) {
if ( _.isEmpty( media ) ) {
return
}
console.log( 'capturedVideo > media >', media )
// fullPath: "file:/storage/emulated/0/DCIM/Camera/VID_20160407_171709.mp4"
// lastModifiedDate: 1460063833000
// name: "VID_20160407_171709.mp4"
// size: 7519513
// type: "video/mp4"
window.PKVideoThumbnail.createThumbnail( media[ 0 ].fullPath, cordova.file.dataDirectory + media[ 0 ].name + '_thumb.jpg', {
mode: 'file',
quality: 50
}, function ( thumb ) {
console.log( 'thumb >', thumb )
}.bind( this ), function ( err ) {
console.error( err )
} )
}, 250 ),
"plugman install --platform android --project /project --plugin cordova-plugin-photokandy-video-thumbnail": Fetching plugin "cordova-plugin-photokandy-video-thumbnail" via npm Installing "cordova-plugin-photokandy-video-thumbnail" at "2.1.0" for android Failed to install 'cordova-plugin-photokandy-video-thumbnail': CordovaError: Version of installed plugin: "[email protected]" does not satisfy dependency plugin requirement "cordova-plugin-file@^4.0.0". Try --force to use installed plugin as dependency. at /.npm/lib/node_modules/pgb-plugman/node_modules/pgb-cordova-lib/src/plugman/install.js:581:33 at _fulfilled (/.npm/lib/node_modules/pgb-plugman/node_modules/q/q.js:787:54) at self.promiseDispatch.done (/.npm/lib/node_modules/pgb-plugman/node_modules/q/q.js:816:30) at Promise.promise.promiseDispatch (/.npm/lib/node_modules/pgb-plugman/node_modules/q/q.js:749:13) at /.npm/lib/node_modules/pgb-plugman/node_modules/q/q.js:509:49 at flush (/.npm/lib/node_modules/pgb-plugman/node_modules/q/q.js:108:17) at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9) Version of installed plugin: "[email protected]" does not satisfy dependency plugin requirement "cordova-plugin-file@^4.0.0". Try --force to use installed plugin as dependency.
I am using this plugin in my App and testing in Samsung Galaxy Tab and Nexus 4. After capturing video when i am giving inputs to the plugin function it returns error as NULL.
Please help.
Thanks in Advance
Hi,
The plugin works well until i put options.
This code works perfectly
window.PKVideoThumbnail.createThumbnail (entry.nativeURL, name + '.png',function(prevSucc) { return prevImageSuccess(prevSucc); }, fail);
This code does not work.
window.PKVideoThumbnail.createThumbnail (entry.nativeURL, name + '.png', {resize: {width: 512, height: 384}} ,function(prevSucc) { return prevImageSuccess(prevSucc); }, fail);
Maybe, i made a mistake.
Regards
PKVideoThumbnail couldn't read video at %s. I'm getting this error in Huawei phone for first 2 times and for 3rd time it's getting successful. Can someone guide me here?
Hello,
I am working Phone gap project in which I am displaying video thumbnail to users after they upload video files. But I see neither the success result nor the error message.
I have installed plugin by following command as specified in doc and it got installed also.
cordova plugin add cordova-plugin-photokandy-video-thumbnail --save
I am using latest version of plugin. My question is do we need any configuration in config.xml? or is it issue with my code?
var sourceVideoPath = "file:///"+device_local_path; var targetThumbnailPath = cordova.file.dataDirectory + "demo.PNG"; window.PKVideoThumbnail.createThumbnail ( sourceVideoPath, targetThumbnailPath, thumbnailsuccess, thumbnailfailure );
I tried to write both external memory and internal memory, But no use. Can you please help us with this?
And does it work with Phonegap Desktop app or Do we need to test on actual devices using executable files? In this scenario I tried both. But did not work out.
Can you please help me to use this plugin in ionic3. I installed plugin successfully but not able to import plugin or use in ts file. please help. Sorry for bad english
Getting this error it seems like when it encounters a video with an unsupported codec:
10-14 21:53:33.344 16813-16863/? E/PluginManager﹕ Uncaught exception from plugin
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.compress(android.graphics.Bitmap$CompressFormat, int, java.io.OutputStream)' on a null object reference
at com.photokandy.PKVideoThumbnail.PKVideoThumbnail.execute(PKVideoThumbnail.java:79)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:95)
at org.apache.cordova.PluginManager.exec(PluginManager.java:130)
at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:53)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
Might be worth having a line of code to check if thumbnail created was null, and return a message e.g.
Bitmap thumbnail = ThumbnailUtils.createVideoThumbnail ( sourceVideo.substring(7), MediaStore.Images.Thumbnails.MINI_KIND);
if (thumbnail == null) {
callbackContext.error("issue with video codec or something else");
return true;
}
Thanks for the plugin!
Love this plugin, but it's not compiling with Phonegap Build cli-6.0.0. That uses iOS 4.0.1. Any ideas?
The following build commands failed:
CompileC build/VimifyDev.build/Release-iphoneos/VimifyDev.build/Objects-normal/armv7/PKVideoThumbnail.o VimifyDev/Plugins/com.photokandy.videothumbnail/PKVideoThumbnail.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
I need help with this error, I don't know that happend.
TypeError: undefined is not an object (evaluating 'window.PKVideoThumbnail.createThumbnail')
This is part of my code.
//called
window.PKVideoThumbnail.createThumbnail (video_path, thumbnail_path, correct, fail);
//success
function correct(result){
alert(result);
}
PKVideoThumbnail.m:77:40: 'toSuccessCallbackString:' is deprecated: Deprecated in Cordova 3.6. Use the CDVCommandDelegate method sendPluginResult:callbackId instead. This will be removed in 4.0.0
Within obtainURLForPath
NSString *pathForResource = [self.commandDelegate pathForResource:path];
always is nil
prepending "file://" or using "cdvfile://" to the path prior to calling this code will enable it to work as it skips this part.
tested on iphone 6s plus
Hello, Everytime I try to execute this command:
cordova plugin add com.photokandy.videothumbnail
I am receiving the following error:
Error: Failed to fetch plugin com.photokandy.videothumbnail via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: Registry returned 404 for GET on https://registry.npmjs.org/com.photokand
y.videothumbnail
What could be the reason?
Thanks.
It looks as though the success and error callback function are swapped on iOS.
Your documentation has:
window.PKVideoThumbnail.createThumbnail ( sourceVideoPath, targetThumbnailPath, success, failure );
It seems to actually be this on iOS:
window.PKVideoThumbnail.createThumbnail ( sourceVideoPath, targetThumbnailPath, failure, success );
I am an able to use using file_uri, can't save it specified target. Maybe a demo how to use fileTarget? where to the file recommended to save? I'm using cordova.file.cachedirectory to save the file, or any file*.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.