My internet radio station player app failed with the upgrade to Android 6 (Marshmallow). To test I copied the example code (below) from the docs for the Media plugin and built a tiny test app on latest Cordova (6.1.1), Android platform (5.1.1), Browser platform (4.1.0) and Media plugin (2.3.0). I also added necessary whitelist statements (below). On the browser platform it plays both internet files and internet streams. On the Android platform it fails to start mp3 internet streams. The console log shows that a stream is terminated within 1 second and the OnSuccess callback is called. No error messages, just logs "playAudio():Audio Success" and terminates.
Player code is
var src = "http://audio.wgbh.org:8104";
my_media = new Media(src,
// success callback
function () {
console.log("playAudio():Audio Success");
},
// error callback
function (err) {
console.log("playAudio():Audio Error: " + err);
}
config.xml whitelist is (yes unsafe, I'll fix that later)
<plugin name="cordova-plugin-whitelist" source="npm" spec="1" />
<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="*" launch-external="yes" /> <!-- Required for iOS9 -->
A previous Stack Overflow question from Dec 2015 had the same problem "cordova media plugin stopped working on Android 6". It suggests a java patch to the AudioPlayer. I made that change and rebuilt my test app. But that didn't change anything. Is a Cordova build sufficient to make that change?
BTW, testing on a real phone plugged into USB, seeing log via Chrome dev tools.
What am I missing? Or is this a bug in the Media plugin java code or in the Android platform?