{ "id": "175807", "key": "TIMOB-28246", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "21052", "description": "", "name": "Release 9.3.0", "archived": false, "released": true, "releaseDate": "2020-12-14" } ], "resolution": null, "resolutiondate": null, "created": "2020-11-19T03:28:18.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "android", "blob", "media", "preview", "regression" ], "versions": [ { "id": "20950", "name": "Release 9.1.0", "archived": false, "released": true, "releaseDate": "2020-08-25" } ], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-11-20T23:36:23.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "*Summary:*\r\nThe [Ti.Media.previewImage()|https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Media-method-previewImage] method fails to display in-memory blobs (ie: blobs not referencing a file) as of Titanium 9.1.0.\r\n\r\n*Steps to reproduce:*\r\n# Build and run the below on Android.\r\n# Tap on the \"Preview\" button. (Will try to display screenshot of app.)\r\n# Notice it fails to display image.\r\n\r\n{code:javascript}\r\nvar window = Ti.UI.createWindow();\r\nvar button = Ti.UI.createButton({ title: \"Preview\" });\r\nbutton.addEventListener(\"click\", function(e) {\r\n\twindow.toImage(function(imageBlob) {\r\n\t\tif (!imageBlob) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tTi.Media.previewImage({\r\n\t\t\timage: imageBlob,\r\n\t\t\tsuccess: function(e) {\r\n\t\t\t\tTi.API.info(\"@@@ Successfully displayed preview.\");\r\n\t\t\t},\r\n\t\t\terror: function(e) {\r\n\t\t\t\tTi.API.error(\"@@@ Failed to display preview\");\r\n\t\t\t},\r\n\t\t});\r\n\t});\r\n});\r\nwindow.add(button);\r\nwindow.open();\r\n{code}\r\n\r\n*Work-Around:*\r\nSave the blob to file and preview the file instead.\r\n{code:javascript}\r\nvar window = Ti.UI.createWindow();\r\nvar button = Ti.UI.createButton({ title: \"Preview\" });\r\nbutton.addEventListener(\"click\", function(e) {\r\n\twindow.toImage(function(imageBlob) {\r\n\t\tif (!imageBlob) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Write the blob to file.\r\n\t\tvar targetFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, \"image.png\");\r\n\t\ttargetFile.write(imageBlob, false);\r\n\t\timageBlob = targetFile.read();\r\n\r\n\t\t// Preview the above file.\r\n\t\tTi.Media.previewImage({\r\n\t\t\timage: imageBlob,\r\n\t\t\tsuccess: function(e) {\r\n\t\t\t\tTi.API.info(\"@@@ Successfully displayed preview.\");\r\n\t\t\t},\r\n\t\t\terror: function(e) {\r\n\t\t\t\tTi.API.error(\"@@@ Failed to display preview\");\r\n\t\t\t},\r\n\t\t});\r\n\t});\r\n});\r\nwindow.add(button);\r\nwindow.open();\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "Android: Ti.Media.previewImage() fails to display in-memory blobs as of 9.1.0", "creator": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 1210, "state": "closed", "name": "2020 Sprint 23", "startDate": "2020-11-09T17:49:00.000Z", "endDate": "2020-11-20T17:49:00.000Z", "completeDate": "2020-11-20T17:46:00.641Z", "originBoardId": 114 }, { "id": 1211, "state": "closed", "name": "2020 Sprint 24", "startDate": "2020-11-23T18:12:00.000Z", "endDate": "2020-12-07T18:12:00.000Z", "completeDate": "2020-12-04T22:07:24.313Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "457642", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/12271", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-11-19T05:46:52.000+0000", "updated": "2020-11-19T05:46:52.000+0000" }, { "id": "457664", "author": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed", "updateAuthor": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-11-20T18:29:57.000+0000", "updated": "2020-11-20T18:29:57.000+0000" }, { "id": "457665", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "merged to master and 9_3_X for 9.3.0 target.", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2020-11-20T19:12:30.000+0000", "updated": "2020-11-20T19:12:30.000+0000" }, { "id": "457669", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Fixed minor regression within {{TiFileHelper}} class' {{deployFromAssets()}} and {{deployFromZip()}} methods. Note that nobody uses these methods. It is dead code... but \"could\" potentially be used in the future.\r\n\r\nPR (master): https://github.com/appcelerator/titanium_mobile/pull/12281\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-11-20T23:36:23.000+0000", "updated": "2020-11-20T23:36:23.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }