{ "id": "100587", "key": "AC-1941", "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": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-10-05T23:27:51.000+0000", "created": "2012-09-06T16:44:33.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "vjoshi", "key": "vjoshi", "displayName": "Varun Joshi", "active": true, "timeZone": "America/New_York" }, "updated": "2016-03-08T07:40:52.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": [], "description": "Same problem as TC-1228 is for video but this is for sound. Permissioning on Android prevents media player to play sound file through url and has to play through file descriptor.\r\n\r\n\r\n\t\t\tif (URLUtil.isAssetUrl(url)) {\r\n\t\t\t\tContext context = TiApplication.getInstance();\r\n\t\t\t\tString path = url.substring(TiConvert.ASSET_URL.length());\r\n\t\t\t\t\r\n\t\t\t\t// Needed to handle native path urls\r\n\t\t\t\tpath = path.replace(\"Resources//\", \"Resources/\");\r\n\t\t\t\t\r\n\t\t\t\tAssetFileDescriptor afd = null;\r\n\t\t\t\ttry {\r\n\t\t\t\t\tafd = context.getAssets().openFd(path);\r\n\t\t\t\t\t// Why mp.setDataSource(afd) doesn't work is a problem for another day.\r\n\t\t\t\t\t// http://groups.google.com/group/android-developers/browse_thread/thread/225c4c150be92416\r\n\t\t\t\t\tmp.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\tLog.e(LCAT, \"Error setting file descriptor: \", e);\r\n\t\t\t\t} finally {\r\n\t\t\t\t\tif (afd != null) {\r\n\t\t\t\t\t\tafd.close();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\r\n\r\nshould be\r\n\r\n\r\n\t\t\tif (URLUtil.isAssetUrl(url)) {\r\n\t\t\t\tContext context = TiApplication.getInstance();\r\n\t\t\t\tString path = url.substring(TiConvert.ASSET_URL.length());\r\n\t\t\t\t\r\n\t\t\t\t// Needed to handle native path urls\r\n\t\t\t\tpath = path.replace(\"Resources//\", \"Resources/\");\r\n\t\t\t\t\r\n\t\t\t\tAssetFileDescriptor afd = null;\r\n\t\t\t\ttry {\r\n\t\t\t\t\tafd = context.getAssets().openFd(path);\r\n\t\t\t\t\t// Why mp.setDataSource(afd) doesn't work is a problem for another day.\r\n\t\t\t\t\t// http://groups.google.com/group/android-developers/browse_thread/thread/225c4c150be92416\r\n\t\t\t\t\tmp.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\tLog.e(LCAT, \"Error setting file descriptor: \", e);\r\n\t\t\t\t} finally {\r\n\t\t\t\t\tif (afd != null) {\r\n\t\t\t\t\t\tafd.close();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else if(url.toString().startsWith((\"file://\"))) {\t\t\t\t\r\n\t\t\t\t\t// Loading from internal storage using fil desc for media player to be able to read\r\n\t\t\t\t\tFileInputStream fis = new FileInputStream(url.toString().substring(\"file://\".length()));\r\n\t\t\t\t\tmp.setDataSource(fis.getFD());\t\t\t\t\r\n\t\t\t} else {\r\n", "attachment": [], "flagged": false, "summary": "Android fails to play sound from internal storage", "creator": { "name": "jdlundin", "key": "jdlundin", "displayName": "Johan Lundin", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jdlundin", "key": "jdlundin", "displayName": "Johan Lundin", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Android", "comment": { "comments": [ { "id": "218424", "author": { "name": "vjoshi", "key": "vjoshi", "displayName": "Varun Joshi", "active": true, "timeZone": "America/New_York" }, "body": "Hi Johan,\r\n\r\nI see that you have provided a solution for this issue. I would suggest you to follow these guidelines (https://wiki.appcelerator.org/display/guides/How+to+Contribute+Code) and make a pull request for the platform to look at so they can merge if its correct.\r\n\r\nThanks,\r\nVarun", "updateAuthor": { "name": "vjoshi", "key": "vjoshi", "displayName": "Varun Joshi", "active": true, "timeZone": "America/New_York" }, "created": "2012-09-11T13:37:59.000+0000", "updated": "2012-09-11T13:48:23.000+0000" }, { "id": "220518", "author": { "name": "vjoshi", "key": "vjoshi", "displayName": "Varun Joshi", "active": true, "timeZone": "America/New_York" }, "body": "Johan,\n\nJust wanted to know the update on this. Did you get time to look into the link I provided above?\n\nThanks,\nVarun", "updateAuthor": { "name": "vjoshi", "key": "vjoshi", "displayName": "Varun Joshi", "active": true, "timeZone": "America/New_York" }, "created": "2012-09-24T22:33:03.000+0000", "updated": "2012-09-24T22:33:03.000+0000" }, { "id": "220595", "author": { "name": "jdlundin", "key": "jdlundin", "displayName": "Johan Lundin", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Varun,\nyes but I don't have the time for it. I solved all my submitted jiras by creating a module with the fixes in it. Feel free to close the jira if you don't think the bug is serious enough.\n\nRegards,\nJohan", "updateAuthor": { "name": "jdlundin", "key": "jdlundin", "displayName": "Johan Lundin", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-09-25T06:20:02.000+0000", "updated": "2012-09-25T06:20:02.000+0000" }, { "id": "222352", "author": { "name": "vjoshi", "key": "vjoshi", "displayName": "Varun Joshi", "active": true, "timeZone": "America/New_York" }, "body": "Fixed as per above comment.", "updateAuthor": { "name": "vjoshi", "key": "vjoshi", "displayName": "Varun Joshi", "active": true, "timeZone": "America/New_York" }, "created": "2012-10-05T23:28:36.000+0000", "updated": "2012-10-05T23:28:36.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }