{ "id": "61888", "key": "TIMOB-1256", "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": "11225", "name": "Release 1.5.0", "archived": true, "released": true, "releaseDate": "2010-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:55:40.000+0000", "created": "2011-04-15T02:47:53.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "android", "defect" ], "versions": [], "issuelinks": [], "assignee": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:55:40.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": "{html}

It could be that this is sensitive to a different context than\nthe one which created the Titanium.Media singleton (maybe not\nrelated to that, but it's my guess.) Simple test: two JS's,\nstarting with app.js:

\n
\nTitanium.UI.setBackgroundColor('#000');\nvar main = Titanium.UI.createWindow({  \n    backgroundColor:'#fff',\n    fullscreen: true\n});\n\nvar btn = Ti.UI.createButton({\n    title: 'Open test window'\n});\n\nbtn.addEventListener('click', function(e) {\n    var w = Ti.UI.createWindow({\n        url: 'win1.js', \n        backgroundColor: 'black', \n        fullscreen:true\n    });\n    w.open();\n});\n\nmain.add(btn);\nmain.open();\n
\n

And win1.js:

\n
\n\nvar win = Ti.UI.currentWindow; \nTi.Media.openPhotoGallery({\n    success: function() {Ti.API.info('success');},\n    cancel: function() {Ti.API.info('cancel');},\n    error: function() {Ti.API.info('error');}\n});\n\nvar btn = Ti.UI.createButton({ title: 'close' });\nbtn.addEventListener('click', function() {win.close();});\nwin.add(btn);\n
\n

First time you go to the photo gallery, the callbacks will work.\nNext time not.

{html}", "attachment": [], "flagged": false, "summary": "Titanium.Media.openPhotoGallery's callbacks only work once when multiple contexts involved.", "creator": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "125191", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

Behavior can also be seen in Phone -> Photo Gallery test in\nKS.

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T02:47:54.000+0000", "updated": "2011-04-15T02:47:54.000+0000" }, { "id": "125192", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

FYI, when the @ContextSpecific annotation (which I haven't\npushed yet) is applied to MediaModule, and therefore the module\n\"singleton\" is at the context rather than application level, it\nworks correctly.

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T02:47:54.000+0000", "updated": "2011-04-15T02:47:54.000+0000" }, { "id": "125193", "author": { "name": "fazalmohammed", "key": "fazalmohammed", "displayName": "Fazal Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I need this feature for a client, Is there a way to get this\nchange you made?

{html}", "updateAuthor": { "name": "fazalmohammed", "key": "fazalmohammed", "displayName": "Fazal Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:47:54.000+0000", "updated": "2011-04-15T02:47:54.000+0000" }, { "id": "125194", "author": { "name": "fazalmohammed", "key": "fazalmohammed", "displayName": "Fazal Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

I rebuilt the code using Bill's fix and it seems to work\nfine.

\n

@ContextSpecific public class MediaModule extends TiModule

\n

Thanks

{html}", "updateAuthor": { "name": "fazalmohammed", "key": "fazalmohammed", "displayName": "Fazal Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:47:54.000+0000", "updated": "2011-04-15T02:47:54.000+0000" }, { "id": "125195", "author": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [6120037dfd4e15f287cb9c058414ee79d55678c5])\n[#1256 state:fixed-in-qa]: Make media module\ncontext-specific so that openPhotoGallery() callbacks will continue\nto work even after new windows are opened. \nhttp://github.com/appcelerator/titanium_mobile/commit/6120037dfd4e1...

{html}", "updateAuthor": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:47:55.000+0000", "updated": "2011-04-15T02:47:55.000+0000" }, { "id": "125196", "author": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

confirmed fixed in 1.4.1
\nvalid, needs testcase

{html}", "updateAuthor": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:47:55.000+0000", "updated": "2011-04-15T02:47:55.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }