{ "id": "173678", "key": "TIMOB-27105", "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": "2019-08-20T17:13:58.000+0000", "created": "2019-05-28T14:47:57.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2019-08-20T17:13:58.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": "In project, the customer is trying to download an audio file from server and playing it in Android application. In Android, with Titanium.Media.Sound API they are observing “error” event handler is being fired, even though the Audio is playing correctly. And this behaviour is being observed only in *Samsung S4 with OS version 4.4.2, Samsung G6 with OS version 8.0.0 and Samsung J7 with Os version 7.1.0*. \r\n\r\nAnd it is working fine with out firing error event handler in Nexus with OS version 6.0.1, Google pixel with OS version 9.0. \r\n\r\n\r\n\r\n*Note:* The customer's app is currently running with 7.5.2.GA . The issue is tested on our end with SDK 7.5.2.GA and 8.0.1.GA. The “error” event handler is being fired on *Samsung J7 Prime2 v8.0.0 device.*\r\n\r\nTest code:\r\n\r\n{code}\r\nvar accessToken;\r\nvar win = Ti.UI.createWindow({\r\n\ttitle : \"Main window\",\r\n\tbackgroundColor : \"white\" \r\n});\r\nvar button = Ti.UI.createButton({\r\n\ttitle : \"Audio\"\r\n});\r\nbutton.addEventListener('click', function(e) {\r\n\tvar sound = Titanium.Media.createSound({\r\n\t\turl: \"SampleAudio.mp3\", \r\n\t\tallowBackground : true,\r\n\t\tvolume : 1.0\r\n\t});\r\n\tsound.play();\r\n\tsound.addEventListener('complete', function(evt1) {\r\n\t\tsound.release();\r\n\t});\r\n\tsound.addEventListener('error', function(evt2){\r\n\t\tTi.API.info('Error in sound::'+JSON.stringify(evt2));\r\n\t\tif (evt2.error.toLowerCase().trim() === 'unknown media issue.') {\r\n\t\t\treturn;\r\n\t\t} else {\r\n\t\t\tdialog = Ti.UI.createAlertDialog({\r\n\t\t\t\tmessage : \"Audio failed\",\r\n\t\t\t\tbuttonNames : ['OK']\r\n\t\t\t});\r\n\t\t\tdialog.show();\r\n\t\t\tsound.release();\r\n\t\t}\r\n\t});\r\n});\r\nwin.add(button);\r\nwin.open();\r\n\r\n{code}\r\n\r\n*Test steps:*\r\n\r\n1.Create a classic app and replace app.js with the attached app.js file. \r\n2. Download the sample audio file and place in Resources/android folder. \r\n3.Run the app , \"Click Audio\" and you will observe the issue. \r\n\r\n{code}\r\n[INFO] Error in sound::{\"type\":\"error\",\"source\":{\"volume\":1,\"url\":\"file:///android_asset/Resources/SampleAudio.mp3\",\"time\":0,\"playing\":true,\"audioType\":0,\"looping\":false,\"paused\":fals\r\ne,\"duration\":27745,\"apiName\":\"Ti.Media.Sound\",\"bubbleParent\":true,\"allowBackground\":true,\"state\":3,\"stateDescription\":\"playing\",\"_events\":{\"complete\":{},\"error\":{}}},\"bubbles\":false,\"success\r\n\":false,\"code\":-1,\"error\":\"Unknown media issue.\",\"cancelBubble\":false}\r\n{code}", "attachment": [ { "id": "66648", "filename": "audioplayer_fulllog_8.0sdk.rtf", "author": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2019-05-28T14:43:48.000+0000", "size": 77330, "mimeType": "text/rtf" }, { "id": "66647", "filename": "audioplayer_fulllog.rtf", "author": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2019-05-28T14:43:48.000+0000", "size": 90416, "mimeType": "text/rtf" }, { "id": "66649", "filename": "consoleLog_Samsung J7 Prime2 v8.0.0_7.5.2GA.txt", "author": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2019-05-28T14:42:51.000+0000", "size": 30743, "mimeType": "text/plain" }, { "id": "66646", "filename": "SampleAudio.mp3", "author": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2019-05-28T14:45:44.000+0000", "size": 443926, "mimeType": "audio/mp3" } ], "flagged": false, "summary": "Android:Ti.Media.Sound is triggering error event handler ", "creator": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "449103", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I'm able to reproduce this issue on a Samsung Galaxy Tab 3.\r\n\r\nThis device is natively reporting integer code {{973}} when this happens, which is not a documented constant. Apparently, this is a common issue as can be seen below.\r\nhttps://stackoverflow.com/questions/22202745/what-is-mediaplayer-oninfolistener-code-973\r\nhttps://stackoverflow.com/questions/27912581/what-does-mediaplayer-info-warning-973-0-mean\r\nhttps://github.com/google/ExoPlayer/issues/6029\r\n\r\nI don't think there is anything we can do about it. Some devices just don't following Google's documented rules. The good news is that the audio still plays. So, checking the error message like you're doing and ignoring it is really the only option. I do recommend that you check if the event's \"code\" property is set to {{-1}} instead of looking at the string. A value of {{-1}} is more of a warning where the audio is still playable but the system is saying there is something it doesn't like about the audio file.\r\nhttps://docs.appcelerator.com/platform/latest/#!/api/Titanium.Media.Sound-event-error\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-06-15T03:21:57.000+0000", "updated": "2019-06-15T03:21:57.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }