{ "id": "163914", "key": "TIMOB-24024", "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": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2016-11-10T19:23:16.000+0000", "created": "2016-10-12T22:50:50.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "fmerzadyan-OLD", "key": "fmerzadyan", "displayName": "Farzad Merzadyan", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2016-11-10T19:23:20.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "For TIMOB8418, the app plays Dancing in the Street by Martha and the Vandellas. However, there is no way to stop the music playing. The track just carries on and you have to kill the Media Module application to stop it playing. This occurs on iOS (10.) and Android devices (6.0.1).\r\n\r\nApp.js\r\n{code}\r\nfunction askCalendarPermission(){\r\n\tif (Ti.Calendar.hasCalendarPermissions()) {\r\n\t\tTi.Calendar.getAllCalendars();\r\n\t\taskContactPermission();\t \t\r\n\t } else {\r\n\t Ti.Calendar.requestCalendarPermissions(function(e) {\r\n\t if (e.success === true) {\r\n\t Ti.API.info(\"Calendar Permissions Granted\");\r\n\t Ti.Calendar.getAllCalendars();\r\n\t askContactPermission();\r\n\t } else {\r\n\t alert(\"Access denied, error: \" + e.error);\r\n\t }\r\n\t });\r\n\t }\r\n}\r\n\r\nfunction askContactPermission(){\r\n\tif (Ti.Contacts.hasContactsPermissions()) {\r\n\t\t\tTi.Contacts.getAllPeople();\r\n\t askCameraPermissions(); \r\n\t } else {\r\n\t Ti.Contacts.requestContactsPermissions(function(e) {\r\n\t if (e.success === true) { \r\n\t \t Ti.API.info(\"Contacts Permissions Granted\");\r\n\t \t Ti.Contacts.getAllPeople();\r\n\t askCameraPermissions(); \r\n\t } else {\r\n\t alert(\"Access denied, error: \" + e.error);\r\n\t }\r\n\t });\r\n\t }\r\n}\r\n\r\n//Added camera permissions in the tiapp.xml for camera because permissions get added to the android manifest only if showCamera() is called below. But its not fesible here as opening a camera before app launches just to add camera permissions looks stupid.\r\nfunction askCameraPermissions(){\r\nif (Ti.Media.hasCameraPermissions()) {\r\n require('ui').createApplicationTabGroup().open(); \r\n } else { \r\n Ti.Media.requestCameraPermissions(function(e) {\r\n if (e.success === true) {\r\n \tTi.API.info(\"Camera Permissions Granted\");\r\n require('ui').createApplicationTabGroup().open();\r\n } else {\r\n alert(\"Access denied, error: \" + e.error);\r\n }\r\n });\r\n }\r\n}\r\n\r\naskCalendarPermission();\r\n{code}\r\n", "attachment": [ { "id": "60509", "filename": "code TIMOB8418.docx", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-10-12T22:48:29.000+0000", "size": 70497, "mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document" }, { "id": "60519", "filename": "screenshot-1.png", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-10-13T20:12:33.000+0000", "size": 46789, "mimeType": "image/png" } ], "flagged": false, "summary": "TIMOB8418 Music won't stop playing after exiting", "creator": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "398815", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Please provide a reproducible demo-code (best in a single app.js), thank you!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-10-13T08:49:04.000+0000", "updated": "2016-10-13T08:49:04.000+0000" }, { "id": "399809", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~lmorris] The provided code is not related to this ticket (it's related to permissions in general), can you change it to the one you specified in your image?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-10-25T18:57:19.000+0000", "updated": "2016-10-25T18:57:19.000+0000" }, { "id": "399811", "author": { "name": "fmerzadyan-OLD", "key": "fmerzadyan", "displayName": "Farzad Merzadyan", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Speaking for Android (not sure about iOS): Looks like setting allowBackground property, in Ti.Media.createAudioPlayer, to false does not stop audio when app is exited. The audio can be stopped or resumed by calling audioPlayer.stop() via button click and also the audio can be stopped if app is destroyed from open apps slider.", "updateAuthor": { "name": "fmerzadyan-OLD", "key": "fmerzadyan", "displayName": "Farzad Merzadyan", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-10-25T19:14:00.000+0000", "updated": "2016-10-25T19:14:00.000+0000" }, { "id": "399878", "author": { "name": "fmerzadyan-OLD", "key": "fmerzadyan", "displayName": "Farzad Merzadyan", "active": false, "timeZone": "America/Los_Angeles" }, "body": "[~hansknoechel] This is what I have for app.js. You need to download a supported sound file and change the url:\r\n\r\n\r\n{code:java}\r\nvar win = Titanium.UI.createWindow({\r\n\ttitle:'Audio Test',\r\n\tbackgroundColor:'#fff',\r\n\tlayout: 'vertical'\r\n});\r\n\r\nvar startStopButton = Titanium.UI.createButton({\r\n\ttitle:'Start/Stop Streaming',\r\n\ttop:10,\r\n\twidth:200,\r\n\theight:40\r\n});\r\n\r\nvar pauseResumeButton = Titanium.UI.createButton({\r\n\ttitle:'Pause/Resume Streaming',\r\n\ttop:10,\r\n\twidth:200,\r\n\theight:40,\r\n\tenabled:false\r\n});\r\n\r\nwin.add(startStopButton);\r\nwin.add(pauseResumeButton);\r\n\r\n// allowBackground: true on Android allows the \r\n// player to keep playing when the app is in the \r\n// background.\r\nvar audioPlayer = Ti.Media.createAudioPlayer({\r\n\tallowBackground: true,\r\n\turl: 'sample.mp3'\r\n});\r\n\r\nstartStopButton.addEventListener('click',function() {\r\n\t// When paused, playing returns false.\r\n\t// If both are false, playback is stopped.\r\n\tif (audioPlayer.playing || audioPlayer.paused)\r\n\t{\r\n\t\taudioPlayer.stop();\r\n\t\tpauseResumeButton.enabled = false;\r\n\t\tif (Ti.Platform.name === 'android')\r\n\t\t{\r\n\t\t\taudioPlayer.release();\r\n\t\t}\r\n\t}\r\n\telse\r\n\t{\r\n\t\taudioPlayer.start();\r\n\t\tpauseResumeButton.enabled = true;\r\n\t}\r\n});\r\n\r\npauseResumeButton.addEventListener('click', function() {\r\n\tif (audioPlayer.paused) {\r\n\t\taudioPlayer.start();\r\n\t}\r\n\telse {\r\n\t\taudioPlayer.pause();\r\n\t}\r\n});\r\n\r\naudioPlayer.addEventListener('progress',function(e) {\r\n\tTi.API.info('Time Played: ' + Math.round(e.progress) + ' milliseconds');\r\n});\r\n\r\naudioPlayer.addEventListener('change',function(e)\r\n{\r\n\tTi.API.info('State: ' + e.description + ' (' + e.state + ')');\r\n});\r\n\r\nwin.addEventListener('close',function() {\r\n\taudioPlayer.stop();\r\n\tif (Ti.Platform.osname === 'android')\r\n\t{\r\n\t\taudioPlayer.release();\r\n\t}\r\n});\r\n\r\nwin.open();\r\n\r\n{code}\r\n\r\n", "updateAuthor": { "name": "fmerzadyan-OLD", "key": "fmerzadyan", "displayName": "Farzad Merzadyan", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-10-26T18:13:29.000+0000", "updated": "2016-10-26T18:13:29.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }