Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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?

— asked June 4th 2010 by Carlos Perez
  • thumbnails
0 Comments

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.

    — answered November 21st 2011 by Mark Pemburn
    permalink
    0 Comments
  • Someone has the idea?

    — answered June 4th 2010 by Guillaume LAFOUTRY
    permalink
    0 Comments
  • No idea about this ?

    — answered June 4th 2010 by Guillaume LAFOUTRY
    permalink
    0 Comments
  • 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.

    — answered June 4th 2010 by Kosso
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.