{ "id": "87699", "key": "TIMOB-8633", "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": "10100", "description": "This issue won't be actioned.", "name": "Won't Do" }, "resolutiondate": "2020-01-10T18:04:04.000+0000", "created": "2012-03-11T15:01:40.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "api" ], "versions": [ { "id": "13070", "description": "Release 1.8 Service Pack 2", "name": "Release 1.8.2", "archived": true, "released": true, "releaseDate": "2012-02-29" } ], "issuelinks": [], "assignee": null, "updated": "2020-01-10T18:04:04.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": "h4. Problem Description\r\nWhen trying to set the recording.format property of a AudioRecorder to any format other than Ti.Media.AUDIO_FORMAT_WAVE recording.start() will fail.\r\n\r\nThis can be duplicated in by changing the format in kitchen sink sound_record.js\r\n\r\nh4. Actual Results\r\nrecording.start() failing.\r\n\r\nh4. Expected Results \r\nBeing able to set different audio formats in a record.\r\n\r\nh4. Test case \r\n1. Create new mobile project\r\n2. Paste this code:\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor:'white',\r\n});\r\n\r\nTitanium.Media.audioSessionMode = Ti.Media.AUDIO_SESSION_MODE_PLAY_AND_RECORD;\r\nvar recording = Ti.Media.createAudioRecorder();\r\n\r\n// default compression is Ti.Media.AUDIO_FORMAT_LINEAR_PCM\r\n// default format is Ti.Media.AUDIO_FILEFORMAT_CAF\r\n\r\n// this will give us a wave file with µLaw compression which\r\n// is a generally small size and suitable for telephony recording\r\n// for high end quality, you'll want LINEAR PCM - however, that\r\n// will result in uncompressed audio and will be very large in size\r\nrecording.compression = Ti.Media.AUDIO_FORMAT_ULAW;\r\nrecording.format = Ti.Media.AUDIO_FILEFORMAT_MP4;\r\n\r\nTi.Media.addEventListener('recordinginput', function(e) {\r\n\tTi.API.info('Input availability changed: '+e.available);\r\n\tif (!e.available && recording.recording) {\r\n\t\tb1.fireEvent('click', {});\r\n\t}\r\n});\r\n\r\nvar file;\r\nvar timer;\r\nvar sound;\r\n\r\n\r\nvar label = Titanium.UI.createLabel({\r\n\ttext:'',\r\n\ttop:150,\r\n\tcolor:'#999',\r\n\ttextAlign:'center',\r\n\twidth:'auto',\r\n\theight:'auto'\r\n});\r\n\r\nwin.add(label);\r\n\r\nfunction lineTypeToStr()\r\n{\r\n\tvar type = Ti.Media.audioLineType;\r\n\tswitch(type)\r\n\t{\r\n\t\tcase Ti.Media.AUDIO_HEADSET_INOUT:\r\n\t\t\treturn \"headset\";\r\n\t\tcase Ti.Media.AUDIO_RECEIVER_AND_MIC:\r\n\t\t\treturn \"receiver/mic\";\r\n\t\tcase Ti.Media.AUDIO_HEADPHONES_AND_MIC:\r\n\t\t\treturn \"headphones/mic\";\r\n\t\tcase Ti.Media.AUDIO_HEADPHONES:\r\n\t\t\treturn \"headphones\";\r\n\t\tcase Ti.Media.AUDIO_LINEOUT:\r\n\t\t\treturn \"lineout\";\r\n\t\tcase Ti.Media.AUDIO_SPEAKER:\r\n\t\t\treturn \"speaker\";\r\n\t\tcase Ti.Media.AUDIO_MICROPHONE:\r\n\t\t\treturn \"microphone\";\r\n\t\tcase Ti.Media.AUDIO_MUTED:\r\n\t\t\treturn \"silence switch on\";\r\n\t\tcase Ti.Media.AUDIO_UNAVAILABLE:\r\n\t\t\treturn \"unavailable\";\r\n\t\tcase Ti.Media.AUDIO_UNKNOWN:\r\n\t\t\treturn \"unknown\";\r\n\t}\r\n}\r\n\r\nvar linetype = Titanium.UI.createLabel({\r\n\ttext: \"audio line type: \"+lineTypeToStr(),\r\n\tbottom:20,\r\n\tcolor:'#999',\r\n\ttextAlign:'center',\r\n\twidth:'auto',\r\n\theight:'auto'\r\n});\r\n\r\nwin.add(linetype);\r\n\r\nvar volume = Titanium.UI.createLabel({\r\n\ttext: \"volume: \"+Ti.Media.volume,\r\n\tbottom:50,\r\n\tcolor:'#999',\r\n\ttextAlign:'center',\r\n\twidth:'auto',\r\n\theight:'auto'\r\n});\r\n\r\nwin.add(volume);\r\n\r\nTi.Media.addEventListener('linechange',function(e)\r\n{\r\n\tlinetype.text = \"audio line type: \"+lineTypeToStr();\r\n});\r\n\r\nTi.Media.addEventListener('volume',function(e)\r\n{\r\n\tvolume.text = \"volume: \"+e.volume;\r\n});\r\n\r\nvar duration = 0;\r\n\r\nfunction showLevels()\r\n{\r\n\tvar peak = Ti.Media.peakMicrophonePower;\r\n\tvar avg = Ti.Media.averageMicrophonePower;\r\n\tduration++;\r\n\tlabel.text = 'duration: '+duration+' seconds\\npeak power: '+peak+'\\navg power: '+avg;\r\n}\r\n\r\nvar b1 = Titanium.UI.createButton({\r\n\ttitle:'Start Recording',\r\n\twidth:200,\r\n\theight:40,\r\n\ttop:20\r\n});\r\nb1.addEventListener('click', function()\r\n{\r\n\tif (recording.recording)\r\n\t{\r\n\t\tfile = recording.stop();\r\n\t\tb1.title = \"Start Recording\";\r\n\t\tb2.show();\r\n\t\tpause.hide();\r\n\t\tclearInterval(timer);\r\n\t\tTi.Media.stopMicrophoneMonitor();\r\n\t}\r\n\telse\r\n\t{\r\n\t\tif (!Ti.Media.canRecord) {\r\n\t\t\tTi.UI.createAlertDialog({\r\n\t\t\t\ttitle:'Error!',\r\n\t\t\t\tmessage:'No audio recording hardware is currently connected.'\r\n\t\t\t}).show();\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tb1.title = \"Stop Recording\";\r\n\t\trecording.start();\r\n\t\tb2.hide();\r\n\t\tpause.show();\r\n\t\tTi.Media.startMicrophoneMonitor();\r\n\t\tduration = 0;\r\n\t\ttimer = setInterval(showLevels,1000);\r\n\t}\r\n});\r\nwin.add(b1);\r\n\r\nvar pause = Titanium.UI.createButton({\r\n\ttitle:'Pause recording',\r\n\twidth:200,\r\n\theight:40,\r\n\ttop:80\r\n});\r\nwin.add(pause);\r\npause.hide();\r\n\r\npause.addEventListener('click', function() {\r\n\tif (recording.paused) {\r\n\t\tpause.title = 'Pause recording';\r\n\t\trecording.resume();\r\n\t\ttimer = setInterval(showLevels,1000);\r\n\t}\r\n\telse {\r\n\t\tpause.title = 'Unpause recording';\r\n\t\trecording.pause();\r\n\t\tclearInterval(timer);\r\n\t}\r\n});\r\n\r\nvar b2 = Titanium.UI.createButton({\r\n\ttitle:'Playback Recording',\r\n\twidth:200,\r\n\theight:40,\r\n\ttop:80\r\n});\r\n\r\nwin.add(b2);\r\nb2.hide();\r\nb2.addEventListener('click', function()\r\n{\r\n\tif (sound && sound.playing)\r\n\t{\r\n\t\tsound.stop();\r\n\t\tsound.release();\r\n\t\tsound = null;\r\n\t\tb2.title = 'Playback Recording';\r\n\t}\r\n\telse\r\n\t{\r\n\t\tTi.API.info(\"recording file size: \"+file.size);\r\n\t\tsound = Titanium.Media.createSound({sound:file});\r\n\t\tsound.addEventListener('complete', function()\r\n\t\t{\r\n\t\t\tb2.title = 'Playback Recording';\r\n\t\t});\r\n\t\tsound.play();\r\n\t\tb2.title = 'Stop Playback';\r\n\t}\r\n});\r\n\r\nvar switchLabel = Titanium.UI.createLabel({\r\n\ttext:'Hi-fidelity:',\r\n\twidth:'auto',\r\n\theight:'auto',\r\n\ttextAlign:'center',\r\n\tcolor:'#999',\r\n\tbottom:115\r\n});\r\nvar switcher = Titanium.UI.createSwitch({\r\n\tvalue:false,\r\n\tbottom:80\r\n});\r\n\r\nswitcher.addEventListener('change',function(e)\r\n{\r\n\tif (!switcher.value)\r\n\t{\r\n\t\trecording.compression = Ti.Media.AUDIO_FORMAT_ULAW;\r\n\t}\r\n\telse\r\n\t{\r\n\t\trecording.compression = Ti.Media.AUDIO_FORMAT_LINEAR_PCM;\r\n\t}\r\n});\r\nwin.add(switchLabel);\r\nwin.add(switcher);\r\n\r\nwin.open();\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "iOS: AudioRecorder fails with any format other than AUDIO_FILEFORMAT_WAVE", "creator": { "name": "bernesto", "key": "bernesto", "displayName": "Brian Ernesto", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "bernesto", "key": "bernesto", "displayName": "Brian Ernesto", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "OSX 10.7.3 \r\nTitanium Studio: 1.0.9\r\nTitanium SKD 1.8.2", "comment": { "comments": [ { "id": "189728", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "Hello Brian,\r\n\r\ncan you please paste the error you are getting?\r\n\r\nBest,\r\n\r\nMauro ", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2012-04-03T15:59:33.000+0000", "updated": "2012-04-03T15:59:33.000+0000" }, { "id": "189730", "author": { "name": "bernesto", "key": "bernesto", "displayName": "Brian Ernesto", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Unfortunately, no error is presented. Calling recording.start() never changes boolean property recording.recording to true and file.size always 0. If you change the format, then all is well.\r\n\r\nThere were a few posts around the foums and internet with others noting the issue popping up back around 1.6 I believe.", "updateAuthor": { "name": "bernesto", "key": "bernesto", "displayName": "Brian Ernesto", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-04-03T16:11:52.000+0000", "updated": "2012-04-03T16:11:52.000+0000" }, { "id": "453644", "author": { "name": "ahutton", "key": "ahutton", "displayName": "Alan Hutton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This issue is out of date with our current supported SDK release (7.5.2.GA as of the date of closure), and out of date with mobile OS versions. \r\n\r\nIf community members feel that the issue is still valid, please create a new ticket. Please reference this closed ticket number, include SDK used, comments, and code that demonstrates/reproduces the issue.", "updateAuthor": { "name": "ahutton", "key": "ahutton", "displayName": "Alan Hutton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-01-10T18:04:04.000+0000", "updated": "2020-01-10T18:04:04.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }