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
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!
-
Anyone have the same problem?
-
Anyone who can select a video with openPhotoGallery?
-
Anyone? It is more or less the only thing I need to get my app ready.
Hope someone can help?
Best regards.
-
Still no one who can help, or have tried to select a video from the gallery?
-
I have the same problem. :(
-
Did you manage to get this to work?
-
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;
};