incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emiliano Angelini (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CB-426) camera.getPicture ignores mediaType in 1.5
Date Tue, 03 Apr 2012 16:14:25 GMT
camera.getPicture ignores mediaType in 1.5
------------------------------------------

                 Key: CB-426
                 URL: https://issues.apache.org/jira/browse/CB-426
             Project: Apache Callback
          Issue Type: Bug
          Components: Android
    Affects Versions: 1.5.0
         Environment: Android 2.1 (Virtual), Android 3.1 (Motorolla Xoom). Built from Windows
7.
            Reporter: Emiliano Angelini
            Assignee: Joe Bowser


Hi, 
I was using getPicture to upload videos, but when I upgraded to cordova-1.5.0 I noticed that
the only files that I was able to select where pictures instead of videos.

The Call I was doing is this one: navigator.camera.getPicture(onVideoURISuccess, onVideoURIFail,
{ quality:50, mediaType: Camera.MediaType.VIDEO, destinationType: _destinationType.FILE_URI,
sourceType: source});

When I was using 1.4.1 the result was getting a list of videos from the gallery. Since I installed
1.5.0 I could only select images.

A code similar to what I was using is this one:
http://stackoverflow.com/questions/8940058/phonegap-crash-when-using-file-transfer-for-uploading-video-larger-than-15mb

<!DOCTYPE html>
<html>
  <head>
    <title>Video Uploader</title>
    <meta name="viewport" content="width=device-width, initial-
scale=1">
    <link rel="stylesheet" href="master.css" type="text/css" />
    <script type="text/javascript" charset="utf-8"
src="phonegap-1.3.0.js"></script>
    <script type="text/javascript" charset="utf-8">
        function onLoad() {
        document.addEventListener("deviceready",onDeviceReady,false);
    }
        function onDeviceReady() {
                pictureSource=navigator.camera.PictureSourceType;
            destinationType=navigator.camera.DestinationType;
    }
    function uploadFile(mediaFile,method) {
                var ft = new FileTransfer(),
            path = mediaFile,
            name = "video.3gp";
        var options = new FileUploadOptions();
                options.chunkedMode = false;
                        options.fileKey = "file";
                        options.fileName = name;
                        options.mimeType = "video/mpeg";
        ft.upload(path,
            "http://www.myserver.com/upload.php",
            function(r) {
                        alert('Success ' + r.response);
            },
            function(error) {
                        alert('Error ' + path + ': ' + error.code);
            },
            options);
    }
    function onPhotoURISuccess(imageURI) {
                uploadFile(imageURI,"library");
    }
    function getVideo(source, type) {
            navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality:
50, destinationType: destinationType.FILE_URI, sourceType: source,
mediaType: type});
    }
    function onFail(message) {
        alert('Error');
    }
    </script>
  </head>
  <body onload="onLoad()">
        <button class="btn"
onclick="getVideo(pictureSource.PHOTOLIBRARY,Camera.MediaType.VIDEO);">Get
Video</button>
  </body>
</html>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message