Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24026] TIMOB-14533 app on Media Module displays video capture button when it should display image capture button

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionWon't Fix
Resolution Date2016-11-10T19:23:51.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterLee Morris
AssigneeLee Morris
Created2016-10-12T23:23:40.000+0000
Updated2017-03-23T22:31:28.000+0000

Description

For the TIMOB-14533 app on MediaModule it is supposed to allow the user to Open Camera and then take a photograph. However, the only option is to capture a video and if you capture the video and select that the app shows an alert which states "got the wrong type back=public video".

Attachments

FileDateSize
code TIMOB-14533.docx2016-10-12T23:23:31.000+0000100546

Comments

  1. Hans Knöchel 2016-10-13

    Please provide a reproducible demo-code (best in a single app.js), thank you! Also, you are talking about Android, right?
  2. Farzad Merzadyan 2016-10-25

    User can use camera. Remove Ti.Media.MEDIA_TYPE_VIDEO from mediaTypes. To explicitly record video see *Android Capture Video Example* section at: http://docs.appcelerator.com/platform/latest/#!/guide/Camera_and_Photo_Gallery_APIs.
       var window = Ti.UI.createWindow({
       	title: 'timob-14533',
       	backgroundColor: 'yellow'
       });
       var imageView = Ti.UI.createImageView({
       	width: 400,
       	height: 400
       });
       window.add(imageView);
       var button = Ti.UI.createButton({
       	top: 10,
       	title: 'Open Camera'
       });
       button.addEventListener("click", function () {
       	Titanium.Media.showCamera({
       		success: function (event) {
       			Ti.API.info('camera status: type was: ' + event.mediaType);
       			if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {
       				imageView.image = event.media.imageAsResized(400, 400);
       			} else {
       				Ti.API.error("camera status: wrong type back: " + event.mediaType);
       			}
       		},
       		cancel: function () {
       			Ti.API.info("camera status: cancel");
       		},
       		error: function (error) {
       			Ti.API.info("camera status:  error: " + error);
       		},
       		saveToPhotoGallery: true,
       		mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO]
       	});
       });
       window.add(button);
       window.open(); 
       
  3. Hans Knöchel 2016-10-25

    [~fmerzadyan] The developer should be able to specify both photo and video media types unless Android disallows that. If that's the case, we need to update our docs regarding this behavior.
  4. Farzad Merzadyan 2016-10-26

    In the docs, it said that 'allowEditing and mediaTypes are iOS-only settings' (see http://docs.appcelerator.com/platform/latest/#!/guide/Camera_and_Photo_Gallery_APIs) and also in Android you have to declare a separate button for photo and video. So the same button is not allowed to be linked to different media types.
  5. Lee Morris 2017-03-23

    Closing ticket as Won't Fix with reference to the above comments.

JSON Source