How to get thumbnail of recorded video.
Hello,
I want to upload thumbnail of recorded video to server but
how Can I get thumbnail of recorded video?
4 Answers
-
Wow, bummer that nobody has answered this yet – it's really not all that hard. Here's some code:
var activeMovie = Ti.Media.createVideoPlayer({ top: 0, left: 0, width: '100%', height: '100%', backgroundColor: '#111', autoplay: false, movieControlStyle: Ti.Media.VIDEO_CONTROL_NONE, scalingMode: Ti.Media.VIDEO_SCALING_ASPECT_FIT }); activeMovie.addEventListener('durationAvailable', function (e) { var midpoint = e.duration / 2; var thumbImage = activeMovie.thumbnailImageAtTime(midpoint,Ti.Media.VIDEO_TIME_OPTION_NEAREST_KEYFRAME); var thumbFile = Ti.Filesystem.getFile(global.APPLICATION_PATH,"thumbnail.jpg"); thumbFile.write(thumbImage); }); activeMovie.play();
It's not 100% necessary to get the duration before getting a thumbnail but it helps to know what span of time you're dealing with before selecting the time mark.
-
Someone has the idea?
-
No idea about this ?
-
Hi,
This is something I've been asking about for quite a while. There is some code in the SDK to do it, but it's not fully operational yet. ie: it doesn't work as expected.
Hopefully there might be a solution soon.