[TIMOB-26558] iOS: Ti.Media.takeScreenshot is not working
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Resolved |
Resolution | Not Our Bug |
Resolution Date | 2018-11-27T03:21:12.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Rakhi Mitro |
Assignee | Vijay Singh |
Created | 2018-11-14T10:47:54.000+0000 |
Updated | 2018-11-27T03:21:13.000+0000 |
Description
Ti.Media.takeScreenshot is not working working properly on iOS. On android, clicking on button its takes a screenshot, saved it to the gallery and displayed it to imageview properly. But on ios we are not getting the same behaviour.
*Test Code:*
var win = Ti.UI.createWindow({
layout: "vertical",
backgroundColor: "green"
});
var button = Ti.UI.createButton({
title: "Take Pic",
top: 20,
width: 200,
height: 200
});
win.add(button);
var imageView = Ti.UI.createImageView({
width: "100",
height: "100",
top: 20
});
win.add(imageView);
button.addEventListener('click', function(e) {
Ti.Media.takeScreenshot(function(e) {
Ti.API.info(e.media);
imageView.image = e.media;
});
});
win.open();
*Test Environment:*
Appcelerator Command-Line Interface, version 7.0.7
Operating System
Name = Mac OS X
Version = 10.13.6
Architecture = 64bit
# CPUs = 4
Memory = 8589934592
Node.js
Node.js Version = 8.9.1
npm Version = 5.5.1
Titanium CLI
CLI Version = 5.1.1
Titanium SDK
SDK Version = 7.4.1.GA
iOS SDK: 12.0, iOS Simulator: iPhone X
*Test steps:*
1. Create a classic project
2. Run the sample code on simulator
3. Click on button. We get the following:
[INFO] : rakhiAndroid2/1.0 (7.4.1.f47cf79a83)
[INFO] : [object TiBlob]
*Console logs and output:* See attachment section for screenshots
Attachments
File | Date | Size |
---|---|---|
Screenshot_20181114-153042.png | 2018-11-14T10:48:31.000+0000 | 47109 |
Simulator Screen Shot - iPhone X - 2018-11-14 at 16.31.54.png | 2018-11-14T10:48:31.000+0000 | 64446 |
TestCameraImage.zip | 2018-11-26T04:56:37.000+0000 | 54460 |
[~rmitro] Please add sample test code. Thanks!
[~rmitro] Its working for me. Check with updated test case -
Please try to open camera(Ti.Media.showCamera) with overlay and take screenshot with camera interface opened. It takes screenshot with black screen and overlay, not image from camera...
[~max87] Can you give the reproducible test case please?
So here is test case -
The code which I can see for taking screenshot is not changed from long. It seems it is expected behaviour for iOS while capturing screenshot. Is it working differently for any previous versions? What is behaviour for android? Will look in this if anything can be done for same.
[~rmitro] Can you please check the behaviour for android and let me know? Thanks!
[~vijaysingh], I tested on Android, it takes a screenshot with white screen and overlay, not image from the camera. Sample code: https://gist.github.com/MotiurRahman/dbe8af54f0b3ba02f0d37bcf4899111c Thanks!
I have attached a native iOS TestCameraImage app. I tried to capture screenshot in native app as well. It is also behaving in same way. We are using UIImagePickerController to capture image in Titanium. With this it is not possible to capture the camera preview in screenshot. On stack overflow also people have discussed about it [here](https://stackoverflow.com/questions/8996611/ios-capture-screenshot-of-camera-controller) . Thanks!