Software Archive
Read-only legacy content
17061 Discussions

How to get Video file from gallery to upload to server

Tushar_K_
Beginner
569 Views

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

 

 

0 Kudos
2 Replies
PaulF_IntelCorp
Employee
569 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.

0 Kudos
Tushar_K_
Beginner
569 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.

 

 

 

 

0 Kudos
Reply