RTMP and AS3
I'm trying to stream an flv from FMS using AS3. I found AS3
code on the Flex site, but it throws the following errors on trace:
Error #2044: Unhandled AsyncErrorEvent:. text=Error #2095:
flash.net.NetConnection was unable to invoke callback onBWDone.
error=ReferenceError: Error #1069: Property onBWDone not found on
flash.net.NetConnection and there is no default value.
at VideoTest$iinit()
metadata: duration=570.2330000000001 width=796 height=536
framerate=30
Can someone please help me fix the above? I've been
everywhere pretty much but no go. I also posted the question on the
FMS forum and would gladly delete it from there if I can please get
an answer here.
Thanks
=================================
package {
import flash.display.Sprite;
import flash.events.NetStatusEvent;
import flash.events.SecurityErrorEvent;
import flash.media.Video;
import flash.net.NetConnection;
import flash.net.NetStream;
import flash.events.Event;
import flash.net.ObjectEncoding;
public class VideoTest extends Sprite{
private var videoURL:String = "1";
private var connection:NetConnection;
private var stream:NetStream;
public function VideoTest():void {
////NetConnection.defaultObjectEncoding =
flash.net.ObjectEncoding.AMF0;
connection = new NetConnection();
connection.objectEncoding = flash.net.ObjectEncoding.AMF0;
connection.addEventListener(NetStatusEvent.NET_STATUS,
netStatusHandler);
connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
securityErrorHandler);
connection.connect("rtmp://.../videosource/");
private function netStatusHandler(event:NetStatusEvent):void
switch (event.info.code)
case "NetConnection.Connect.Success":
connectStream();
break;
case "NetStream.Play.StreamNotFound":
trace("Stream not found: " + videoURL);
break;
private function
securityErrorHandler(event:SecurityErrorEvent):void
trace("securityErrorHandler: " + event);
private function connectStream():void
var stream:NetStream = new NetStream(connection);
stream.addEventListener(NetStatusEvent.NET_STATUS,
netStatusHandler);
stream.client = new CustomClient();
var video:Video = new Video();
video.attachNetStream(stream);
stream.play(videoURL);
addChild(video);
class CustomClient
public function onMetaData(info:Object):void {
trace("metadata: duration=" + info.duration + " width=" +
info.width + " height=" + info.height + " framerate=" +
info.framerate);
public function onCuePoint(info:Object):void {
trace("cuepoint: time=" + info.time + " name=" + info.name +
" type=" + info.type);
}
Nope. I have not found a solution to this problem yet. I
posted a querry in FMS and did receive a reply there but have not
had the chance to try it yet.
There are errors in all of th AS3 stuff I've tried.
Actionscript 3.0 Cookbook from O'Reiley needs a big overhaul. So
does the Lynda version. Even the Flex 2 things from Total Training
have unresolved errors in them. Other people are complaining about
the same things elsewhere, so I know I'm not alone on this one.
If you find a solution, please do post it here. Would be nice
if an Adobe Ace would come to the rescue on this video player
issue.
BTW, here is what was suggested by Nerdabilly from the FMS
forum. Don't know if it will work.
==========================================
Try putting an onBWdone handler into the custom client:
public function onBWDone(info:Object):void{
Similar Messages
-
As2.0 and As3.0 communicatioin
Hi,
i m updating my e-learning course player project with Flash
cs3 and AS3.0. the old version of course player was in As2.0. which
load cousre swf files .
it was working fine Flash8 As2.0.
the player load course swf. the loaded course swf on a
specifec frame call a method like this
_level0.setButton(2) method from course player;
The setButton(parameter) method defination is in new courser
player. the loaded movie which is in Actionscritp2.0 not finding
this method
in new course player which in Actionscript3.0. its working
well with the old course player.
can any one give me solution to solve the issue.
i can't make changes in course swf files b/c there are
thousand of course filesthank for your reply i have used it but it is two way
communication , as i mentioned in my question
i can't make changes in my As2.0 course swf files. b/c there
are thousand of these course files. -
Hello ..
my problem is tree component and AS3 , before we hade such
easy time with tree component in as2 but now i founded that we cant
talk directly to tree component and we have to use API and XML ,
well i never liked XML and before i worked with tree component
directly and no problem but now , Flex force me to work with XML or
API(well I don’t know what dose it mean ) and I was tiring to
find any way to get directly to tree component in Flex2 and no
result … so my question , do I have use XML ? Is there any
another way to get to Tree Component ? I was looking in Flex help ,
and I find the help content is really bad . pleas help , I get
crazy about this problem …….
BWY this form work terrible on my PC ….. anyone have
same problem ?Use xml. Resistance is futile.
Tracy -
RTMP and RTMPF on mobile: what can be done on IOS and Android ?
What exactly can be done to publish/play video stream on mobile (AIR mobile) ?
Maybe someone knows (yes/no) answers to these simple questions ?
1) can android publish video on AIR ? (H263)
2) can android publish video on AIR ? (H264)
3) can android play video on AIR ? (H263)
4) can android play video on AIR ? (H264)
5) can ios publish video on AIR ? (H263)
6) can ios publish video on AIR ? (H264)
7) can ios play video on AIR ? (H263)
8) can ios play video on AIR ? (H264)
questions concern RTMP and RTMPF.
RegardsNothing. The iTunes Match service does not respect the checked/unchecked state of a song. ALL music is scanned and made available in the cloud.
-
As2 and As3 on same Flash Player
If i set AS2 codes to play in Flash Player 9, is it possible
that this swf can load an As3 swf at the same Flash Player using
As2 codes???
These swfs both play in same virtual machine which is player
version 9 but the other is coded with As2 and the other is coded
with As3. How can an AS2 load a swf coded in AS3 on same Flash
player?
Is this possible?
If yes, how? if no, why not?AS2 and AS3 swfs cannot exist in the same Flash Player
virtual machine - each Flash Player instance (version 9 and
greater) create different address spaces/virtual machines because
the requirements of AS3 and AS2 are so different. -
Using swf and AS3 on supercomputer
I (might) have an opportunity to run my ActionScript 3 project on a Cray supercomputer in couple of weeks.
How can I be sure that I benefit of the multiple processors an big memory space?
And I need to understand how will I benefit?
Is window="gpu" embed tag all it takes, or should I use Alchemy and different ASC?
That gpu -tag is said to give benefits only in some occasions, would this be the occasion?
Maybe there is readymade versions of Flash-Player that will use multiprocessor?
Filesize is below 100kt, but...
My demo is huge fractal with graphics in several (hundreds) nodes, and it can be made even bigger...
I will also use real time generated sounds in background.
Mac mini is already having trouble with it, it would be interesting to see how supercomputer will manage.
Any information?AS2 and AS3 swfs cannot exist in the same Flash Player
virtual machine - each Flash Player instance (version 9 and
greater) create different address spaces/virtual machines because
the requirements of AS3 and AS2 are so different. -
Can you live stream RTMP and HLS
Is it possible to live stream both RTMP and HLS with FMS 4.5?
I want flash users to have the least latency possible using RTMP, and iOS users use HLS.
If this is possible, how can I achieve this?Yes this should be possible..
You can publish on netconnection rtmp://server-ip/livepkgr a stream say "livestream"
On ios, you can susbscribe to http://server-ip:8134/hls-live/livepkgr/_definst_/livestream/livestream.m3u8
On flash, you can subscribe to (Netconnection : rtmp://server-ip/livepkgr streamName: livestream)
Hope it helps -
Trouble using exact_fit with Gaia and as3
I'm building a flash site (with Flash CS4 and AS3) inside of the Gaia framework.
I want to let my visitors toggle between Exact_Fit and No_scale, and I've attached the following code to be triggered by the toggle button.
function toggleExactFit(event:MouseEvent):void
trace ("Here in toggleExactFit to change StageScaleMode");
if (stage.scaleMode == StageScaleMode.NO_SCALE)
stage.scaleMode = StageScaleMode.EXACT_FIT;
this.stage.align=StageAlign.TOP_LEFT;
else
stage.scaleMode = StageScaleMode.NO_SCALE;
// stage.align=StageAlign.TOP_RIGHT;
trace ("Here in toggleExactFit - stage.scaleMode now = " + stage.scaleMode);
Here are my import statements:
import flash.display.*;
import flash.events.*;
import com.greensock.TweenMax;
// Imports used by Global Navigation
import net.kaegi.navigation.NavigationManager2;
import net.kaegi.navigation.NavigationButton2;
import net.kaegi.events.NavigationEvent;
import flash.text.StyleSheet;
import flash.text.TextField;
import com.greensock.easing.*;
import gs.*;
import flash.media.*;
import flash.text.*;
import flash.display.StageDisplayState;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.events.MouseEvent;
import flash.ui.*;
//import fl.video.MetadataEvent; - ONLY with flv playback component maybe
import flash.media.SoundMixer;
This partially works. When the toggle button is clicked, the site does stretch out to try to fill the whole screen, but everything is shifted down by about a hundred pixels and to the right by a couple hundred, so I can't see the right side or lower part of my website. I have my stage set to 960 x 620 pixels, and I checked through my different FLAs to make sure content wasn't spilling past that boundary.
I was trying to get help on the Gaia forums, but one of theri moderators moved the post, saying this was an actionscript question, not a Gaia issue.
So, before going back to the Gaia forums, I want to make sure I have my as3 right and haven't overlloked anythying.
Any suggestions as to what I might have messed up or how to fix it?Thanks. I ran the very test you suggested last night in a standalone fla and the code worked fine, and I sent a note to the moderator this morning (who'd originally pulled my thread as 'non-Gaia related'). The moderator steered me in a new direction (away from exact_fit and toward an onResize function included in Gaia) so trying to get that worked out right now.
I left my post here because I often get a more nuanced understanding of things after asking questions in the Adobe forums and I don't have much experience with exact_fit, noscale and best practices for resizing and scaling content in accord with browser changes.
Thanks for your help. -
Well I'm just starting with Flex2 and AS3. I have some Flash
Experience as I created this
Flash
app entirely in AS2. All I did was put the different components
on the stage, and then initialized them in Actionscript. So now
it's time to re-write it, add a whole bunch of new features, and
generally just make it cooler.
But I'm not understanding a few things here. I'd prefer to
layout the basic structure of my app in a mxml file, but then wire
everything together using class files written in ActionScript.
How do you use anything in the mx.controls package inside of
a ActionScript file? How do you access elements from the mxml file
in an AS3 class file?
Can you create mx.controls in an AS3 file?
I'm currently using FlashDevelop 2.0.2 which has limited AS3
support while I'm waiting for a staggeringly slow FlexBuilder
download to get to me. So maybe it's lacking in some things, but
i'm using the Flex SDK to compile, so I'm sure the errors will
exist in both places.
Any insight? Or something I can read?One more question - how do I access components that may have
been placed on the stage within my AS3 code? I realize I can
probably pass them in at a later time, but I was wondering if I
could directly access them from the stage?
My current code gives what appears to be a
NullPointerException (yeah I'm a Java programmer). Any hints? or is
it even possible?
Let's say my main.mxml looks like this...
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
xmlns:ff="flex.*"
paddingTop="0" paddingLeft="0" paddingRight="0"
paddingBottom="0"
width="500" height="500"
horizontalScrollPolicy="off" verticalScrollPolicy="off"
applicationComplete="onCreationComplete(event);"
layout="absolute"
horizontalAlign="left"
verticalAlign="top"
>
<mx:DataGrid id="datagrid" name="datagrid" x="99"
y="129">
<mx:columns>
<mx:DataGridColumn headerText="Column 1"
dataField="col1"/>
<mx:DataGridColumn headerText="Column 2"
dataField="col2"/>
<mx:DataGridColumn headerText="Column 3"
dataField="col3"/>
</mx:columns>
</mx:DataGrid>
<mx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.containers.Canvas;
import mx.core.Application;
import com.garmin.mb.player.PlayerCanvas;
* the canvas where everything is drawn.
private var mainCanvas:Canvas;
private function onCreationComplete(event:FlexEvent):void {
var main:PlayerCanvas = new PlayerCanvas();
addChild(main);
]]>
</mx:Script>
</mx:Application>
And my PlayerCanvas looks like this...
package com.mb.player {
import flash.events.MouseEvent;
import mx.containers.Canvas;
import mx.controls.Alert;
import mx.controls.DataGrid;
import mx.controls.HSlider;
import mx.controls.TextInput;
public class PlayerCanvas extends Canvas {
* TextInput for nothing of any value;
private var input:TextInput;
* Slider that controls the position of the user on the track
private var slider:HSlider;
* the data table
private var datagrid:DataGrid;
public function PlayerCanvas():void {
this.buildTextInput();
this.buildSlider();
this.datagrid =
(DataGrid)(parent.getChildByName("datagrid"));
this.datagrid.x = 20;
} -
Hi,
I want to know if it is possible for example to start a chat session between 2 people with FMS RTMP, and after a few seconds, try to connect the 2 peers via RTMFP Stratus. If the p2p connection fails, RTMP is the host. Without interuption in the chat session of the 2 peers, everything would happen in the background.
ThanksI got one message about my last reply it seems there was a bit of confusion regarding how it was phrased, so i thought i shall try to answer it once more with a bit detailed explaination:
What i meant in above reply was suppose you are connecting to stratus using NetConnection object on rtmfp for example nc1 and at the same time you can make another NetConnection object connecting to FMS i.e. on rtmp e.g. nc2.
So you will have 2 nc objects existing at the same time without effecting each other. You can simultaneously connect/talk to users using these different nc objects.
The point to remember here is that nc1 can't be used with user of nc2 ie. rtmfp can't be used with user connected on rtmp. So suppose your one user has failed to connect to stratus i.e. rtmfp. Other person opposite to him has to be on rtmp connection to talk to this user on rtmp.
Thanks,
Vivek. -
Hi all,
I am trying to develop a multi player game using FLEX as the
GUI and pure JAVA
as the server. i want to use a message CLASS between client
and server.
some thing like:
http://www.fireleg.com/
but i want that the communication layer will be a CLASS and
not String.
so I am trying to transfer a CLASS between AS3 and JAVA with
no success.
i am using IExternalizable and Externalizable
(readExternal,writeExternal)
and i am getting: StreamCorruptedException.
I working on it with no success and i wounder if there is a
working example for that.
only 4 classes needed:
AS: client.as , message.as
JAVA: server.java , message.java
P.S
i do not mind using AMF3 as long as i can see a working
example.
thank you
gil michlinHi. Take a look at this blog posting.
http://yaa-blog.blogspot.com/2008/08/remoting-with-blazeds-from-plain.html
Basically, you need to call registerClassAlias yourself rather than having the Flex compiler (mxmlc) do the magic for you.
The mxmlc compiler takes the RemoteClass metadata and creates a registerClassAlias call in a static init block in some actionscript it generates. This actionscript is then compiled into the swf that is your Flex application. If you are not using Flex then you are missing this step and need to write the code that mxmlc would have generated for you.
Hope that helps.
-Alex -
Hello,
I need to pause a Captivate 4 movie externally with AS3. The
reason for this is because I have a drag and drop interaction,
therefore I need to pause the movie so the interaction can take
place. This worked perfectly with AS2, but due to issues were
having with flash player 10 and Captivate, we have to use AS3
throughout.
In AS2, all I had to do was put
this._parent._parent._parent.rdcmndPause = 1;
That was it. Bring that into the Captivate file and bang it
paused like a gem.
How do I do that with AS3? Any help would be greatly
appreciated
Thanks
Doug
Update:
I used the attached code to correct the issue, in case anyone
runs into an issue where the need to pause the CP SWF externally...
I know the whole purpose of Captivate is to eliminate the need of
external Flash resources, and even though Captivate is a great
program, it cannot process a drag and drop interaction without
using Flash.> I need to pause a Captivate 4 movie externally with AS3.
The reason for
> this
> is because I have a drag and drop interaction, therefore
I need to pause
> the
> movie so the interaction can take place. This worked
perfectly with AS2,
> but
> due to issues were having with flash player 10 and
Captivate, we have to
> use
> AS3 throughout.
>
> In AS2, all I had to do was put
>
> this._parent._parent._parent.rdcmndPause = 1;
>
> That was it. Bring that into the Captivate file and bang
it paused like a
> gem.
>
> How do I do that with AS3? Any help would be greatly
appreciated
>
I'd expect the same to work. Are you saying it does not?
Steve
http://twitter.com/Stevehoward999
Adobe Community Expert: eLearning, Mobile and Devices -
TLFTextField and AS3 / CS5
Background:
I could not make a purely AS3 TextFlow object display text in the same way as a TLFTextField object in the library, even though the settings appeared to be the same (checked using the library xml file in the fla/zip). (The spacing between letters was not kerned in the same way.)
Therefore I changed tack and attempted to use a library object and update it with AS3. However, I feel that the TLF documentation is somewhat lacking, so I am sharing my findings, simple though they may seem to pros. The text was used for buttons, so I only needed to consider one paragraph with only one span.
What I worked out
It has taken me a long time, but I have finally worked out how to access the elements in a TLFTextField object in the library.
//create an instance of the 'tlfContainer' symbol containing the TLFTextField object, with the Instance name 'tlfTextField' and 'default' as the text.
var container:tlfContainer = new tlfContainer;
//target the textFlow of the object
var flow:TextFlow = container.tlfTextField.textFlow;
//get the first (and only) child of the TextFlow, which is a ParagraphElement
var paragraphElement:ParagraphElement = flow.getChildAt(0) as ParagraphElement;
//get the first (and only) child of the ParagraphElement, which is a SpanElement
var span:SpanElement = paragraphElement.getChildAt(0) as SpanElement;
Now I can change the text (eg span.text = "new text";) and format the text (eg paragraphElement.direction = "rtl") AND have it display correctly!
Questions:
1. Is something like this documented somewhere that I have missed?
2. Is there an easier way to do this, ie directly access elements? Using getParagraph() gave a null, even though the above worked..
3. Why should a dynamically generated TextFlow look different to a TLFTextField object?It took me a while to find it when I saw an example of code a couple of days ago.
It basically means a variable number of comma delimited paramaters. From online doc's:
Statements, Keywords & Directives
Definition keywords
... (rest) parameter
Specifies that a function will accept any number of comma-delimited arguments.
I am trying to find a coding example or two to model my own.
Thanks,
Jim -
Hi,
FMLE is not possible to stream in with secure connection,
right? FMLE pops up an error about invalid url if trying to use
e.g. rtmps:// in FMS url.
Any ideas when this could be enabled?
nnynasRight now FMLE supports only RTMPT and RTMP protocols for
streaming -
Do AS2 and AS3 all play together with Director?
Hi,
I am about to make some incremental changes to a AS2 and Dir CD UI design.
I like the AS3 for making a new movie player and its handling of XML.
I need to share variables between all of them.
Do I need to worry about this mixed environment?
Thanks,
JimSean,
Yes normally do that. I am in the paper/planning stage. I am trying to assign functions to Dir and Flash.
It is simple (first) and elegant I am trying to design towards
I am testing some of the feature with AS2 SWF right now. On rmore issue to debug, and I will need to make a descision on my souce for XML.
I really want to use AS3 in the long run. Although AS2 is better for my newbie programmers (they really only change text strings and add instance names).
AS3 stuff will be singletons that they never get to modify - play movies, run EXE's, open PDF's, goto URL's, tooltips, read XML (for them to supply unique info to external items), etc..
Greensock has some exelent AS3 addons that make it easy to do all of these thing and other XML related (in my design) features and minimize memory use and leaks.
Thanks
Maybe you are looking for
-
Java.lang.Exception:Incorrect content-type found text/html
Dear All, While opening a PCR throught MSS, which is PDF based service, I am getting following error. java.lang.Exception: Incorrect content-type found 'text/html'. com.sap.tc.webdynpro.clientserver.adobe.pdfdocument.base.core.PDFDocumentRuntimeExcep
-
Excise details are not updating in MIGO
hai, i am working with CIN,,i raised a Purchase Order and all the taxes maintained are updating in Invoice tab of PO... whn i am tryimg to enter GR , the excise Invoice and excise item tabs are displaying but the excise values(BED,AED )are not updati
-
For-in-loop produces "ORA-06502: PL/SQL: numeric or value error"
Why i'm getting error "ORA-06502: PL/SQL: numeric or value error" in below code. create table bc ( a number, b varchar2(10) declare type t_bc_a is table of bc.a%type; type t_bc_b is table of bc.b%type; l_bc_a t_bc_a; l_bc_b t_bc_b; begin
-
Powershell script to find number of major and minor version for a item
Is there a way to figure out to get the total major and minor version count for an item in powershell. I can get the count on basis of following "Item Versions" = $item.Versions.Count but not sure how to get number of major and number of minor versio
-
JBIG2 files open only after 'rebuilding'....
I use a third party app to generate PDF files using JBIG2 compression. I notice unusual behavior in Adobe Acrobat 8 Standard that does not occur in 9 or 10 (Std or Pro). When v8 opens these files, it performs a "Rebuilding" process before the file is