cordova - Video Orientation On CordovaCapture -


i using cordova-plugin-media-capture plugin record videos. captures fine when recorded in landscape orientation on portrait mode, video shown upside down. following sample code

    var options = { limit: 1};     $cordovacapture.capturevideo(options).then(function(videodata) {         addvideotolocalstorage(videodata, slotnumber);   }, function(err) {     $scope.localstoragevideos = 'err: <br />'+ json.stringify(videodata)   }); 

you can lock orientation application using config.xml value:

<preference name="orientation" value="portrait"/> 

while works well, wanted videos in landscape mode instead. had working fine in ios nothing tried work android. began looking plugin allow me switch orientation dynamically. one, screen orientation worked great.

so @ point - found code in application fired off video go full screen mode, , added 2 simple lines of code set orientation landscape.

video.addeventlistener('playing', function() {      var = cordova.plugins.screenorientation;      so.setorientation(so.orientation.landscape); }, false); 

i did digging , discovered listen user leaving full screen mode, happened automatically when hit button.

jquery(document).on('webkitfullscreenchange', function(e) {            if(!e.currenttarget.webkitisfullscreen) {         var = cordova.plugins.screenorientation;         so.setorientation(so.orientation.portrait);     } }); 

got great blog post .hopefully you.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -