{ "id": "170910", "key": "TIMOB-25694", "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": "2018-01-24T12:20:58.000+0000", "created": "2018-01-23T02:44:27.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [ { "id": "19988", "description": "", "name": "Release 7.0.1", "archived": false, "released": true, "releaseDate": "2017-12-21" }, { "id": "20014", "name": "Hyperloop 3.0.1", "archived": false, "released": true } ], "issuelinks": [], "assignee": null, "updated": "2018-08-06T17:37:06.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": "Issue: Can not start native media player. It throws an error like Uncaught TypeError: Cannot read property 'start' of null\r\n\r\nSteps to Reproduce:\r\n\r\n1. Create a new Alloy project.\r\n2. Place the attached .mp3 file to the assets folder.\r\n3. Then run the following test code.\r\n\r\n{code:title=index.js}\r\nvar MediaPlayer = require('android.media.MediaPlayer');\r\nvar Activity = require('android.app.Activity'),\r\n am = require('android.content.res.AssetManager'),\r\n fis = require('java.io.FileInputStream');\r\n\r\nvar View = require('android.view.View');\r\nvar activity = new Activity(Ti.Android.currentActivity);\r\nvar context = activity.getApplicationContext();\r\nvar mPlayer = new MediaPlayer(activity);\r\n\r\nvar mPlayer = MediaPlayer.create(context, \"five.mp3\");\r\n\r\nfunction doClick() {\r\n\tmPlayer.start();\r\n\r\n}\r\n\r\n$.containerWin.open();\r\n\r\n{code}\r\n\r\n{code:title=index.xml}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\n{code:title=error}\r\n[ERROR] : TiExceptionHandler: (main) [692901,692901] ----- Titanium Javascript Runtime Error -----\r\n[ERROR] : TiExceptionHandler: (main) [0,692901] - In undefined:69,11\r\n[ERROR] : TiExceptionHandler: (main) [0,692901] - Message: Uncaught TypeError: Cannot read property 'start' of null\r\n[ERROR] : TiExceptionHandler: (main) [0,692901] - Source: \t\tmPlayer.start();\r\n[ERROR] : V8Exception: Exception occurred at undefined:69: Uncaught TypeError: Cannot read property 'start' of null\r\n{code}\r\n\r\nThanks", "attachment": [ { "id": "64727", "filename": "five.mp3", "author": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2018-01-23T02:44:23.000+0000", "size": 36216, "mimeType": "audio/mp3" } ], "flagged": false, "summary": "Hyperloop: Android- Cannot start native media Player.", "creator": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "subtasks": [], "reporter": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "environment": "Operating System\r\n Name = Mac OS X\r\n Version = 10.13.2\r\n \r\nNode.js\r\n Node.js Version = 8.9.3\r\n npm Version = 5.5.1\r\nTitanium CLI\r\n CLI Version = 5.0.14\r\nTitanium SDK\r\n SDK Version = 7.0.1.GA\r\n Target Platform = android", "closedSprints": [ { "id": 990, "state": "closed", "name": "2018 Sprint 02 SDK", "startDate": "2018-01-14T22:48:43.544Z", "endDate": "2018-01-28T22:48:00.000Z", "completeDate": "2018-01-29T16:22:42.911Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "433583", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "First of all, there are quite a few issues with the above code.\r\n{code}\r\nvar mPlayer = new MediaPlayer(activity);\r\nvar mPlayer = MediaPlayer.create(context, \"five.mp3\");\r\n{code}\r\nThe {{mPlayer}} variable is declared twice, which doesn't make much sense. Also, the second parameter of the \"create\" method is from the type {{Uri}} or {{int}}, not {{String}}. Finally, the URL of the player item has to be constructed natively, which is not as simple as providing the file name as in Titanium. Please follow the native Android docs to do this, as this is no Titanium- or Hyperloop related issue.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-01-24T12:20:45.000+0000", "updated": "2018-01-24T12:20:45.000+0000" }, { "id": "439945", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as invalid. If incorrect, please reopen.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-06T17:37:06.000+0000", "updated": "2018-08-06T17:37:06.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }