Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Tushar_K_
Beginner
98 Views

How to get Video file from gallery to upload to server

Greetings,

I am a newbie at hybrid coding and xdk. I am working on an app to upload images and videos to remote server along with other user details.

I have been able to get the images from the gallery and displaying them on the app before sending to the server.

var pictureSource;   // picture source
    var destinationType; // sets the format of returned value

  
    document.addEventListener("deviceready",onDeviceReady,false);

    function onDeviceReady() {
        pictureSource=navigator.camera.PictureSourceType;
        destinationType=navigator.camera.DestinationType;
    }


    function pullPhoto(source) {
      // Retrieve image file location from specified source
      navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 50,
        destinationType: destinationType.FILE_URL,
        sourceType: source });

  function onFail(message) {
      alert('Failed because: ' + message);
    }

function onPhotoURISuccess(imageURI) {
                     
         var smallImage = document.getElementById('smallImage');
     
      smallImage.style.display = 'block';

            smallImage.src = imageURI;
               
    }

 

However I have not been able to get it working for video files. I have tried

sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY,
        mediaType: navigator.camera.MediaType.VIDEO,

however I am able to get only images for selections instead of video files.

Kindly help

 

 

Tags (2)
0 Kudos
2 Replies
PaulF_IntelCorp
Employee
98 Views

Search the Internet for Cordova and PhoneGap solutions to your issue. The XDK creates standard Cordova applications. Any solutions that work for Cordova (and PhoneGap) will work for the XDK.

Tushar_K_
Beginner
98 Views

Thanks Paul I've searched the internet put most of the solutions suggest that I include

mediaType: navigator.camera.MediaType.VIDEO,

However its not working for me. I've been only able to get Image files from it.

 

 

 

 

Reply