Titanium Community Questions & Answer Archive

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

Select video

Hi I am trying to use Titanium.Media.openPhotoGallery to select a video. The simple code is

Titanium.Media.openPhotoGallery({
        success:function(event){},
        cancel:function(){},
        error:function(){alert("There was a problem selecting files.");},
        mediaTypes: [Titanium.Media.MEDIA_TYPE_VIDEO]
});

But even if mediaTypes: [Titanium.Media.MEDIA_TYPE_VIDEO] is set, I can still only pick photos.

I have also tried with
mediaTypes: Titanium.Media.MEDIA_TYPE_VIDEO
and
mediaTypes: [Titanium.Media.MEDIA_TYPE_VIDEO,Titanium.Media.MEDIA_TYPE_PHOTO]
and
mediaTypes: [Titanium.Media.MEDIA_TYPE_VIDEO,Titanium.Media.MEDIA_TYPE_PHOTO]

But no matter what I can only select pictures. It is on android, and same problem on both emulator, and on device testing.

Best regards
Jimmy

— asked July 25th 2010 by Jimmy Escherich
  • mobile
  • video
1 Comment
  • I have same problem for android, Hope you guys have answer for this or any alternative? please help

    — commented July 8th 2015 by Pravin bhapkar

8 Answers

  • I am also having same problem… Can any one help to get video in the gallery…Thanks in advance.

    It would really help if someone from Titanium development team commented on this!

    — answered May 2nd 2013 by kabindra simkhada
    permalink
    0 Comments
  • Anyone have the same problem?

    — answered July 26th 2010 by Jimmy Escherich
    permalink
    0 Comments
  • Anyone who can select a video with openPhotoGallery?

    — answered July 29th 2010 by Jimmy Escherich
    permalink
    0 Comments
  • Anyone? It is more or less the only thing I need to get my app ready.

    Hope someone can help?

    Best regards.

    — answered July 30th 2010 by Jimmy Escherich
    permalink
    0 Comments
  • Still no one who can help, or have tried to select a video from the gallery?

    — answered August 13th 2010 by Jimmy Escherich
    permalink
    0 Comments
  • I have the same problem. :(

    — answered October 13th 2011 by Tommy Skott
    permalink
    0 Comments
  • Did you manage to get this to work?

    — answered October 13th 2011 by Tommy Skott
    permalink
    1 Comment
    • hi tommy ! that mediaTypes property is only for ios…
      still android have selecting videos from gallery is an issue….

      — commented October 30th 2012 by phani kumar
  • function openGallery() {
    Titanium.Media.openPhotoGallery({

        success:function(event)
        {
            var cropRect = event.cropRect;
            var image = event.media;
    
    
            alert(image);
            // set image view
            //Ti.API.debug('Our type was: '+event.mediaType);
            if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO)
            {
                AddImageViewer(image);
            }
            else if (event.mediaType == Ti.Media.MEDIA_TYPE_VIDEO)
            {
                AddVideoPlayer(image);
            }
    
        //    Titanium.API.info('PHOTO GALLERY SUCCESS cropRect.x ' + cropRect.x + ' cropRect.y ' + cropRect.y  + ' cropRect.height ' + cropRect.height + ' cropRect.width ' + cropRect.width);
    
        },
        cancel:function()
        {
    
        },
        error:function(error)
        {
        },
        allowEditing:true,
        popoverView:popoverView,
        arrowDirection:arrowDirection,
        mediaTypes:[Ti.Media.MEDIA_TYPE_VIDEO,Ti.Media.MEDIA_TYPE_PHOTO]
    });
    

    }

    function photo_gallery() {
    win = Titanium.UI.createWindow();

    if (Titanium.Platform.osname == 'ipad')
    {
        // photogallery displays in a popover on the ipad and we
        // want to make it relative to our image with a left arrow
        arrowDirection = Ti.UI.iPad.POPOVER_ARROW_DIRECTION_LEFT;
        popoverView = imageView;
    }
    
    if (Ti.Platform.osname === 'android') {
        win.addEventListener('open', function(e) {
            openGallery();    
        });    
    } else {
        openGallery();
    }
    
    return win;
    

    };

    — answered February 16th 2013 by Cesar Aviles
    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.