Flash :: Add Such A Handler, The NetStream Client Doesn't Function As It Did Before?
Nov 2, 2010
I'm trying to add a custom callback handler to a NetStream client in a p2p application. The problem is, when I add such a handler, the NetStream Client doesn't function as it did before. It seems the NetStream.client object is changed. I know the default object is this. But changing the client to this doesn't solve the problem.The remoteControlStream, is the incoming stream. And the localControl stream is the stream being publishedThis is the localControlStream that's being send by the peer, and received as remoteControlStream:
private function initLocalControlStream():void{
localControlStream = new NetStream(nc, NetStream.DIRECT_CONNECTIONS);
localControlStream.addEventListener(NetStatusEvent.NET_STATUS, localControlHandler);
localControlStream.publish(myPeerID+"control");[code]...
The onPeerConnect method of the localControlStream doesn't get called when I connect when the above handler is added. When I remove the that handler, the onPeerConnect method gets called.
I'm trying to add a custom callback handler to a NetStream client in a p2p application. The problem is, when I add such a handler, the NetStream Client doesn't function as it did before. It seems the NetStream.client object is changed. I know the default object is this. But changing the client to this doesn't solve the problem. The remoteControlStream, is the incoming stream. And the localControl stream is the stream being published. This is the localControlStream that's being send by the peer, and received as remoteControlStream:
private function initLocalControlStream():void{ localControlStream = new NetStream(nc, NetStream.DIRECT_CONNECTIONS); localControlStream.addEventListener(NetStatusEvent.NET_STATUS, localControlHandler); localControlStream.publish(myPeerID+"control"); var localControlStreamClient:Object = new Object(); [Code] .....
The onPeerConnect method of the localControlStream doesn't get called when I connect when the above handler is added. When I remove the that handler, the onPeerConnect method gets called. Obviously the problem is the NetStream.client.
I am having problems with a ChangeWatcher.Everything seems to be set up correctly.The canWatch method returns true, the isWatching method returns true and if I query the return value of the getValue method I get the correct information, including changes. But for some reason the handler function just doesn't fire.
whenever I try to call the removeMovieClip function in a callback handler, it just doesn't work! Maybe I'm tired, or I've just missed something this is apparantly obvious. In my code exert below, is just a simple script that attaches a movie clip to stage (square_mc) and creates a duplicate instance. When the component button is clicked, I want the original movie clip to be deleted, but nothing happens!
Code: this.attachMovie("square", "square_mc", this.getNextHighestDepth()); square_mc.duplicateMovieClip("square_mc2", this.getNextHighestDepth(), {_x:50}) var listener:Object = new Object;[code].............
I have a simple video/chat application built in FLEX. I've created a groupSpecifier,netGroup and a NetStream for the different functionalities. NetGroup is mainly used for the messaging (Posting) and keeping track of the users who enter.NetStream is (or would be used) to control some functions like "start video, stop video" for everyone under the same group.The most important functions I will post on here. The first is setupGroup.
private function setupGroup():void{ var groupspec:GroupSpecifier = new GroupSpecifier("vid"+GROUP_ID+"_sid_"+SESSION_ID); groupspec.serverChannelEnabled = true;
We are sending a multiple streams from FMLE to FMS, and then playing them with NetStream instances. We could have several streams playing on the same flash canvas. The idea is to use ActionScript to synchronize the playback of these streams using embedded system timecode from FMLE, so all the camera angles are playing at the same place in the stream. However if we use the onFI handler to receive timecode data we see one of the streams reporting valid timecode, and the other seems to get 'stale', reporting the same infoObj.st value for multiple onFI events.
All FMLE /FMS instances are configured identically - either stream will decode valid timecode it played on its own - just not while both are running in the same stage!
I import a external SWF into a UILoader, the SWF contains a netStream that I need to close from a Main.swf event handler, slideShow_btn. Basically from Main.swf when/if slideShow_btn event happens I need to check and close the nsStream in videoplayer.swf Here are my event handlers in Main.swf
I've got a feature-heavy video player for a client that needs to do pretty much EVERYTHING that flash video can do. Included in the to-do list is bandwidth sniffing for dynamic video switching, which I've managed to make happen using SimpleClient, a custom netstream client class that can pump out the the users bandwidth(see below). The problem with this client is that it didn't include an onMetaData function that can give me all the stats on the streaming flv. In short, does anyone know how to add that functionality to the following .as file? Or, perhaps, does someone have a netstream client that DOES have all the bells and whistles?
Are there any known issues with the rtmplite server and NetStream.bufferTime? For some reason, while adding NetStream.bufferTime = 2 it doesn't work for me. It does work with Red5 though.
I'm trying to create a simple application that streams the webcam to FMS 4.5 (running on a Windows 7 machine), and then displays the published stream locally. Here's my code:
All traces in the event handlers show the NetConnection connecting successfully, and the netstream publishing successfully. However, I get no video output from this. I've confirmed this using the sample video player in FMS 4.5 as well. There is also a weird traffic pattern reported in the FMS Admin console.There is some traffic (~4K) when the NetStream first publishes, but after that there is no activity.
So I built a videochat client that uses the adobe stratus protocol. Its very simple and just connects two users. However, after about a minute of video chatting the clients freeze and the browser crashes.what might have caused this? Is there some sort of cache that I need to clear every so often or a possible memory leak? I am not sure where to start
Am building a video chat application and i was wondering if there are any native events for the NetStream that fire,that can help in detecting when a remote client starts/stops streaming video over his outgoing stream (NetStream) to which the other client has subscribed over P2P/RTFMP in AS3 ?I maybe able to dispatch custom messages since the two clients are already connected, but i don't want to add the extra overhead.
If I run add('movie123'). How do I get the string 'movie123' in the enter_frame_handler function? UPDATE This forum post (Click Here) describes the issues I am having but doesn't provide the solution I am looking for. Luckily @kapep provided a simple solution that solved the issue.
I have a series of mp4 videos (H.236 @ 22 fps) streaming from an akamai FMS serve via RTMP protocol in flash player 9+ with AS 3.My goal is to create client side playlists that smoothly switch from one stream to another. I am creating these playlists using a series of netStream. play (filename,start,len) methods. If I don't use an offset for the start parameter, then the stream switches smoothly from one video to the next with not noticeable jump or jerkiness. However if I introduce a start offset, say a few seconds in, I start to see a quick little hiccup or pause between the seams as it switches from one playlist stream to the next.
I need to return to my original function after capturing an event (downloading something) with another function. The original function needs to return a value, which depends on the downloaded data. So, I'd like to pause original function for the time needed for the download and the eventhandler function to complete it's work, and resume it afterwards.
The obvious way is to set a flag value (both the original function and the eventhandler are within the same class) and make the original function check it until the eventhandler function changes the flag. But that would be wasteful, and my AS is slow enough already:) [other parts of the application utilise some heavy graphics]. Is there another way? Like an event that gets captured "in the middle" of the function? Or some other form of flow control?
I am using NetStream to play some .flv files on local disc. My code skeleton is:
public class AdvertisPanel extends MovieClip { private var _video:Video; private var _connection:NetConnection;
[Code].....
I used some .flv files that I download from YouTube to test; and I found that the handler metaDataListener would not be called when playing some .flv files, but some would. Is the problem caused by the video file? Because I may resize the video before play it on the screen, and I really need to know its original width & height.
if I put in the contentPath of a FLVPlayback component a file that doesn't exist, how can I catch an error event? (All files are loaded locally, without a FMS) I tried to dodge the problem using other events, but if the file doesn't exist, pretty much none of the events will work.
The main problem is that the FLV doesn't load/play, which most likely causes the secondary problems, such as the bufferClip always visible and no way to test the video and audio scrubbers.
I followed lee's tutorial to create my own video player and I'm using AS3 for that. The problem is that for some reason, pause() doesn't work, it will pause the first time I clicked it, but it wouldn't go back and play again. I looked through AS3 books and online, everything tells me that pause() should be able to pause and resume. Another thing is that if I try to use pause(true), an error would appear and tell me that the argument should be no more than zero, and I'm like "why?????" so here's my code, it is basically based on lee's code but in AS3...
I'm making a small video players in AS3, and I've found that after calling NetStream.pause() or NetStream.togglePause(), no status messages are being fired any more.If I click the "pause" button while the video is buffering, I never get the Buffer.Full message.Here is some code:
_connection = new NetConnection(); _connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); _connection.connect(null);[code].....
Is there a way to get the handler(s) function(s) of an event listener?
I'm trying to find a way to remove them without knowing what they are.
For example:
ActionScript Code: if (mc.hasEventListener(MouseEvent.CLICK)){ // this object has a MouseEvent.CLICK listener mc.removeEventListener(MouseEvent.CLICK, null ); }
Instead of null, I was hoping to find some function that retrieves the handler function.
I'm trying to make a CustomLoader class that extends another class.In the contructor of my CustomLoader, i need to call super(myLoader:Loader) where myLoader is a Loader object. Problem is I need to listen to the complete event of the loader before passing it or i'll get an "Error #1009: Cannot access a property or method of a null object reference". but if i put super() in a handler function i get an "Error 1007: A super statement can be used only inside class instance constructors."
Here's part of my code:
Code: public class CustomLoader extends ParentClass { ... public function CustomLoader():void
I'm trying to start a function from within a click handler that is being triggered when I load some XML, just like this:
Code: function LoadSomeXML(e:Event):void { thumbContainer_mc.addEventListener(MouseEvent.CLICK, thumbClick); } function thumbClick(event:MouseEvent):void { startImgSlider(); } function startImgSlider():void { trace("ok, now you reached 'startImgSlider()' function !!!"); }
The problem is that I cannot reach the startImgSlider() function with the code above. How to do it right. Has something to do with the scopes?
I've created a button (type: MyButton) with two child, a text (TextField) and a image icon (type: MyIcon). Then I've append an eventlistener mouse_click on my button. As soon as I click on the text, the e.target on the handeler function is recognized of MyButton type. Otherwise, if I click on the image icon (child of button) the e.target is MyIcon type, instead of MyButton. How can I prevent this? I need all click to be recorded on the button, where I've stored some attributes I need on handler function.
I want to call the same event handler function with a click and also with a custom event. the problem is the event type that needs to be passed to the function. Is there are generic event type that can be used to call the function from both places?
Code: menuBtn.addEventListener(MouseEvent.CLICK, menuOpen ); function menuOpen(event:MouseEvent){
I have literally spent HOURS trying to solve this mystery... but simply can't seem to get hold of it. I am using the same code lines (literally!) as the example here (official adobe tutorial) and I get different result.
[Code]...
Everything works fine, i.e. everything till it is time to fire the loggedin event. I get asked to log in and all permissions are asked correctly. After I log myself in to facebook, the loggedin event doesn't fire. Is there any way of solving this problem??