I tried playing a Live Audio Stream using the following provider below. When I use an MP3 stream the app plays but on changing to AAC format stream nothing plays.
import { Injectable } from ‘@angular/core’;
import { Http } from ‘@angular/http’;
import ‘rxjs/add/operator/map’;
@Injectable()
export class RadioPlayer {
url:string;
stream:any;
promise:any;
So you’re creating a new Audio element, and keeping it as a class property? I think you’ll need to add it to the document for it to work. Why not just use an <audio> tag in your template?
my bad,
the first parameter from initialize is only fired on the streaming is stopped or stopped from notification,
change the code to:
...
window.navigator.RADIO.initialize(
event => {
console.log('event ' + event + ' fired');
if (event == 'STOPPED') {
// do on stopped
} else if (event == 'STOPPED-FROM-NOTIFICATION') {
// do on stopped from notification
}
},
() => {
console.log('error initialized')
}
);
...
i’ve made some modifications on this project, removed the notification, added volume control and added a new event STARTED that is fired on stream successfuly started to play, if you want to check it out https://github.com/EltonFaust/cordova-plugin-multi-player
Hello everyone in this thread. I know its already a bit old, but now I am stucked to this problem and would be thankful if you could tell me how you do it in your recent app versions.
I build my app so far with native media. I couldn’t achieve better things with cordova-media-streaming. Both have the same problems like this:
MP3 starts fast but pauses for 2 seconds then streams perfectly over hours
AAC will take more than 15 seconds to load, then runs perfectly, too, but is not working on some Android devices like Android 5
How can I implement an aac decoder? I tried those streaming plugins including aac but nothing really worked better so far or could not be installed properly.
I like what I build so far but got stucked. This way the app can’t be released. I’d love to hear from you how your app is working now and if you still have these problems I do. Thank you in advance!