{ "id": "171192", "key": "AC-5622", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "10000", "description": "", "name": "Done" }, "resolutiondate": "2018-03-06T21:30:59.000+0000", "created": "2018-02-25T21:23:31.000+0000", "labels": [], "versions": [ { "id": "17038", "name": "Appcelerator Studio 4.5.0", "archived": false, "released": false } ], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2018-03-06T21:30:59.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "I'm creating an app to record sound from the microphone. This code was working before but suddenly the simulator crashes. I thought it was my app, so I tried to isolate it in a separate app to test it. But if I use the code from http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Media.AudioRecorder and adjust it a little bit to my code the simulator also the simulator crashes without giving any pointer to the problem.\r\n\r\nMy code:\r\nadded permission: {{NSMicrophoneUsageDescription}}\r\napp.js\r\n{code:javascript}\r\nvar window = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\n\r\nvar recordStart = Ti.UI.createButton({\r\n title: 'Start',\r\n top: 10\r\n});\r\n\r\nvar recordPause = Ti.UI.createButton({\r\n title: 'Pause',\r\n top: 60\r\n});\r\n\r\nvar recordStop = Ti.UI.createButton({\r\n title: 'Stop',\r\n top: 110\r\n});\r\n\r\nvar recordPlay = Ti.UI.createButton({\r\n title: 'Play',\r\n top: 160\r\n});\r\n\r\nvar audioRecorder = Ti.Media.createAudioRecorder();\r\nvar record;\r\nvar audioPlayer;\r\nvar voiceFile;\r\nvar recDir = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'Recordings');\r\n if(!recDir.exists()){\r\n recDir.createDirectory();\r\n };\r\n\r\nwindow.addEventListener('open', function(e) {\r\n if (!Ti.Media.hasAudioRecorderPermissions()) {\r\n Ti.Media.requestAudioRecorderPermissions(function(e) {\r\n if (e.success) {\r\n window.add(recordStart);\r\n }\r\n });\r\n } else {\r\n window.add(recordStart);\r\n }\r\n});\r\n\r\nrecordStart.addEventListener('click', function(e) {\r\n audioRecorder.start();\r\n});\r\n\r\nrecordPause.addEventListener('click', function(e) {\r\n if (audioRecorder.getPaused()) {\r\n recordPause.setTitle('Pause');\r\n audioRecorder.resume();\r\n } else {\r\n recordPause.setTitle('Resume');\r\n audioRecorder.pause();\r\n }\r\n});\r\n\r\nrecordStop.addEventListener('click', function(e) {\r\n\r\n\trecord = audioRecorder.stop();\r\n\tvar date = new Date();\r\n\tvar millisec = date.getMilliseconds();\r\n\tvoiceFile = Ti.Filesystem.getFile(recDir.nativePath, \"Test_\"+ millisec +\".mp4\");\r\n voiceFile.write(record);\r\n Ti.API.info(\"voiceFile native \" + voiceFile.nativePath);\r\n});\r\n\r\nrecordPlay.addEventListener('click', function(e) {\r\n Ti.API.info(\"start playing sound\");\r\n Ti.API.info(\"voiceFile native \" + voiceFile.nativePath);\r\n audioPlayer = Ti.Media.createAudioPlayer({\r\n url: voiceFile.nativePath\r\n });\r\n audioPlayer.start();\r\n});\r\n\r\nwindow.add(recordPause);\r\nwindow.add(recordStop);\r\nwindow.add(recordPlay);\r\n\r\nwindow.open();\r\n{code}", "attachment": [ { "id": "64900", "filename": "console trace log.txt", "author": { "name": "mvschilt", "key": "mvschilt", "displayName": "mvschilt", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-02-25T21:22:40.000+0000", "size": 32960, "mimeType": "text/plain" } ], "flagged": false, "summary": "ios simulator crashes when playing a sound from local filesystem", "creator": { "name": "mvschilt", "key": "mvschilt", "displayName": "mvschilt", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mvschilt", "key": "mvschilt", "displayName": "mvschilt", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Axway Appcelerator Studio 5.0.0.201712081732-08122017173253\r\n\r\nOperating System\r\n Name = Mac OS X\r\n Version = 10.13.3\r\n Architecture = 64bit\r\n # CPUs = 4\r\n Memory = 8589934592\r\nNode.js\r\n Node.js Version = 8.9.3\r\n npm Version = 5.5.1\r\nTitanium CLI\r\n CLI Version = 5.0.14\r\nTitanium SDK\r\n SDK Version = 7.0.2.GA\r\n SDK Path = /Users/michielvanschilt/Library/Application Support/Titanium/mobilesdk/osx/7.0.2.GA\r\n Target Platform = iphone", "comment": { "comments": [ { "id": "434884", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello [~mvschilt], Thanks for sharing with us. Can you please share us the exact test case to reproduce this on our end and the error logs during the app crash.", "updateAuthor": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2018-02-26T06:04:07.000+0000", "updated": "2018-02-26T06:04:07.000+0000" }, { "id": "434890", "author": { "name": "mvschilt", "key": "mvschilt", "displayName": "mvschilt", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi @mrahman, \r\n\r\nThanks for your response.\r\nI've got the main part of the code from the example given on page http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Media.AudioRecorder. I added the lines to the code so the file is saved in a specific folder within the Titanium.Filesystem.applicationDataDirectory.\r\n\r\nThe testcase to reproduce:\r\npush start button (Start recording)\r\npush stop button (Stop recording)\r\npush play button (Play sound)\r\n\r\nThe expectation is that when pushing the play button the sound will be played. Instead the simulator ends abnormally and no error is logged. ", "updateAuthor": { "name": "mvschilt", "key": "mvschilt", "displayName": "mvschilt", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-02-26T08:07:28.000+0000", "updated": "2018-02-26T08:08:01.000+0000" }, { "id": "434891", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey there! When exactly did that work before? Which SDK version? Or do you mean it worked inside the app and then crashes?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-26T08:32:29.000+0000", "updated": "2018-02-26T08:32:29.000+0000" }, { "id": "434895", "author": { "name": "mvschilt", "key": "mvschilt", "displayName": "mvschilt", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Hans Knöchel,\r\n\r\nI made a successful build on the 6th of February with SDK 7.0.0.GA.\r\nWhen I build the app with the SDK to 7.0.0.GA, then also this problem occurs. \r\nBefore this functionality worked in the app. The sound was playing. But now the simulator crashes. \r\n\r\nCan you reproduce it?\r\n\r\nBest regards,\r\n\r\nMichiel", "updateAuthor": { "name": "mvschilt", "key": "mvschilt", "displayName": "mvschilt", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-02-26T09:11:30.000+0000", "updated": "2018-02-26T09:11:30.000+0000" }, { "id": "434902", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey @[~mvschilt], so first of all, you need to set a proper [audio session category|http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Media-property-audioSessionCategory] before:\r\n{code:js}\r\nTi.Media.audioSessionCategory = Ti.Media.AUDIO_SESSION_CATEGORY_PLAY_AND_RECORD;\r\n{code}\r\nBut after that, the app still seems to crash when playing the audio again, although I am not sure if that may be related to the mp4 format which is rather a video than audio format. I will dig some more into this, but this does not seem to be an SDK issue.\r\n\r\n*EDIT*: See [this example|https://github.com/appcelerator/KitchenSink/blob/stable/Resources/ui/handheld/ios/phone/sound_record.js] for more details.\r\n\r\n*EDIT 2*: The following works:\r\n{code:js}\r\nvar window = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\n\r\nTi.Media.audioSessionCategory = Ti.Media.AUDIO_SESSION_CATEGORY_PLAY_AND_RECORD;\r\n \r\nvar recordStart = Ti.UI.createButton({\r\n title: 'Start',\r\n top: 200\r\n});\r\n \r\nvar recordPause = Ti.UI.createButton({\r\n title: 'Pause',\r\n top: 60\r\n});\r\n \r\nvar recordStop = Ti.UI.createButton({\r\n title: 'Stop',\r\n top: 110\r\n});\r\n \r\nvar recordPlay = Ti.UI.createButton({\r\n title: 'Play',\r\n top: 160\r\n});\r\n \r\nvar audioRecorder = Ti.Media.createAudioRecorder({\r\n compression: Ti.Media.AUDIO_FORMAT_AAC,\r\n format: Ti.Media.AUDIO_FILEFORMAT_MP4\r\n});\r\nvar record;\r\nvar audioPlayer;\r\nvar voiceFile;\r\nvar recDir = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'Recordings');\r\n if(!recDir.exists()){\r\n recDir.createDirectory();\r\n };\r\n \r\nwindow.addEventListener('open', function(e) {\r\n if (!Ti.Media.hasAudioRecorderPermissions()) {\r\n Ti.Media.requestAudioRecorderPermissions(function(e) {\r\n if (e.success) {\r\n window.add(recordStart);\r\n }\r\n });\r\n } else {\r\n window.add(recordStart);\r\n }\r\n});\r\n \r\nrecordStart.addEventListener('click', function(e) {\r\n audioRecorder.start();\r\n});\r\n \r\nrecordPause.addEventListener('click', function(e) {\r\n if (audioRecorder.getPaused()) {\r\n recordPause.setTitle('Pause');\r\n audioRecorder.resume();\r\n } else {\r\n recordPause.setTitle('Resume');\r\n audioRecorder.pause();\r\n }\r\n});\r\n \r\nrecordStop.addEventListener('click', function(e) {\r\n \r\n\trecord = audioRecorder.stop();\r\n\tvar date = new Date();\r\n\tvar millisec = date.getMilliseconds();\r\n\tvoiceFile = Ti.Filesystem.getFile(recDir.nativePath, \"Test_\"+ millisec +\".mp4\");\r\n voiceFile.write(record);\r\n Ti.API.info(\"voiceFile native \" + voiceFile.nativePath);\r\n});\r\n \r\nrecordPlay.addEventListener('click', function(e) {\r\n Ti.API.info(\"start playing sound\");\r\n Ti.API.info(\"voiceFile native \" + voiceFile.nativePath);\r\n audioPlayer = Ti.Media.createAudioPlayer({\r\n url: voiceFile.nativePath\r\n });\r\n audioPlayer.start();\r\n});\r\n \r\nwindow.add(recordPause);\r\nwindow.add(recordStop);\r\nwindow.add(recordPlay);\r\n \r\nwindow.open();\r\n{code}\r\nWe should update the docs to reflect this configuration. Let us know if it works for you as well! The AudioRecorder API is pretty powerful, but also requires some configuration.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-26T11:31:46.000+0000", "updated": "2018-02-26T11:39:16.000+0000" }, { "id": "434915", "author": { "name": "mvschilt", "key": "mvschilt", "displayName": "mvschilt", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Hans,\r\n\r\nThank you very much for your digging. It works fine at my side, I added some code to clear the record variable. so when you record again this variable will be empty.\r\n\r\n{code:javascript}\r\nrecordStart.addEventListener('click', function(e) {\r\n\trecord = '';\r\n audioRecorder.start();\r\n});\r\n{code}\r\n\r\nBut I'm still wondering if there was someting changed in the SDK, because I believe the code is handled more strict. Before I had this code:\r\n$.Login.fbProxy = fb.createActivityWorker({lifecycleContainer: $.Login});\r\nRunning it on ios didn't cause any problem. \r\n\r\nBut as the issue logged in this ticket the app also crashed, so I made it specifically for android platform and there was no problem anymore. \r\n\r\nThanks for your help. ", "updateAuthor": { "name": "mvschilt", "key": "mvschilt", "displayName": "mvschilt", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-02-26T16:16:08.000+0000", "updated": "2018-02-26T16:16:08.000+0000" }, { "id": "434916", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "{{createActivityWorker}} is Android only, so if it didn't cause issues on iOS before, that was the actual issue. 7.0.0 uses the native JSCore by default, which reduces the app size and brings other advantages like the safari debugger. But you can still try to disable it by using {{false}}. Can we resolve this issue? Let me know!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-02-26T16:20:16.000+0000", "updated": "2018-02-26T16:20:16.000+0000" }, { "id": "434930", "author": { "name": "mvschilt", "key": "mvschilt", "displayName": "mvschilt", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Hans,\r\n\r\nAh that is good to know, thanks for letting me know. \r\n\r\nyes the issue can be put to resolved. Many thanks for your help.\r\n\r\nBest regards,\r\n\r\nMichiel\r\n", "updateAuthor": { "name": "mvschilt", "key": "mvschilt", "displayName": "mvschilt", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-02-26T20:33:45.000+0000", "updated": "2018-02-26T20:33:45.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }