[TIMOB-20140] Streaming Audio not working on Android Marshmallow
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-12-17T22:09:10.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.4.0 |
Components | Android |
Labels | android, supportTeam |
Reporter | Wouter Versluijs |
Assignee | Ashraf Abu |
Created | 2015-10-26T16:15:59.000+0000 |
Updated | 2016-07-15T00:58:53.000+0000 |
Description
I'm having an issue with audio streaming on any Android device running the newest Android version (Marshmallow).
I'm using the following code to play the audio stream (works on iOS, and android prior to Marshmallow);
*Test case*
AudioPlayer = Ti.Media.createAudioPlayer({ allowBackground: true });
AudioPlayer.setUrl( 'http://icecast.omroep.nl/3fm-bb-mp3' );
AudioPlayer.start();
*Expected Result*
Stream starts playing
*Actual Result*
Stream doesn't start playing, instead i'm getting an error saying “unknown media error”.
---
Like I said, this was working on both iOS and Android (prior to Marshmallow).
Does anyone know a workaround or a fix for this?
Any help is appreciated!
Hello We tested this issue in our environment. Streaming audio is working properly. *Testing Environment:* Appc CLI - version 5.0.4-2 Appc Studio - 4.3.1 Mac OSx - 10.9.5 Node.js - 0.10.33 npm - 1.4.28 Ti SDK - 5.0.2 GA Android Emulator - Google Nexus 6p - 6.0.0 app.js
Thanks.
Hi, Thanks for the quick response! I have tested the above code on a few Android devices and it still doesn't seem to work. *Testing Environment:* Appc CLI - Version 4.1.2 Mac OSx - 10.10.5 Node.js - v0.10.37 npm - 1.4.28 Ti SDK - 5.0.1.GA *Devices:* Sony Xperia Z3 - Android 4.4.4 (Works) Samsung Galaxy S4 - Android 5.0.1 (Works) Samsung Galaxy S6 Edge - Android 5.1.1 (Works) *LG Nexus 5 - Android 6.0 Marshmallow (Does not work)* Below is the logcat output that I get when trying to play the stream on the LG Nexus 5 with Android 6.0. So this issue only persists on Android 6.0 and not on prior releases.
Could you try this on an actual device with Android 6.0 and see if you can reproduce this issue? Also i'm using Titanium SDK 3.5.1.GA in the live version of the apps where I use streaming music, and this issue also occurs. And just for my information, is it still possible to build apps for the Playstore and Appstore with the newest Titanium release (5.0.2.GA) for free? Or do you now need a subscription (Indie, Team or Enterprise) to use the newer versions of Titanium?
I can confirm that I am getting reports from users of my radio streaming apps on Google Play that they no longer play after the user has installed Android 6.0. I also installed Android 6.0 on my Nexus 7 last night and found this to be the case. I then re-built an app using the Android 6.0 SDK (was previously build targeting Android 5.0) but found it still won't play. The error thrown is Player error: Unknown media error. code is -2147483648 And I've just downloaded a Genymotion Nexus 5X with Android 6.0 and found it also won't play audio streams using the Appcelerator AudioPlayer API (mp3 streams from a streaming server).
Hi to all, Yesterday my Nexus 7 2015 updated to Android 6.0 Marshmallow and my radio streaming dont work. I tried by Genymotion Nexus 5X but same result. No console errors and no sound. Some news? Thanks
Thanks for opening this again. If you want a URL to test try http://sc6.radiocaroline.net:8040 I have also tried adding /;.mp3 on the end as some devices (Galaxy models) won't recognise this as a stream without it. Both produce Unknown media error -2147483648 I don't suppose this is a revival of the 'OKHTTP' bug from Android 5.0?
Has there been any update regarding this issue? A fix or maybe a workaround?
I have the same problem... Marshmallow dont play audio streaming Icecast / shoutcas mp3.
PR: https://github.com/appcelerator/titanium_mobile/pull/7591
PR merged.
Thanks Ashram - what was the actual problem then? And do you know when the fix will make it's way into the Ti SDK?
This is planned for fix release in SDK 6.0.0.
Thanks Ashram! Is it possible to fix this in one of the current builds? 5.2 or maybe a 5.3?
If you need the latest and greatest right from the oven, you could try the master branch (which is currently set at 6.0.0) http://builds.appcelerator.com.s3.amazonaws.com/index.html#master from the builds. These are not GA or even RC, so be careful with this. These are continuous builds. I quote *
Below are the latest untested continuous integrations builds of the Titanium SDK.
* Alternatively, you could compile it yourself from github and take only the changes you need in to a 5.2.X branch.I did try a nightly build about a week ago and again today and found that although some of my Shoutcast streams now played under Android 6.0 (on a Nexus 7), others did not and produced our old friend error (1, -2147483648) *Examples:* Won't play: http://sc2.radiocaroline.net:10558 Will play: http://sc2.radiocaroline.net:8000 The error starts at: E/NuCachedSource2(16101): source returned error -1, 10 retries left In a further test using 'Classic' Ti the stream that would not play in an Alloy build now plays and we see the following printed in the Console, which I have never seen in an Alloy implementation: AAS: Asking for stream handler for protocol: 'http' Audio in Android seems to be a bit of a lottery - if it works great. If it does't we're stuffed as nobody seems to be able to say what the cause is!
[~patrickmounteney] Thanks for checking this out. {quote}In a further test using 'Classic' Ti the stream that would not play in an Alloy build now plays and we see the following printed in the Console, which I have never seen in an Alloy implementation:{quote} So basically this is a good thing? Just that there is a weird log entry. Will need to investigate {quote}Won't play: http://sc2.radiocaroline.net:10558 Will play: http://sc2.radiocaroline.net:8000{quote}
Do you know if there is any difference between the 2 Shoutcast? (Slight protocol differences? etc...)
As far as I can tell both of the above Shoutcast streams are the same protocol as they come from the same server (Shoutcast 1.9.8), be it different ports. But read on as I spent some time testing this yesterday and my conclusion is that there is some difference between the way the 'Classic Ti' implements AudioPlayer behind the scenes and the way Alloy does. I can run the same very simple test (below) and get two different results, depending on if it was built with Alloy or not and version of Android the test is run under. *Test code built with Ti. SDK 6.0.0.v20160112093414 and targeting Android API 23* var player = Titanium.Media.createAudioPlayer({ allowBackground: true, url: "http://sc2.radiocaroline.net:10558" }); function streamButtonClick(){ Ti.API.info("Playing : "+ player.url); player.play(); } *Test 1:* Alloy build - run on Nexus 7 Tablet Android 6.0.1 - It doesn't play and throws error (1, -2147483648) Classic build - run on Nexus 7 Tablet Android 6.0.1 - streams plays *Test 2:* Alloy build - run on Lenovo Tablet Android 4.2.2 - streams plays Classic build - run on Lenovo Tablet Android 4.2.2 - streams plays Observations: When it works we see this printed in the Ti Console: [DEBUG] : AAS: Asking for stream handler for protocol: 'http' [DEBUG] : MediaPlayer: setSubtitleAnchor in MediaPlayer When it doesn’t work we get: [ERROR] : MediaPlayer: error (1, -2147483648) And when it does work, in the Android log we see: 01-12 07:48:55.722: D/audio_hw_primary(16101): enable_audio_route: apply and update mixer path: low-latency-playback 01-12 07:48:55.988: E/NuCachedSource2(16101): source returned error -1, 10 retries left Conclusion: There is something in an Alloy build, when run under Android 6.0, that is causing NuCachedSource2 to error and the stream never plays.
[~patrickmounteney] Created this ticket TIMOB-20234 to address this.