I'm creating an app using CodenameOne and have to use an ios native 
interface to generate some video thumbnails. 

I can't see the iOS logs as I don't have a Mac but as far as anyone has 
said the iOS code is correct so I feel that it's something to do with 
either the passing of file paths from CodenameOne to a native interface or 
the returning of NSData into a byte[] in Codename One. 

Here is the code I am using in iOS:

-(NSData*)createThumbnailFromMp4:(NSString*)param{

     NSURL *mediaURL = [NSURL fileURLWithPath:param];
     AVAsset *asset = [AVAsset assetWithURL:mediaURL];
     CMTime duration = [asset duration];
     CMTime snapshot = CMTimeMake(duration.value / 2, duration.timescale);

     AVAssetImageGenerator *imageGenerator = [[AVAssetImageGenerator alloc] 
initWithAsset:asset];
     CGImageRef imageRef = [imageGenerator copyCGImageAtTime:snapshot 
actualTime:nil error:nil];
     UIImage *thumbnail = [UIImage imageWithCGImage:imageRef];
     CGImageRelease(imageRef);

     return UIImagePNGRepresentation(thumbnail);}

The param passed in is the full path to the video, but all I get back when 
I call this is a 0 length byte[]. Here is the code from CodenameOne:

byte[] thumbnailImage = 
tg.createThumbnailFromMp4(FileSystemStorage.getInstance().getAppHomePath() + 
movePath);

Where movePath is just the file name of the locally stored video. 

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/051e2098-e66e-4068-82fd-3e02cbfc7620%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to