{ "id": "84380", "key": "TIMOB-6962", "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": "2012-02-10T00:06:27.000+0000", "created": "2011-12-29T23:02:09.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "tc-more-info" ], "versions": [], "issuelinks": [], "assignee": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "updated": "2012-02-10T00:06:27.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": "h4. PROBLEM DESCRIPTION\r\nIf you create an AudioPlayer, it will continue downloading the file, even if you stop the player, or actually even if you destroy the player. \r\n\r\nh4. EXPECTED RESULTS\r\nIf the AudioPlayer is set to null, should not continue downloading the file while waiting for Garbage collecting. \r\n\r\nh4. ACTUAL RESULTS\r\nThe player continues downloading the file, even if was set to null.\r\n\r\nh4. TEST CASE\r\n\r\n# Paste the code into app.js\r\n# Run it into Android\r\n# Press Play. Check the message \"General Available Memory\". \r\n# Pause the player. You will see that the General Available Memory it will be down by 24 bytes (or so), each 5 seconds.\r\n# Press \"Delete\" button. The player will be set to null.\r\n\r\n{code:lang=javascript|title=app.js}\r\nvar win = Titanium.UI.createWindow();\r\n\r\nvar sound = Titanium.Media.createAudioPlayer({url:'http://www.wav-sounds.com/answering_machine/rappin.wav'});\r\n\r\nsound.addEventListener('progress',function(){\r\n\tTi.API.info(\"Available Memory:\"+Ti.Platform.getAvailableMemory());\r\n});\r\n\r\n//\r\n// PLAY\r\n//\r\nvar play = Titanium.UI.createButton({\r\n\ttitle:'Play',\r\n\theight:40,\r\n\twidth:145,\r\n\tleft:10,\r\n\ttop:10\r\n});\r\nplay.addEventListener('click', function()\r\n{\r\n\tsound.play();\r\n});\r\nwin.add(play);\r\n\r\n//\r\n// PAUSE\r\n//\r\nvar pause = Titanium.UI.createButton({\r\n\ttitle:'Pause',\r\n\theight:40,\r\n\twidth:145,\r\n\tright:10,\r\n\ttop:10\r\n});\r\npause.addEventListener('click', function()\r\n{\r\n\tsound.pause();\r\n});\r\nwin.add(pause);\r\n\r\n//\r\n// STOP\r\n//\r\nvar stop = Titanium.UI.createButton({\r\n\ttitle:'Stop',\r\n\theight:40,\r\n\twidth:145,\r\n\tright:10,\r\n\ttop:60\r\n});\r\nstop.addEventListener('click', function()\r\n{\r\n\tsound.stop();\r\n});\r\nwin.add(stop);\r\n\r\nvar bdelete = Titanium.UI.createButton({\r\n\ttitle:'Delete',\r\n\theight:40,\r\n\twidth:145,\r\n\tleft:10,\r\n\ttop:60\r\n});\r\nbdelete.addEventListener('click', function()\r\n{\r\n\tsound = null; \r\n});\r\nwin.add(bdelete);\r\n\r\nsetInterval(function(){\r\n\tTi.API.info(\"General Available Memory:\"+Ti.Platform.getAvailableMemory());\r\n\t}, 5000);\r\n\r\nwin.open();\r\n\r\n{code}\r\n\r\n", "attachment": [], "flagged": false, "summary": "Android: Media - AudioPlayer continues downloading the file even after stop or destroying the object", "creator": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "subtasks": [], "reporter": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "environment": "Titanium SDK version: 1.8.0.1 (12/22/11 13:09 fbdc96f) \r\nJavascript Engine: V8 \r\nPlatform & version: Android 2.2 \r\nDevice Details: Android emulator \r\nHost Operating System: OSX 10.6.8 \r\nTitanium Studio version: 1.0.8.201112282257", "comment": { "comments": [ { "id": "177693", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "Mauro, thanks for raising this. Would you please complete the environment field, in accordance with the [JIRA Ticket Checklist|https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-JIRATicketChecklist]? Then I can move this to the main project.\r\n\r\nThank you", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-12-30T02:19:56.000+0000", "updated": "2011-12-30T02:19:56.000+0000" }, { "id": "177877", "author": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "body": "We should not put \"community\" as a customer as many of our bugs are reported by community and this field indicates customer priority issues.", "updateAuthor": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-03T11:49:16.000+0000", "updated": "2012-01-03T11:49:16.000+0000" }, { "id": "178313", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "There is a fix for this ticket being made which addresses the failure of calls to destroy() not actually stopping the download for remote source. That having been said, setting the player to null is not a valid mechanism for stopping the active media player. A developer should call destroy() in order to shutdown the player correctly rather than just setting the player to null.\r\n\r\nWhen pausing the player, the media player implementation itself within Android may continue to buffer content which can explain the the memory footprint described .\r\n\r\nWhen testing the change, please change the handle for the \"Destroy\" button click to:\r\n{code}\r\nsound.destroy();\r\nsound = null; \r\n{code}\r\n", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2012-01-06T00:14:37.000+0000", "updated": "2012-01-06T00:14:37.000+0000" }, { "id": "178335", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "Upon further review, there is actually no platform change required. Against current master, the memory foot print behaves correctly when calling release() on the AudioPlayer without any additional changes. Please use release() rather than destroy() mentioned above as this is more consistent with the the other player management calls on Android.", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2012-01-06T08:41:59.000+0000", "updated": "2012-01-06T09:05:08.000+0000" }, { "id": "178346", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2012-01-06T09:56:01.000+0000", "updated": "2012-01-06T09:56:01.000+0000" }, { "id": "178349", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "It should also be noted that there is an upcoming fix for general GC behavior but as you cannot guarantee when a GC occurs, this behavior (setting player to null) should not be depended upon for shutting down media players and cleaning up resources. It should be noted that on V8, when the player is released the reported footprint stays almost completely static (droid2 2.2).", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2012-01-06T10:10:43.000+0000", "updated": "2012-01-06T10:10:43.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }