You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Simon MacDonald (Resolved) (JIRA)" <ji...@apache.org> on 2012/04/03 19:12:23 UTC
[jira] [Resolved] (CB-426) camera.getPicture ignores mediaType in
1.5
[ https://issues.apache.org/jira/browse/CB-426?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Simon MacDonald resolved CB-426.
--------------------------------
Resolution: Fixed
Fix Version/s: 1.6.0
The JS side was not passing the mediaType parameter to the native side. I added it back in as a list of arguments.
> 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: Simon MacDonald
> Labels: Upload, Video, mediaType
> Fix For: 1.6.0
>
>
> 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