{ "id": "164506", "key": "TIMOB-24140", "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": "18154", "name": "Release 6.0.1", "archived": false, "released": true, "releaseDate": "2016-12-21" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-11-28T22:14:58.000+0000", "created": "2016-11-11T17:05:52.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "audiosessioncategory", "background", "ios", "qe-6.0.1", "sound" ], "versions": [ { "id": "16980", "description": "New V8", "name": "Release 6.0.0", "archived": false, "released": true, "releaseDate": "2016-11-15" } ], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2019-11-26T19:59:46.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "Thanks to [~designbymind], he reported an issue via mail that indicates a problem with our {{Ti.Media.AUDIO_SESSION_CATEGORY_*}} constants. As of TIMOB-23925, we wrapped our Ti.Media constants and in [this line|https://github.com/appcelerator/titanium_mobile/pull/8456/files#diff-e19e566138e39044280d74cfee0d3b4eR217], I wrapped it to only be compiled when the {{Ti.Media.AudioPlayer}} API is defined. But as it turns out, you can also use them for the {{Ti.Media.Sound}} API, so we just need to add that statement as well.", "attachment": [ { "id": "60690", "filename": "test_file.mp3", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-11-11T19:12:20.000+0000", "size": 1430174, "mimeType": "audio/mp3" } ], "flagged": false, "summary": "iOS: Ti.Media.audioSessionCategory not working with Ti.Media.Sound", "creator": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "400803", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/8600\r\nPR (6_0_X): https://github.com/appcelerator/titanium_mobile/pull/8601\r\n\r\nTest-case 1:\r\n{code:javascript}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: \"#fff\"\r\n});\r\n\r\nvar btn = Ti.UI.createButton({\r\n title: \"Print AUDIO_SESSION_CATEGORY_AMBIENT\"\r\n});\r\n\r\nbtn.addEventListener(\"click\", function() {\r\n // Create a Ti.Sound instance so the constant gets compiled\r\n var sound = Ti.Media.createSound();\r\n\r\n // Should print \"AVAudioSessionCategoryAmbient\"\r\n Ti.API.info(Ti.Media.AUDIO_SESSION_CATEGORY_AMBIENT);\r\n});\r\n\r\nwin.add(btn);\r\nwin.open();\r\n{code}\r\n\r\nTest-case 2:\r\n{code:javascript}\r\n Ti.Media.setAudioSessionCategory(Ti.Media.AUDIO_SESSION_CATEGORY_AMBIENT);\r\n\r\n// --- returns undefined on device ---\r\n// --- returns AudioSessionCategoryAVAudioSessionCategoryAmbient on simulator ---\r\nTi.API.info(\"AudioSessionCategory: \" + Ti.Media.getAudioSessionCategory());\r\n\r\nvar window = Ti.UI.createWindow();\r\n\r\nvar playSoundButton = Ti.UI.createButton({\r\n title: \"Play Sound\"\r\n});\r\n\r\n// --- Sound object creation will stop music player (Spotify/Apply Music) upon [initial] app\r\nvar sound = Ti.Media.createSound({\r\n url: \"test_file.mp3\",\r\n volume: 1,\r\n preload: false\r\n});\r\n\r\nplaySoundButton.addEventListener(\"click\", function() {\r\n // --- Playing the sound will also stop music player (same as sound creation)\r\n sound.play();\r\n});\r\n\r\nwindow.add(playSoundButton);\r\nwindow.open();\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-11-11T17:14:36.000+0000", "updated": "2016-11-11T21:47:09.000+0000" }, { "id": "401823", "author": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "body": "Tested the various audioSessionCategory constants available, and found the following results:\r\n\r\nh4. Ti.Media.AUDIO_SESSION_CATEGORY_AMBIENT:\r\n_Also used for for 'play along' style applications, such a virtual piano that a user plays over iPod audio._\r\n\r\n*RESULT:*\r\n- Spotify Music does not pause when app is opened or when Sound is played. (/)\r\n- AudioSessionCategory: AVAudioSessionCategoryAmbient (/)\r\n\r\nh4. Ti.Media.AUDIO_SESSION_CATEGORY_RECORD:\r\n_Session mode for recording audio; it silences playback audio._\r\n\r\n- Spotify Music is paused when app is opened. (/)\r\n- Sound does not play. (/)\r\n- AudioSessionCategory: AVAudioSessionCategoryRecord (/)\r\n\r\nh4. Ti.Media.AUDIO_SESSION_CATEGORY_SOLO_AMBIENT:\r\n_When you use this category, audio from built-in applications, such as the iPod, is silenced. Your audio is silenced when the Ring/Silent switch is set to silent or when the screen locks._\r\n\r\n*RESULT:* \r\nSpotify Music pauses when App is opened or when Sound is played. (/)\r\nAudio is silenced when the Ring/Silent switch is set to Silent. (/)\r\nAudio is silenced when screen is locked. (/)\r\nAudioSessionCategory: AVAudioSessionCategorySoloAmbient (/)\r\n\r\nh4. Ti.Media.AUDIO_SESSION_CATEGORY_PLAYBACK:\r\n_When using this mode, your application audio continues with the Ring/Silent switch set to silent or when the screen locks. This property normally disallows mixing iPod audio with application audio._\r\n\r\n*RESULT:*\r\nSpotify Music pauses when App is opened or when sound is played. (/)\r\nPlayback audio continues when device’s Ring/Silent switch is set to Silent. (/)\r\nPlayback is silenced when screen is locked (x)\r\nPlayback is silenced when app is backgrounded. (x)\r\nAudioSessionCategory: AVAudioSessionCategoryPlayback (/)\r\n\r\n*Reopening this issue* as {{Ti.Media.AUDIO_SESSION_CATEGORY_PLAYBACK}} does not meet the expected behaviour as described in the documentation.\r\n\r\nTested On:\r\niPhone 6 Plus 10.1.1 Device\r\niPhone 5S 9.3.5 Device\r\nMac OS Sierra (10.12.1)\r\nTi SDK: 6.0.1.v20161121005220\r\nAppc Studio: 4.8.0.201611121409\r\nAppc NPM: 4.2.8\r\nApp CLI: 6.0.0\r\nXcode 8.1\r\nNode v4.4.7\r\n\r\n*EDIT:* After further investigation it was found that in order to allow background audio for iOS, the following needs to be specified in the of the tiapp.xml:\r\n{code:java}\r\n UIBackgroundModes\r\n \t\r\n \t\taudio\r\n \t\r\n{code}\r\n\r\nIt does not seem that this instruction is present in our documentation for Ti.Media.Sound or Ti.Media.AudioPlayer.\r\n \r\n", "updateAuthor": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "created": "2016-11-24T18:20:51.000+0000", "updated": "2016-11-24T20:00:16.000+0000" }, { "id": "452922", "author": { "name": "max87", "key": "max87", "displayName": "Marian Kucharcik", "active": true, "timeZone": "Europe/Prague" }, "body": "Hi guys,\r\nI'm experiencing problems with background audio playing on iOS13.2.3 - on older versions(13.1 and 12.x.x) it was fine and working. Now, I can anything but when my app minimizes, audio stops(the goal is to start playing after local notification is received). Phone makes 0.5seconds sound and then it's silence. When I maximize app(go foreground), music plays(it seems that notification starts player to play, but no sound is comming from speaker when in background, after going foreground player plays not from start, but continues...)\r\nCan you please look at it? I tried AUDIO_SESSION_CATEGORY_PLAYBACK and AUDIO_SESSION_CATEGORY_AMBIENT, but no change... \r\nThanks", "updateAuthor": { "name": "max87", "key": "max87", "displayName": "Marian Kucharcik", "active": true, "timeZone": "Europe/Prague" }, "created": "2019-11-26T19:59:46.000+0000", "updated": "2019-11-26T19:59:46.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }