{ "id": "106273", "key": "TIMOB-12020", "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": [ { "id": "15274", "description": "2013 Sprint 06 API", "name": "2013 Sprint 06 API", "archived": true, "released": true, "releaseDate": "2013-03-25" }, { "id": "14816", "description": "2013 Sprint 06", "name": "2013 Sprint 06", "archived": true, "released": true, "releaseDate": "2013-03-25" } ], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2013-03-21T01:33:09.000+0000", "created": "2012-12-11T12:30:57.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-21T19:17:38.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": "h1. Problem description\r\nWhen playing a sound downloaded in the application data directory, on certain devices (e.g. HTC Desire HD) the sound doesn't play. Everything works fine with other devices, or with the same device using the external directory.\r\n\r\nh1. Steps to reproduce\r\nUse this code to reproduce the issue:\r\n\r\n{code}\r\n// Create a window\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor : 'white',\r\n layout: 'vertical'\r\n});\r\n\r\nfunction download() {\r\n var xhr = Ti.Network.createHTTPClient({\r\n onload: function() {\r\n var data = this.responseData;\r\n var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'test.mp3');\r\n file.write(data);\r\n\r\n alert(\"File downloaded\");\r\n }\r\n });\r\n xhr.open('GET', '[MP3 URL HERE]');\r\n xhr.send();\r\n}\r\n\r\n\r\nfunction play() {\r\n // load from application directory\r\n var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'test.mp3');\r\n Ti.API.info(file.nativePath);\r\n var sound = Titanium.Media.createSound({url:file.nativePath});\r\n sound.play();\r\n sound.addEventListener('error', function(e) {\r\n dialog = Ti.UI.createAlertDialog({\r\n message : \"Audio playback failed\",\r\n buttonNames : ['OK']\r\n });\r\n dialog.show();\r\n }); \r\n}\r\n\r\nvar btn1 = Ti.UI.createButton({\r\n title: \"Download\"\r\n});\r\nbtn1.addEventListener('click', download);\r\n\r\nvar btn2 = Ti.UI.createButton({\r\n title: \"Play\"\r\n});\r\nbtn2.addEventListener('click', play);\r\n\r\nwin.add(btn1);\r\nwin.add(btn2);\r\n\r\nwin.open();\r\n{code}\r\n\r\nRunning the code on HTC devices does not play the sound.", "attachment": [ { "id": "34238", "filename": "log.txt", "author": { "name": "btran", "key": "btran", "displayName": "Betty Tran", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-12-18T12:39:51.000+0000", "size": 3544, "mimeType": "text/plain" } ], "flagged": false, "summary": "Android: audio file in application data directory does not play on certain devices", "creator": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "environment": "SDK 2.1.4\r\nAndroid 2.3.5\r\nHTC Desire HD", "comment": { "comments": [ { "id": "231827", "author": { "name": "btran", "key": "btran", "displayName": "Betty Tran", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with a HTC Desire HD and attaching a log file.", "updateAuthor": { "name": "btran", "key": "btran", "displayName": "Betty Tran", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-12-18T12:39:51.000+0000", "updated": "2012-12-18T12:39:51.000+0000" }, { "id": "233070", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Also, does this happen with all sound files or just ones of a certain type?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-03T14:05:06.000+0000", "updated": "2013-01-03T14:05:27.000+0000" }, { "id": "242420", "author": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "body": "device specific\n\njithinpv", "updateAuthor": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-15T09:44:33.000+0000", "updated": "2013-03-15T09:44:33.000+0000" }, { "id": "243335", "author": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Based on the [doc|http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.Filesystem-property-applicationDataDirectory], the sound file in the application data directory cannot be accessed by the android media player which is “another” application and requires world-readable permissions for the application’s local media files. “World-readable” means another application can see it. Therefore, the downloaded sound file should be stored in externalStorageDirectory if the user wants to play it. Mark the ticket as invalid.", "updateAuthor": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-21T01:32:19.000+0000", "updated": "2013-03-21T01:32:19.000+0000" }, { "id": "330617", "author": { "name": "etruta", "key": "etruta", "displayName": "Eduardo Silva", "active": true, "timeZone": "America/Sao_Paulo" }, "body": "I have the same issue in the Galaxy Nexus device.\r\n\r\n[ERROR] : MediaPlayer: error (1, -2147483648)", "updateAuthor": { "name": "etruta", "key": "etruta", "displayName": "Eduardo Silva", "active": true, "timeZone": "America/Sao_Paulo" }, "created": "2014-11-03T22:26:15.000+0000", "updated": "2014-11-03T22:26:15.000+0000" }, { "id": "414341", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as invalid.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-21T19:17:38.000+0000", "updated": "2017-03-21T19:17:38.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }