Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14123] Android: Add support for creating video thumbnails

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-12-08T22:55:42.000+0000
Affected Version/sn/a
Fix Version/sRelease 4.0.0
ComponentsAndroid
Labelsandroid, exalture, module_media, notable, qe-4.0.0, qe-manualtest, qe-testadded, thumbnail, video
ReporterCarter Lathrop
AssigneeAshraf Abu
Created2013-05-30T15:25:48.000+0000
Updated2015-05-12T21:05:23.000+0000

Description

Problem

Unable to create a thumbnail of a video on Android using Titanium SDK 3.1.0.GA. Titanium.Media.VideoPlayer.thumbnailImageAtTime(Number time, Number option) and Titanium.Media.VideoPlayer.requestThumbnailImagesAtTimes(Number[] times, Number option, Callback callback) appear to be the only methods available to achieve this, but they are not supported for Android, only on iOS. Would like to see similar functionality to get a thumbnail from a video. It appears to be supported by the Android APIs per http://developer.android.com/reference/android/provider/MediaStore.Video.Thumbnails.html

Test case

N/A - not currently supported

Logs

N/A - not currently supported

Discussions

Q/A: http://developer.appcelerator.com/question/152946/video-thumbnails-on-android

Comments

  1. Carter Lathrop 2013-05-30

    Heather, In order to review a bug report we need a bit more information in order to reproduce the bug and confirm it is indeed a problem. Specifically a test case is needed which is a short demo code that can easily be pasted into an app.js to show the problem at hand. Also needed are the Android versions you have tested this problem with and the studio build of titanium. Please see here: https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report on how to create a successful bug report and I will be glad to review this ticket again when all pertinent information is provided. Thank you, Carter
  2. Heather 2013-05-31

    I was doing as instructed in http://developer.appcelerator.com/question/152946/video-thumbnails-on-android by Mauro Parra who indicated they were part of the Appcelerator team. If there is indeed a way to create a thumbnail of a video in Android using the Titanium framework, please do share. Titanium.Media.VideoPlayer.thumbnailImageAtTime(Number time, Number option) and Titanium.Media.VideoPlayer.requestThumbnailImagesAtTimes(Number[] times, Number option, Callback callback) appear to be the only methods available to achieve this, but they are not supported for Android, only on iOS.
  3. Carter Lathrop 2013-05-31

    Heather, When creating a bug report it is necessary that you follow the guidelines from https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report. What is missing is pertinent information that you have hinted at in your last comment. Describing the issue at hand, what you have experienced, the actual behavior that you would like seen and any further suggestions are all important for the team at engineering to ensure they understand your problem and can then cater to your specific request. If you can fill in the pertinent information in the description of the ticket such that engineering can then work on creating a solution for you it would be very helpful and I will be sure to then pass along your request to the team. Thanks for your patience, Carter
  4. Carter Lathrop 2013-05-31

    In other words, if this is currently working on only iOS then this would be a new feature request ticket and you would have to describe the context of the new feature and what you would like out of it. I hope this clears things up a bit. Awaiting your reply, Carter
  5. Heather 2013-06-05

    I updated the ticket.
  6. Carter Lathrop 2013-06-05

    Thanks Heather, moving to Ti-Mobile. Engineering will take a look at your request. Regards, Carter
  7. Ketan Majmudar 2013-12-20

    I agree that this level of parity is essential within the 3.x era of the SDK, also having multimedia with full parity should be a priority. Thanks, Ket
  8. Ketan Majmudar 2014-01-29

    Any movement on this?
  9. Ashraf Abu 2014-11-25

    PR: https://github.com/appcelerator/titanium_mobile/pull/6393
  10. Ashraf Abu 2014-11-25

    Sample code for app.js:
        
        // this sets the background color of the master UIView (when there are no windows/tab groups on it)
        Titanium.UI.setBackgroundColor('#000');
         
        // create base UI tab and root window
        //
        function newWindow(){
        var vidWin = Titanium.UI.createWindow({
            title : 'Tab 1',
            backgroundColor : '#fff'
        });
        
        var activeMovie = Titanium.Media.createVideoPlayer({
            top : 0,
            backgroundColor: 'red',
            height : 300,
            width : 300,
            //url : 'ten_sec_test.mp4'
            // url  :'http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4'
        });
         
        activeMovie.url = 'http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4';
        //activeMovie.url = 'ten_sec_test.mp4';
        
        var scrollView = Ti.UI.createScrollView({
            contentWidth : 'auto',
            contentHeight : 'auto',
            layout : 'horizontal',
            scrollType : 'horizontal'
        });
        
        
        activeMovie.requestThumbnailImagesAtTimes([0, 20, 59, 47, 22], Titanium.Media.VIDEO_TIME_OPTION_NEAREST_KEYFRAME, function(response) {
                    Ti.API.info("Thumbnail callback called, success = " + response.success);
                     Ti.API.info("Thumbnail callback called, time = " + response.time);
                     Ti.API.info("Thumbnail callback called, code = " + response.code);
                    if(response.success) {
                         var imgView = Titanium.UI.createImageView({
                            image : response.image
                        });
                        scrollView.add(imgView);
                        
                    }
                });
        var cancelbtn = Ti.UI.createButton({bottom:0,width:200,height:50,title:'Cancel Request'});
        cancelbtn.addEventListener('click',function(){
        	Ti.API.info("Thumbnail Cancelled requested");
        	activeMovie.cancelAllThumbnailImageRequests();
        });
        
        
        var closebtn = Ti.UI.createButton({bottom:60,width:200,height:50,title:'DONE'});
        closebtn.addEventListener('click',function(){vidWin.close()});
        
        vidWin.add(scrollView);
        vidWin.add(closebtn);
        vidWin.add(cancelbtn);
        vidWin.open();
        }
         
        var win=Ti.UI.createWindow();
        var openButton = Ti.UI.createButton({width:200,height:50,title:'open'});
        openButton.addEventListener('click',newWindow);
        win.add(openButton);
        win.open();
        
        
        
  11. Eric Wieber 2015-03-05

    Verified fixed using: Titanium SDK 4.0.0.v20150303161012 Studio 4.0.0.201502171827 CLI 3.4.2-rc4 Thumbnails are generated properly.

JSON Source