View previous topic :: View next topic |
Author |
Message |
wavuti
Joined: 29 Dec 2009 Posts: 3
|
Posted: Tue Dec 29, 2009 6:10 pm Post subject: Flash Media Player with AAC Encoded Stream |
|
|
I working on trying to embed an AAC+ encoded stream in Flash from Icecast. I made to understand that this is possible with the latest version of Flash(in Actionscript 3). I successfully tried out a test with a local file using the following code:
Code: |
var connect_nc:NetConnection = new NetConnection();
connect_nc.connect(null);
var stream_ns:NetStream = new NetStream(connect_nc);
stream_ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
stream_ns.play("sample.m4a");
function asyncErrorHandler(event:AsyncErrorEvent):void {
trace(event.text);
} |
However, when I try plugging in the IceCAST stream, this does not seem to work i.e.
Code: |
var connect_nc:NetConnection = new NetConnection();
connect_nc.connect(null);
var stream_ns:NetStream = new NetStream(connect_nc);
stream_ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
stream_ns.play("http://icecastIPAddress:8000");
function asyncErrorHandler(event:AsyncErrorEvent):void {
trace(event.text);
}
|
So what am I missing? Am I on the wrong path? Any help provided would be greatly appreciated!
Thanks. |
|
Back to top |
|
|
Brutish
Joined: 18 Mar 2010 Posts: 62
|
Posted: Fri Apr 02, 2010 9:05 am Post subject: |
|
|
Maybe the wrapper that a Flash media server provides? This is why you need wowza or AMS. Its possible to script an open source media server that can do this using red5 and FFmpeg, but it would be a pain in the ass.... |
|
Back to top |
|
|
karlH Code Warrior
Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Fri Apr 02, 2010 2:22 pm Post subject: |
|
|
I have some work in progress that does flv wrapping, seems to work with flash without the memory issues.
karl. |
|
Back to top |
|
|
Brutish
Joined: 18 Mar 2010 Posts: 62
|
Posted: Fri Apr 02, 2010 6:25 pm Post subject: |
|
|
This would be AWESOME. I cant wait to see it. |
|
Back to top |
|
|
karlH Code Warrior
Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Sat Apr 17, 2010 5:55 pm Post subject: |
|
|
If you are interested in testing this, then try out the following code at
http://www.icecast.pwp.blueyonder.co.uk/flv/icecast-2.3.2-kh22-flv.tar.gz
AFAIK any existing mp3/aac stream will work with this, but to get the player to be sent flv wrapped content, as opposed to the usual stream content, you'll need to send a query arg as part of the URL, so if http://site:8000/mystream is the address you currently use then use http://site:8000/mystream?type=.flv
If you are wondering about the .flv, that is just for players that assume extensions for decoding. I've only tested with the longtail flash player version 4.6 (later versions do things differently). It should work with auth, intro and fallback handling as well. I would be interested in feedback on this.
karl. |
|
Back to top |
|
|
Brutish
Joined: 18 Mar 2010 Posts: 62
|
Posted: Tue Jun 29, 2010 11:22 pm Post subject: |
|
|
AAC+ .flv output?
WORKS LIKE A CHAMP.
www.hobbycaster.com/Test.flv
Instead of doing the output via query, I forced the filetype by doing a launchscript, I found the player plays a lot nicer that way (had some issues with ?type=.flv / ?fileext=.flv
instead? I just opened notepad, entered:
http://IP:Port/Mount.TrueFileValue
and saved it under Name.FLV, so the codec is already identified by the launchscript. Seems to play MUCH NICER with the players. _________________ www.Hobbycaster.com |
|
Back to top |
|
|
karlH Code Warrior
Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Tue Jun 29, 2010 11:44 pm Post subject: |
|
|
Glad to hear about it. The title metadata is inserted as well so it's just a matter of handling that. Don't forget that intro and fallback content should be in the same format, while icecast could handle the switch, I doubt that flash can.
You may find that you have to encode the query arg separators eg /mount%3Ftype%3D.flv which may also be important if you use query args for authentication. The actual trigger for flv wrapping could be anything really. At the moment, it's either the query arg or an .flv extension on the mountpoint. The query arg approach was to help in fitting in with existing setups, think 100+ mountpoints on a server. The extension approach can be aliased to another stream eg alias source=/stream.flv dest=/stream
BTW for later versions (v5) of the longtail player, adding duration to the flashvars works. Other players may have similar issues.
karl. |
|
Back to top |
|
|
Brutish
Joined: 18 Mar 2010 Posts: 62
|
Posted: Wed Jun 30, 2010 12:41 am Post subject: |
|
|
Trying to see if I can get it to work for video. The challenge got laid out. I know the cap is a little different from audio, but worth a shot. NSV would be ideal, but if i can pop it out with Theora, that would be an awesome. I really dont understand what voodoo makes KH24 work with flash, so I dont know if it will do video in this mannor, but if it did? Flash H264/AAC+ that easy? Awesome.
Yeah I got to get in there for that metadata (royalty free music BTW, already have concent) _________________ www.Hobbycaster.com |
|
Back to top |
|
|
Brutish
Joined: 18 Mar 2010 Posts: 62
|
Posted: Wed Jun 30, 2010 12:45 am Post subject: |
|
|
Quote: |
The extension approach can be aliased to another stream eg alias source=/stream.flv dest=/stream
|
( NO CLUE--------------------------------------------{}------ Gets It )[/quote] _________________ www.Hobbycaster.com |
|
Back to top |
|
|
Brutish
Joined: 18 Mar 2010 Posts: 62
|
Posted: Tue Jul 06, 2010 7:25 am Post subject: |
|
|
I recant my previous statement on this.
While the .flv output is acheveable in this nature, all sorts of issues are happening from trying to cram a AAC+ into .flv through a .txt link. I really am going to have to query it out. I tried the query as it should be and I didnt get the AAC+ output into an embeddable file, only been able to get it to work through VLC. I know its possible as I have seen demos. just working on it. _________________ www.Hobbycaster.com |
|
Back to top |
|
|
karlH Code Warrior
Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Tue Jul 06, 2010 11:01 am Post subject: |
|
|
just make your player (or the pls/m3u file) contain the URL with type=.flv as one of the args that follows the? eg
/mystream?username=me&password=pass&type=.flv
The odd case to watch for with flash is if the url is part of the flashvars then you'll need to double escape it again as flashvars have their own translation first eg
file=/mystream%3Ftype%3d.flv&otherflashvar=setting
The file part of that is split out and flash then translates those % codes for the URL.
karl. |
|
Back to top |
|
|
Brutish
Joined: 18 Mar 2010 Posts: 62
|
Posted: Thu Jul 08, 2010 7:20 pm Post subject: |
|
|
karlH wrote: |
just make your player (or the pls/m3u file) contain the URL with type=.flv as one of the args that follows the? eg
/mystream?username=me&password=pass&type=.flv/ |
I really dont understand where me&password would come into play. Is this if it has a Httpauth on it?
karlH wrote: |
The odd case to watch for with flash is if the url is part of the flashvars then you'll need to double escape it again as flashvars have their own translation first eg
file=/mystream%3Ftype%3d.flv&otherflashvar=setting
The file part of that is split out and flash then translates those % codes for the URL.
karl. |
Im not sure exactly what you mean by the double escape. I got it working on the longtail wizard by entering the arguement (like you told me the first time) in the flashvars file and rtmp lines. This is what it gave me. Seems like it works on the longtail site.
Tried it on my own site (keep in mind I never touch flash) and had no luck just yet. I know this is going to work though.
<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='470' height='320' id='single1' name='single1'><param name='movie' value='player.swf'><param name='allowfullscreen' value='true'><param name='allowscriptaccess' value='always'><param name='wmode' value='transparent'><param name='flashvars' value='file=http://76.248.8.220:8082/hobbycast&streamer=http://76.248.8.220:8082/hobbycast.aacp?type=.flv'><embedtype='application/x-shockwave-flash'id='single2'name='single2'src='player.swf'width='470'height='320'bgcolor='undefined'allowscriptaccess='always'allowfullscreen='true'wmode='transparent'flashvars='file=http://76.248.8.220:8082/hobbycast&streamer=http://76.248.8.220:8082/hobbycast.aacp?type=.flv'/></object> _________________ www.Hobbycaster.com |
|
Back to top |
|
|
karlH Code Warrior
Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Thu Jul 08, 2010 11:18 pm Post subject: |
|
|
Just for clarification, the example I gave was to show how it is similar to listener auth using query arguments (which is different from the http://user:pass@host:..... syntax). however auth is not required for flv wrapping.
The double escape is because different components within flash that handles the data you pass. The flashvars format is name1=var1&name2=var2 etc. obviously name1 can be file or streamer in your example, but var1 being a URL can itself include a & or ?, so needs to be encoded to avoid being treated as a flashvar separator. This is why I give the example as file=/stream%3Ftype%3D.flv
take the example flashvar "streamer=http://76.248.8.220:8082/hobbycast.aacp?type=.flv". flash would assign the URL as http://76.248.8.220:8082/hobbycast.aacp without the type=.flv which is required for the flv wrapping to be enabled. Whether the file and streamer settings are useful depends on the player.
karl. |
|
Back to top |
|
|
Brutish
Joined: 18 Mar 2010 Posts: 62
|
Posted: Fri Jul 09, 2010 9:43 am Post subject: |
|
|
Gotcha
Yeah, that % seems to work a lot better.
http://hobbycaster.com/tester/
Any idea why its filling the flash container? Thats boggling me, I can select the flash bar, and rewind the stream and whatnot, and streaming long enough, I hit the memory limit.
Is that because it has an entry in the "file=" field? _________________ www.Hobbycaster.com |
|
Back to top |
|
|
Brutish
Joined: 18 Mar 2010 Posts: 62
|
Posted: Fri Jul 09, 2010 9:54 am Post subject: |
|
|
So for Flashvars, I could just state the whole path, then just add:
so.addVariable('type','.flv'); _________________ www.Hobbycaster.com |
|
Back to top |
|
|
|