Shoutcast aacplus streaming with As3 - actionscript-3

i want a flash player for shoutcast servers. if shoutcast's content type is mpeg, codes is working. But if shoutcast's content type is aacp, codes not working.
Codes;
var channel:SoundChannel;
var sound:Sound = new Sound();
sound.load(new URLRequest("http://yonradyo.radyolarburada.com:8020/;"));
channel = sound.play();
What should I do? Thanks.

The Project Thunder Snow (https://code.google.com/p/project-thunder-snow/) is not so fresh, but still working solution for playing aac/aacp streams on PC (but not on mobile platform).
The page https://code.google.com/p/project-thunder-snow/wiki/NBaccPlayer contains a code example simple enough.

Related

How to add stream to live channels

I’m developing a tvml app that has live tv, news and on-demand programs.
Wondering how can I add that to the tv app. I have been looking around but I didn’t seem to find anything...
In tvOS, there is a TV app, with suggestions on shows to watch, Trendings, and sports. Some of those channels like news, and sports, have live content. I am trying to add my live content to the Apple TV app, and not sure what to do.
Btw, I did find the guild for Android TV,
https://developer.android.com/training/tv/tif/
AppleTV uses Apple's HTTP Live Stream (HLS).
You should create a server that serves the live stream in .m3u8 with type EVENT
And then in your AppleTV app
// create a player
const player = new Player();
// create a playlist
player.playlist = new Playlist();
// create video mediaItem
var video = new MediaItem('video', "https://myserver.example.com/video/live.m3u8");
// add it to the playlist
player.playlist.push(video);
// hit play
player.play();

as3 ShineMP3Encoder issue (clicking sound when mp3 audio starts)

After recording a sound and converting it into wav...
var enco:WaveEncoder=new WaveEncoder();
var o:ByteArray=enco.encode(soundO,1,16,44100);
I pass it to ShineMP3Encoder
_mp3_encoder = new ShineMP3Encoder(o);
_mp3_encoder.addEventListener(Event.COMPLETE, onMP3EncoderComplete, false, 0, true);
_mp3_encoder.start();
onMP3EncoderComplete has two vars
var mp3:ByteArray = _mp3_encoder.mp3Data;
var wav:ByteArray = _mp3_encoder.wavData;
wav audio is normal, but mp3 almost always (99%) has a clicking sound when audio begins.
Here's a picture from SoundForge app.
We can see these two files are identical, but mp3 has a clicking sound at the beginning.
Is it my system/hardware/compiler problem or it's something else?
btw I tried some online swf example of ShineMP3Encoder and it has same issue. So probably that's not my compiler problem

How make with AS3 downloading MP3 files in the background mode and plays it?

I need help with AS3 make downloading MP3 files in the background mode. Man goes to my site and it will automatically load MP3 file on his computer and plays it. I read these examples here http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLLoader.html but do not know how to do it? Prompt what code and how to use it properly?
You can directly load a Sound object with an URLRequest instead of using a separate Loader or URLLoader. A code could look like this:
// this code should reside in a function somewhere
var request:URLRequest = new URLRequest("http://your.site.com/your.mp3");
var sound:Sound = new Sound(request;
sound.addEventListener(Event.COMPLETE, completeHandler);
// this function should be at top level anyway
private function completeHandler(event:Event):void
{
var loadedMP3:Sound = Sound(event.target);
if (loadedMP3) loadedMP3.play();
}
Extra error handling is up to you.

Sound not being played

var sound:Sound = new Sound(new URLRequest("Phone.wav"))
sound.play(0, 20);
Why does sound not play? There are no errors.
Flash doesn't support loading external WAV files with the Sound class, only MP3s. I don't know why it isn't giving any errors but I haven't used the Sound class much myself so it might be normal.
There are three solutions for this. First of all, WAVs are supported if you import them into the library as Sound objects. This is probably the best choice if you're using the Flash IDE.
If you're not using the IDE, you may be able to embed the file instead using Flex's [Embed] tag, if you're compiling it using the Flex SDK.
Otherwise, can either convert your sound to an MP3 file and load it as usual:
var sound:Sound = new Sound(new URLRequest("Phone.mp3"));
sound.play(0, 20);
Or, if you prefer to use a WAV, you can use the as3wavsound library. Here's a tutorial outlining how to use it.
Hope that helps!
You need to use a SoundChannel try this.
var soundChann:SoundChannel;
var sound:Sound = new Sound(new URLRequest("Phone.wav"))
soundChann = sound.play();

Audio of a specific video swf doesn't stop when I load another URLRequest

I am trying to stop the audio of the video swf and I can't get it to stop. Here is my code for loading the file:
var myLoader:Loader= new Loader();
myLoader.x=420;
myLoader.y=200;
// boolean variable set for use below in our function
var screenCheck:Boolean = false;
//These three linces keep stafe elements the same size, so they don't distort
var swfStage:Stage = this.stage;
video_btn.addEventListener(MouseEvent.CLICK,contentvideo);
function contentvideo (event:MouseEvent):void{
myLoader.load(new URLRequest("prevideo.swf"));
addChild(myLoader);
movie_btn.stop();
movie_btn.visible=false;
}
Now I have other functions that load different URLRequest and when they are loading, the audio keeps playing. Do I have to add a line of code to them? I also have an MP3 player and tried SoundMixer.stopAll(). I still need the mp3 player to keep playing.
I'm not familiar with what you're doing but just looking at the code and given the problem you're experiencing I wonder if that
addChild(myLoader);
has anything to do with it. It seems like the kind of thing that could easily create multiple child objects which is why you continue to experience the sound play back. Is there a removeChild[0] option or something?
A shot in the dark I know but I thought I'd offer the possibility anyway.