Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined is not an object #12

Open
josaal17 opened this issue May 11, 2016 · 3 comments
Open

undefined is not an object #12

josaal17 opened this issue May 11, 2016 · 3 comments

Comments

@josaal17
Copy link

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);
}

@kerrishotts
Copy link
Member

How are you installing the plugin? What version are you installing?

Are you waiting for deviceready before attempting to use the plugin?

Are you testing this from a CLI/PGBuild build of the app? The plugin won't work on the PhoneGap Developer app.

Can you share your config.xml/index.html files?

@josaal17
Copy link
Author

josaal17 commented May 11, 2016

Well I saw 2 errors that I have, I'm trying to Phonegap and I think I'm not expecting the "deviceready".

Now, I try in the build.phonegap.
I generate the .ipa and install in my phone by Itunes, but don't work

I installed the plugin in Config.xml

And in the index.html is only html, I work in index.js , this part of code.

First I use the camera with camera.getPicture plugin to record video. the result I get it as URL and that URL is what happened as a parameter to PKVideoThumbnail plugin.

But not if I do well or I access the plugin waiting for the "deviceredy"

document.addEventListener("deviceready",onDeviceReady,false);
// Cordova is ready to be used!
//
function onDeviceReady() {
//alert("hola");
pictureSource=navigator.camera.PictureSourceType;
destinationType=navigator.camera.DestinationType;
}

  1. by a button called the method.
    Capture Photo

function getVideo(source, type) {
navigator.camera.getPicture(onVideoURISuccess, onFail, { quality:50, destinationType: destinationType.FILE_URI, sourceType: source, mediaType: type});
}

  1. This method is where summoned the PKVideoThumbnail plugin.
    function onVideoURISuccess(imageURI) {
    // Uncomment to view the image file URI
    alert(imageURI);
    // Get image handle
    window.PKVideoThumbnail.createThumbnail (imageURI, "cdvfile://localhost/persistent/video.png", correcto, fail);

    }

function correct(result){
alert(result);

}

function fail(error){
alert(error);
}

// Called if something bad happens.
// 
function onFail(message) {
  alert('Failed because: ' + message);
}

Please would be helpful if I explain what I'm doing wrong.

Thank you

@dragermrb
Copy link

A bit late, but use callbacks mode instead of promises.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants