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

Success and Error Callbacks swapped on iOS #1

Open
TimGraf opened this issue Jul 24, 2014 · 7 comments
Open

Success and Error Callbacks swapped on iOS #1

TimGraf opened this issue Jul 24, 2014 · 7 comments

Comments

@TimGraf
Copy link

TimGraf commented Jul 24, 2014

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

@colonna-mike
Copy link

I seem to be having a issue getting the callback from IOS. I will be testing this tonight. how did you get around this issue?

@TimGraf
Copy link
Author

TimGraf commented Oct 20, 2015

@colonna-mike I haven't used this in a while. We were last using this plugin on iOS 8 on a Cordova/AngularJS project that never got released. However here is the function we had for creating thumbnails. It appears my original comment was incorrect as well. Sorry it's been a while, but I do remember having some issues with the callbacks, I just don't remember how we resolved it. The plugin did work well however.

    function _generateVideoThumbnail(videoPath, thumbnailPath) {
        var deferred = $q.defer();

        window.PKVideoThumbnail.createThumbnail(videoPath, thumbnailPath,
            function(targetThumbnailPath) {
                deferred.resolve(targetThumbnailPath);
            },
            function(error) {
                deferred.resolve("");
            });

        return deferred.promise;
    }

@colonna-mike
Copy link

Thanks Tim,

The plugin is working on android but not on my iPad i trace it back to the
call backs not firing. I little more research on my end needs to be done .
On Oct 20, 2015 3:22 PM, "Tim Graf" [email protected] wrote:

@colonna-mike https://github.com/colonna-mike I haven't used this in a
while. We were last using this plugin on iOS 8 on a Cordova/AngularJS
project that never got released. However here is the function we had for
creating thumbnails. It appears my original comment was incorrect as well.
Sorry it's been a while, but I do remember having some issues with the
callbacks, I just don't remember how we resolved it. The plugin did work
well however.

function _generateVideoThumbnail(videoPath, thumbnailPath) {
    var deferred = $q.defer();

    window.PKVideoThumbnail.createThumbnail(videoPath, thumbnailPath,
        function(targetThumbnailPath) {
            deferred.resolve(targetThumbnailPath);
        },
        function(error) {
            deferred.resolve("");
        });

    return deferred.promise;
}


Reply to this email directly or view it on GitHub
#1 (comment)
.

@colonna-mike
Copy link

Figure it out, it's not the plugin its the way IOS is sending back the file path, once I adjusted for that that plugin works great...

@TimGraf
Copy link
Author

TimGraf commented Oct 29, 2015

Cool, glad to hear.

@kerrishotts
Copy link
Member

Glad you got it figured out. If you wouldn't mind sharing how you adjusted for the path, that would be great. Perhaps it is something that needs to be integrated into the plugin itself.

@colonna-mike
Copy link

colonna-mike commented Aug 25, 2016

wow I missed this sooo sorry.
I capture what type phone it is to localStorage then i test to see what type of phone it is.
I then append the "file://' to the preflix of the path.

here's a snippet of my function ( better late than never) hope this helps someone

function GetThumbnail(mediaFiles) {

    if (GetPhoneType() === 'iOS')
        videoPath = 'file://' + mediaFiles[0].fullPath;
    else
        videoPath = mediaFiles[0].fullPath;

    window.resolveLocalFileSystemURL(videoPath, function (entry) {
        window.video = entry.nativeURL;
        window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onRequestFileSystemSuccess, null);

    }, function (e) {
        console.log("resolveLocalFileSystemURL " + e.code);
    });

}

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