{ "id": "168990", "key": "TIMOB-24973", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "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": "20238", "description": "", "name": "Release 7.5.0", "archived": false, "released": true, "releaseDate": "2018-11-15" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-07-03T16:39:39.000+0000", "created": "2017-07-18T03:50:55.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2018-09-13T11:07:57.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": "This bug is very easy to reproduce, just follow the step below:\r\n\r\n1. Add below code into tiapp.xml\r\n{code:xml}\r\nUIBackgroundModes\r\n\r\n audio\r\n\r\n2. Using the blow code to do the testing\r\n{code:js}\r\nvar win = Ti.UI.createWindow({\r\n width: Ti.UI.FILL,\r\n height: Ti.UI.FILL,\r\n backgroundColor: '#fff'\r\n});\r\n\r\nvar recorder = Ti.Media.createAudioRecorder({\r\n format: Titanium.Media.AUDIO_FILEFORMAT_WAVE,\r\n compression: Ti.Media.AUDIO_FORMAT_ULAW\r\n})\r\n\r\nvar startBtn = Ti.UI.createButton({\r\n top: 50,\r\n title: 'start'\r\n})\r\n\r\nvar playBtn = Ti.UI.createButton({\r\n top: 100,\r\n title: 'play'\r\n})\r\n\r\nvar stopBtn = Ti.UI.createButton({\r\n top: 150,\r\n title: 'stop'\r\n})\r\n\r\nvar file;\r\n\r\nstartBtn.addEventListener('click', function() {\r\n Titanium.Media.audioSessionCategory = Ti.Media.AUDIO_SESSION_CATEGORY_PLAY_AND_RECORD\r\n recorder.start()\r\n})\r\nplayBtn.addEventListener('click', function() {\r\n Titanium.Media.audioSessionCategory = Titanium.Media.AUDIO_SESSION_CATEGORY_PLAYBACK\r\n var sound = Ti.Media.createSound({\r\n url: file,\r\n allowBackground: true\r\n });\r\n sound.play()\r\n})\r\nstopBtn.addEventListener('click', function() {\r\n file = recorder.stop()\r\n})\r\n\r\nwin.add(startBtn)\r\nwin.add(playBtn)\r\nwin.add(stopBtn)\r\nwin.open()\r\n{code}\r\n\r\n3. Press the start button and lock the screen by press the power button of iPhone, the screen will be locked. Let me tell you what will happen after this\r\n- if you unlock the screen less than 10 seconds after you lock, everthing is fine\r\n- try to waiting more than 10 seconds before you unlocking your device, for example 30 seconds, you'll got a blank record, when you try to play this record it will never stop even thoung it's a blank file.\r\n\r\n*root cause*\r\nEverytime we start a new recording, a temp file will be created, however, the \"ProtectionKey\" is not set properly, so after the screen being locked, we don't have correct rights to write into that file, so we just unprotect this temp file to fix this bug. uh..., how does the magic \"10 seconds\" comes up? As we are know, iOS will left about 10 seconds to every app runing on it to do the cleanup thing before the system pause it(e.g. home button pressed), so if we unlock our device again shortly after we lock it everthing will be fine cause our App is stilling running in \"foreground\" now.\r\n\r\nSorry for my broken English, hopes you guys understand it. If you have any question please let'me know, Thanks.", "attachment": [], "flagged": false, "summary": "iOS: Background audio-recording not working when screen is locked", "creator": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "438803", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-06-28T07:33:22.000+0000", "updated": "2018-06-28T07:33:22.000+0000" }, { "id": "441531", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "*Closing ticket.* Verified improvement in SDK version: {{7.5.0.v20180912080426}}. Background audio now records when the screen is locked for extended periods of time. \r\n\r\n*FR Passed (Test Steps):*\r\n# Created a new Titanium application\r\n# Added the code above in to the application\r\n# Installed app on to the device\r\n# Ran the app\r\n# Pressed {{start}}\r\n# Locked the screen \r\n# waited about 2 minutes\r\n# unlocked the screen \r\n# pressed {{stop}} \r\n# Navigated to the app\r\n# pressed {{play}}\r\n# able to hear the background recording where previously the application would close and the recording would be blank\r\n\r\n*Environment*\r\n{code:java}\r\nAPPC Studio: 5.1.0.201808080937\r\nAPPC CLI: 7.0.6\r\niphone 6 (12.0)\r\nOperating System Name: Mac OS High Sierra\r\nOperating System Version: 10.13.6\r\nNode.js Version: 8.9.1\r\nXcode 10.0 beta 6\r\n{code}\r\n", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-09-13T11:07:46.000+0000", "updated": "2018-09-13T11:07:46.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }