Select any video file in device


#1

I need to provide ability to user to select any video file in device.

For Pictures, we use the option Camera.PictureSourceType.PHOTOLIBRARY.

Like that, is there any option like this to populate only videos?

Thanks.


#2

https://github.com/apache/cordova-plugin-camera#options see mediaType


#3

thanks friend let you know if I work over here


#4

hi !!sorry for being late. Here the code
works for me

$scope.VideoURI = ‘content://media/external/video/media/17’;

 $scope.VIDEO = function() {
            if (navigator.camera) {
              navigator.camera.getPicture( cameraSuccess2, cameraError,
              { sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY,
               mediaType:navigator.camera.MediaType.VIDEO,
                                         } );
            } else {
              $scope.image.src = "http://lorempixel.com/200/400/";
              console.log('default image was set');
            }
                                }
      function cameraSuccess2(VideoURI) {
                $scope.video = document.getElementById('myVideo');
                // hack until cordova 3.5.0 is released
                if (VideoURI.substring(0,21)=="content://com.android") {
                        var photo_split=VideoURI.split("%3A");
                        VideoURI="content://media/external/video/media/"+photo_split[1];
                                                                       }
                $scope.VideoURI =  VideoURI;
                $scope.video.src = $scope.VideoURI;
                $scope.apply();
           }

HTML

<video  id="myVideo"  width="100%" height="50%" preload="metadata" controls webkit-playsinline><source type="video/mp4" >

#5

I just used it many ways and tried your way also but m getting blank data on selection of video. It means video selection library apeared but on select of video it is giving blank data… so how can i get data or file path