我想使用钛合金上传ios中的图库视频,请指导我解决此问题并成功上传视频

时间:2016-10-19 21:03:00

标签: titanium appcelerator-titanium

enter image description here

  

//我在按钮点击时完成了以下代码但是当我   点击选择按钮屏幕卡在此屏幕上   仅

btnGallery.addEventListener('click', function() {
    Ti.Media.openPhotoGallery({
        mediaTypes : [![enter image description here][1]][1][Ti.Media.MEDIA_TYPE_VIDEO], *//to select video*
        success : function(event) {
                    var result=event.media;   *//Store video in blob form*
                    Ti.API.info(event);
                    var xhr = Titanium.Network.createHTTPClient();
                    xhr.onload = function(e) {
                                    Ti.UI.createAlertDialog({
                                                title : 'Success',
                                                message : 'status code ' + this.status
                                            }).show();
                                        };
                    xhr.open('POST', 'http://videorequestlive.com/upload_videos');
                    xhr.send({video : event.media,uploadedby : Ti.App.Properties.getString('loginProfileId'),requested_video_description : rowChildren[1].text,requested_video_id : rowChildren[3].text,requestedby : rowChildren[4].text,requested_video_title : 'User',});
                                    },
                                });

1 个答案:

答案 0 :(得分:0)

您的mediaTypes似乎已被破坏

试试这个:

btnGallery.addEventListener('click', function() {
Ti.Media.openPhotoGallery({
    mediaTypes : [Ti.Media.MEDIA_TYPE_VIDEO], *//to select video*
    success : function(event) {
                var result=event.media;   *//Store video in blob form*
                Ti.API.info(event);
                var xhr = Titanium.Network.createHTTPClient();
                xhr.onload = function(e) {
                                Ti.UI.createAlertDialog({
                                            title : 'Success',
                                            message : 'status code ' + this.status
                                        }).show();
                                    };
                xhr.open('POST', 'http://videorequestlive.com/upload_videos');
                xhr.send({video : event.media,uploadedby : Ti.App.Properties.getString('loginProfileId'),requested_video_description : rowChildren[1].text,requested_video_id : rowChildren[3].text,requestedby : rowChildren[4].text,requested_video_title : 'User',});
                                },
                            });