NetStream Question
So I have a video that is using NetStream and all that jazz to play the flv. Is there a way I can restrict the video from play until say, 20% of it is loaded?Here is my code so far. Code: var video:Video = new Video(600, 300);addChild(video);video.x = 10;video.y = 10;VideoMask.cacheAsBitmap = true;video.mask = VideoMask;var nc:NetConnection = new NetConnection();nc.connect(null);var ns:NetStream = new NetStream(nc);ns.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);function onStatusEvent(stat:Object):void{ trace("MOVIE LOADED");}var meta:Object = new Object();meta.onMetaData = function(meta:Object){}ns.client = meta;video.attachNetStream(ns);ns.play("assets/content/video/FormativeDemoReel.flv");
KirupaForum > Flash > ActionScript 3.0
Posted on: 04-02-2008, 05:09 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
NetStream.Play.Stop/NetStream.Buffer.Flush Called Prematurely
So I've created a custom video interface (based on the one Lee Brimelow created in his Lynda.com tutorials ) that hinges on the NetStream.onStatus events. It uses the Play.Start and Play.Stop to create an onEnterFrame that updates the progress bar/seek functions/timecode/etc.
My problem is that when I connect it to a FVSS/Media Server, the 'NetStream.Play.Stop' and 'NetStream.Buffer.Flush' events are called about 75-80% of the way through the video - yet the video continues to play perfectly until the end of it. This causes some crazyness with my control interface in relation to controling the video.
So far i've tried it on a 3rd party streaming service, and the dev version of Media Server 2. Same error both places. I'm using the simplest code possible (this is the code for the 3rd parth FVSS, hence the extra parameters in nc.connect).
quote:var serverName:String = "server";
var appName:String = "path";
var streamName:String = "filename";
var client_nc:NetConnection = new NetConnection();
client_nc.connect("rtmp://" + serverName + "/" + appName, false, streamName);
var ns:NetStream = new NetStream(client_nc);
ns.onStatus = function(info){
trace(info.code);
}
testVideo.attachVideo(ns);
ns.setBufferTime(2);
ns.play("whatever");
If anyone can tell me why those two events are being fired 75-80% of the video when it has clearly not Stopped Playing or give me any workarounds for dealing with this, I'll make out with you eternally. Or just be very happy.
Any information on this would be great - I've scoured all the searches/forums for any info on this, and haven't found anything.
Many many thanks for your help!
-will-
Netstream?
I have a netstream video but How can I listen for when its finished, and when it is finished, it starts a function?
PHP Code:
var customClient:Object = new Object();
customClient.onCuePoint = cuePointHandler;
customClient.onMetaData = metaDataHandler;
var myVideo:Video = new Video();
addChild(myVideo);
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.client = customClient;
myVideo.attachNetStream(ns);
ns.play("GEMVideo.flv");
function cuePointHandler(infoObject:Object):void {
trace("cuePoint");
}
function metaDataHandler(infoObject:Object):void {
trace("metaData");
}
NetStream Help
Ok so here is my code:
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
this.video.attachVideo(stream_ns);
stream_ns.play("theVideo.flv");
stream_ns.onStatus = function(infoObject:Object) {
trace(infoObject.code);
if ((infoObject.code) == "NetStream.Play.Stop") {
trace("stopped!");
}
};
However in a rush I had repasted that in 3 frames, instead of having a nice little function on the main timeline.
Now that the client is reviewing I'm trying to make the code all pretty and my function even though it's called, doesn't seem to find my video holder...
here's the function:
function startVideo(foo) {
var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
trace(stream_ns);
_root.allClips["clip"+foo].overState.filmStrip.videoHolder.attachVideo(strea m_ns);
stream_ns.play("theVideo.flv");
stream_ns.onStatus = function(infoObject:Object) {
trace(infoObject.code);
if ((infoObject.code) == "NetStream.Play.Stop") {
trace("stopped!");
}
};
Any suggestions, ideas, insights will be very very apreciated
NetStream Mp3
hi guys,
I have previosly built an mp3 player for dropmusic co.uk but am at the minute looking into wether it is better to use the netstream methods rather than conventional methods and wether net stream methods can be used without thee communication server.
any advice or links please
Gaz.
NetStream Help
I've been having problems getting flvs to play from a flash media server.
I have two buttons on the stage: stream_btn and local_btn as well as a video Object with the instance name myVideo. And the following code on the first frame of the root timeline:
stream_btn.onRelease = function() {
var myConnection:NetConnection = new NetConnection();
myConnection.connect("rtmp://server/app/");
var myStream:NetStream = new NetStream(myConnection);
myVideo.attachVideo(myStream);
myStream.play("welcome.flv");
};
///////////////////////////////
local_btn.onRelease = function() {
var myConnection:NetConnection = new NetConnection();
myConnection.connect(null);
var myStream:NetStream = new NetStream(myConnection);
myVideo.attachVideo(myStream);
myStream.play("../finalVideos/welcome.flv");
};
The local_btn works fine loading in the flv I want but the streaming_btn doesn't. I know from looking at the FMS console that the NetConnection is working but it isn't streaming any video. This is the first time I have ever used FMS so it is probably something really simple. I really need to get this working as it is the only thing stopping me from completeing this project.
Any help would be greatly appreciated.
NetStream
In AS 2.0, I had this to play a video:
ActionScript Code:
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.bufferTime(5);
videoP.attachNetStream(ns);
var flv_mc = new MovieClip("flv_mc", this.DisplayObjectContainer.numChildren());
flv_mc.attachAudio(ns);
var audio_sound:Sound = new Sound(flv_mc);
ns.play("http://flv.dudeel.com/flv/1S8mjiomLN0IW.flv");
It no longer works...
Where Is NetStream?
I have some Actionscript that is interesting.
I have use some time now MediaDisplay but I can't find NetStream?
Is that some Components or is that script?
When I use MediaDisplay I just but that in my flash and then start to create some code but I can't find NetStream
Maybe sound crazy for you but for me that is
NetStream Help
Hello,
I've gone through Lee Brimlows Video Basics tutorial and am in corporating some of whwat I learned with the MM tutorial creating an XML dynamic playlist. I've got most of it working but I'm having trouble with the video player controls.
For some reason I'm not able to "get" my NetStream object for things like the scubb bar and volume button. I'm using an #include file for the netconnection and stream. Its also connecting to a Flash COmm Server.
Heres my code for the connection (located in the #include file)
Code:
//Set up the list box, call function VideoThumb to create the actual thumbnails
list.rowHeight = 70;
list.cellRenderer = "VideoThumb";
list.selectable = true;
//create new empty listener object
listListener = {};
//Function to handle what happens when an item in the list is selected
listListener.change = function( evtobj ) {
var nav = list.dataProvider[list.selectedIndex];
nc = new NetConnection(); //create a connection
nc.connect( nav.attributes.url ); //connect to FCS
ns = new NetStream(nc); //create a stream
video.attachVideo(ns); //pipe stream to this video object
ns.connect(); //connect the stream
// walk through the chosen item, build and play it
var reset = true;
for ( var i = 0; i < nav.childNodes.length; i++ ) {
var stream = nav.childNodes[i];
if ( stream.nodeName == "stream" ) {
ns.play( stream.attributes.name, stream.attributes.start, stream.attributes.len, reset );
reset = false;
}
}
}
//Add an event listener on the list, when it triggers, run the listListener function to repopulate the list
list.addEventListener("change", listListener);
And my code for the mute button (from Lee's basic video tutorial #8)
Code:
//mute button
_root.createEmptyMovieClip("vSound",_root.getNextHighestDepth());
vSound.attachAudio(ns);
var so:Sound = new Sound(vSound);
so.setVolume(100);
mute_mc.onRollOver = function() {
if(so.getVolume()== 100) {
this.gotoAndStop("onOver");
}
else {
this.gotoAndStop("muteOver");
}
}
mute_mc.onRollOut = function() {
if(so.getVolume()== 100) {
this.gotoAndStop("on");
}
else {
this.gotoAndStop("mute");
}
}
mute_mc.onRelease = function() {
if(so.getVolume()== 100) {
so.setVolume(0);
this.gotoAndStop("muteOver");
}
else {
so.setVolume(100);
this.gotoAndStop("onOver");
}
}
I've tried tracing my netStream object but nothing comes in, even though the video plays. My roll over states work for the mute button too but the volume doesnt change
Any idea on what I'm missing?
Thanks
Greg
Netstream
I wondered if anyone knows why the netstream connection works in flash 8 but not flash 9 plugin. I was working on netstream connections on my computer and uploading it to my server (windows 2003). A friend said he could not get the video to play. I went to Adobe and downloaded the Flash 9 plugin and then I could not get it to play either (this is online). Then I uninstalled the flash 9 plugin and reinstalled flash 8 plugin. I went back online and it worked great.
I searched all over the web for three days and got very little mention of the online streaming information, and nothing about the differences between the plugins. I would appreciate any help. Thanks
Netstream
I wondered if anyone knows why the netstream connection works in flash 8 but not flash 9 plugin. I was working on netstream connections on my computer and uploading it to my server (windows 2003). A friend said he could not get the video to play. I went to Adobe and downloaded the Flash 9 plugin and then I could not get it to play either (this is online). Then I uninstalled the flash 9 plugin and reinstalled flash 8 plugin. I went back online and it worked great.
I searched all over the web for three days and got very little mention of the online streaming information, and nothing about the differences between the plugins. I would appreciate any help. Thanks
NetStream
Hello,
Has anyone experienced a clicking sound after a video plays using NetStream? I have a video that is stretched out 200 frames and once it's finished I hear "CLICK". I can't figure this out. Hopefully someone can help.
Thanks.
FLV And Netstream
Hi i have a simple problem. I have video I want to play but I want to edit the end of the video of. I do not want to edit it with adobe pro. I want to play the flv file and stop the video/visual say 3 secs from the end just the video. How do you do this with action script.
The only way i could think of doing this is to monitor the ratio of the bytes loaded when it reaches a point switch the video of and allow the sound.
Or when it reaches a certain point switch on a black screen in the swf file.
Could an expert give a definitive concept or the proper way around this problem
FLV And Netstream
Hi i have a simple problem. I have video I want to play but I want to edit the end of the video of. I do not want to edit it with adobe pro. I want to play the flv file and stop the video/visual say 3 secs from the end just the video. How do you do this with action script.
The only way i could think of doing this is to monitor the ratio of the bytes loaded when it reaches a point switch the video of and allow the sound.
Or when it reaches a certain point switch on a black screen in the swf file.
Could an expert give a definitive concept or the proper way around this problem
NetStream
Is there a way when you load an flv and use the netConection and then netStream to find out the end frame of the flv when it has loaded in?
Basically the last frame of the video.
The reason for this is if the video is finished I want it to go back to the first frame.
NetStream
I have a site that was a template that some asked me to update for them. One of the things I did was to add streaming video with an FLV flash player using the NetStream function. The problem I have with this and all my NetStream functions is that when I stop a video from playing then go to another video I can have it stop and seek back to the beginning but I want it to clear the Video to be blank so it does not flash an image from the last video when you start another one after interrupting the one that is currently playing. I have tried using the ns.close(); but that does not seem to work.
Here is the example. Go to http://www.positivelivingproductions.com, then click on the Demo section, choose any section except radio, click "HERE" on the site to start the video which will play in the space to the left, once you can see an image press the back button, or go to another section. At this point go back to the Demo section and choose radio. Click "HERE" to play you will see the video is stuck in the previous frame that you stop the video at.
I hope this in not too confusing and if you can help it would be greatly appreciated.
NetStream
Is there a way when you load an flv and use the netConection and then netStream to find out the end frame of the flv when it has loaded in?
Basically the last frame of the video.
The reason for this is if the video is finished I want it to go back to the first frame.
Netstream
Ok now a real question. Trying to dynamically load .flv files. I've used the actionscript example from macromedia's site and it seems to be loading correctly. But only the audio is playing. My display link appears to be correct, but I cannot figure out why it is not playing the video. here is my code:
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
display.attachVideo(ns); // my_video is a Video object on the Stage
ns.play("laura.flv");
my display is called display, but all i hear is the audio from laura.flv. also. the linked mediacontroller no longer controls anything.
NetStream FLV
Hello,
I have generated an educational video via a very large streamed FLV object (60 mins play time). The movie streams correctly into the “emptyvideo” frame. I have a "jump movietime forward" button that jumps forward 10 seconds/click and works fine. If the 10 second jump forward button exceeds the buffer, the “loading… please wait” file correctly loads until the buffer catches up and then the movie correctly continues. I can stream and view the entire movie without problems.
The timeline-frame structure:
The “emptyvideo” frame begins in frame 80 and continues to frame 100.
My rationale:
In frame 80 the movie is streamed and viewed (without problems).
A user quiz regarding the streamed movie contents is set up on frame 100.
The user jumps to frame 100 by:
1.Video has been viewed in its entirety and automatically jumps.
2.The user wishes to skip the video and jumps to taking the quiz.
The problem:
If the user incorrectly answers the quiz question, the seek method shows the movie at the part that answers the question and then stops, and then makes available the next question.
Depending on where the answer lies in the movie stream time, it may take quite awhile to load the movie to view the answer spot. (as it is a large FLV file).
All of this currently works, but the viewing of the incorrect answers does take time.
Rationale:
I assumed by keeping the “emptyvideo” frame across both the movie-viewing frame and the quiz part- frame, I would avoid the delay when “seeking” the answer part in the already streamed FLV movie.
Probable incorrect assumption: The streamed FLV content remains in total within the cache and is readily available for recall.
Potential solutions I’ve pondered:
1.Break the movie up into multiple short clips (1 min. clips X 60). Therefore the delay time in viewing the answer to the incorrect question is shorter but streaming the entire movie seamlessly to be viewed in frame 80 may be a problem.
2.Create the movie-answer files independently from the large movie (1 movie-answer file for each question) which could then be preloaded or streamed in the quiz-answer part and be ready for viewing if the users incorrectly answers the question.
3.stream the large FLV file but start the stream at the seek time of the answer to the question (which can be anywhere in the streamed movie), so that it is ready to play without delay if the user answers the question incorrectly. However, I don’t know how to do that or if it can even be streamed like that.
I have used PC based Flash Professional 2004. I’ve parked the SWF file and the FLV file on my server. If you wish to view the file:
http://www.sedonaredrock.com/flash/Library2.html
Click on the “Cont.Med.Education” button
For the registration section just enter gobbly gook.
Click the “Cardiac” button.
To take the quiz, click the “Take the Cardiac Test” button.
Thank you for your time.
Regards
Jim
NetStream Help
Hello,
I've gone through Lee Brimlows Video Basics tutorial and am in corporating some of whwat I learned with the MM tutorial creating an XML dynamic playlist. I've got most of it working but I'm having trouble with the video player controls.
For some reason I'm not able to "get" my NetStream object for things like the scubb bar and volume button. I'm using an #include file for the netconnection and stream. Its also connecting to a Flash COmm Server.
Heres my code for the connection (located in the #include file)
ActionScript Code:
//Set up the list box, call function VideoThumb to create the actual thumbnails
list.rowHeight = 70;
list.cellRenderer = "VideoThumb";
list.selectable = true;
//create new empty listener object
listListener = {};
//Function to handle what happens when an item in the list is selected
listListener.change = function( evtobj ) {
var nav = list.dataProvider[list.selectedIndex];
nc = new NetConnection(); //create a connection
nc.connect( nav.attributes.url ); //connect to FCS
ns = new NetStream(nc); //create a stream
video.attachVideo(ns); //pipe stream to this video object
ns.connect(); //connect the stream
// walk through the chosen item, build and play it
var reset = true;
for ( var i = 0; i < nav.childNodes.length; i++ ) {
var stream = nav.childNodes[i];
if ( stream.nodeName == "stream" ) {
ns.play( stream.attributes.name, stream.attributes.start, stream.attributes.len, reset );
reset = false;
}
}
}
//Add an event listener on the list, when it triggers, run the listListener function to repopulate the list
list.addEventListener("change", listListener);
And my code for the mute button (from Lee's basic video tutorial #8)
ActionScript Code:
//mute button
_root.createEmptyMovieClip("vSound",_root.getNextHighestDepth());
vSound.attachAudio(ns);
var so:Sound = new Sound(vSound);
so.setVolume(100);
mute_mc.onRollOver = function() {
if(so.getVolume()== 100) {
this.gotoAndStop("onOver");
}
else {
this.gotoAndStop("muteOver");
}
}
mute_mc.onRollOut = function() {
if(so.getVolume()== 100) {
this.gotoAndStop("on");
}
else {
this.gotoAndStop("mute");
}
}
mute_mc.onRelease = function() {
if(so.getVolume()== 100) {
so.setVolume(0);
this.gotoAndStop("muteOver");
}
else {
so.setVolume(100);
this.gotoAndStop("onOver");
}
}
I've tried tracing my netStream object but nothing comes in, even though the video plays. My roll over states work for the mute button too but the volume doesnt change
Any idea on what I'm missing?
Thanks
Greg
NetStream AS2
I'm sure a million questions have been asked about this, but I want to scrub a video and have every frame play when scrubbed, not jump by keyframes.
I have the scrub feature worked out and it works fine, but it jumps 1 second at a time and I want to play everyframe as I click and drag my mouse back and forth on the scrub bar.
My video netstream class has a method called seekMe.
Here it is
I'm passing it scrubber._x, scrubberBar._width, and scrubber._width;
ActionScript Code:
public function seekMe (shX : Number, sbW : Number, shW : Number) : Void
{
ns.seek (Math.floor ((shX / sbW) * dur));
}
Again, I want it to...so when I move the mouse back and forth...play each frame...not just skip. I think it may have something to do with just incrementing the current ns.time+value...but I can't figure out how to get value and have it work for me.
I will keep trying this evening.
Thanks
NetStream
When you import flv's dynamically, you can only use the methods that come with the netStream class. Does anyone have experience using this? I cant seem to get the same playback control (ffwd, rewind) as I would have with normal (*.swf) video.
thnx in advance
Jan
NetStream Bug
Hello All,
I believe I've discovered a bug in the NetStream Class, just for everyone else and for future reference.
Let's say a user wants to display a video then terminate that video once it ends, or just reliably detect when a video ends.
The thought process is this:
Create a NetConnection, NetStream, and Video object to handle playing and displaying the video.Add event listeners for NetConnection and NetStreamOnce the NetStream has fired the stop command (ie: when the movie has ended), the movie should be over and the user will be able to apply functionality from there.
However, this is not always the case, and I have recreated this bug multiple times. I have a video that flashes in the last few frames. I want to time the end of the video with actionscript so I can update some flash stuff, you get the idea. However, the NetStream dispatches "NetStream.Play.Stop" too early, by half a second or so.
The only workaround that I've found for this is a plain ol' EnterFrame (or Timer) listener that sees if NetStream.time == videoLength (videoLength being the duration value received in an onMetaData event that NetStream fires).
Has anyone else encountered this bug and/or an alternative workaround?
- TK
Netstream
Hello all,
I was wondering. On my main timeline i have a container in which an external swf is loaded into. In the loaded MC i have a Netstream connection to load an flv. How can I have it so when the flv is finished playing, have the netstream close and then have a gotoAnPlay another frame in that swf?
NetStream.seek()
I am trying to get the seek function to work with the netstream but it has been doing funny things. In this example the video is 4.75 seconds long.
If I call my_ns.seek(1) the stream goes to 2 seconds.
If I call my_ns.seek(2) the stream goes to 2 seconds.
If I call my_ns.seek(3) the stream goes to 4 seconds.
Attach the .flv file code:
Code:
my_nc = new NetConnection();
my_nc.connect(null);
my_ns = new NetStream(my_nc);
my_ns.play("cyclers.flv");
vid_stream.attachVideo(my_ns);
function onDisconnect() {
my_ns.close();
}
Button code to call the seek method:
Code:
on(click)
{
_parent.my_ns.seek(2);
_parent.my_ns.pause();
}
Does anyone know why this is happening or a way of making the seek function go to the correct position in the stream. Are there any unwritten rules about this?
NetStream Problem
I have set up everything and it works ok offline but when I put it online it does not work.
Code:
var nc = new NetConnection();
nc.connect(null);
var ns = new NetStream(nc);
videoContainer.attachVideo(ns);
ns.setBufferTime(15);
ns.play("reel_1.flv");
//============ PROGRESS CHECK =======================
checkProgress = function (ns) {
var btsLoad = ns.bytesLoaded;
var btsTotal = ns.bytesTotal;
var percent = Math.floor(btsLoad/btsTotal*100);
progressBar._xscale = percent;
if (percent>=100) {
clearInterval(poll);
}
};
var poll = setInterval(checkProgress, 1000, ns);
The player is only 2K and has three buttons and a download bar but this doen't even show up what is going on.
LINK TO ONLINE PLAYER
NetStream Control
mx2004
hey all, Im trying to control the playback of a streaming flv. I have a play_btn , rew_btn that work fine. What I want to do is be able to scrub my playhead to different points in the video. I have attempted it with this code here: this is only part of the code...
Note* I pretty new to programming so be nice =)
playHead_mc.onPress = function(){
pressing=true;
startDrag (playHead_mc,false,_x,_y,_x+225,_y);
}
playHead_mc.onRelease = playHead_mc.onReleaseOutside = function(){
stopDrag();
pressing = false;
}
if(pressing==true){
final_ns.seek(playHead_mc._x/20);
}else{
playHead_mc._x=final_ns.time*20.5;
}
the seek / 20 and the time * 20.5 numbers is where my problem is i think. I choose those numbers because they got me pretty close to scrubbing the playhead correctly. And when i stream a different length flv. I have to adjust those numbers. I do have the metadata embeded into the flv.
With this code i get pretty close to a working product, buts its not perfect by any means. Could some nice programmer please help me out. Any little hint would be great. thanks for your time
NetStream.seek() Help
Howdy,
I am working on a tutorial I found at:
http://www.devarticles.com/c/a/Flas...deo-and-Sound/8
I can get my .flv to stream through an embedded video instance with no problem.
I cannot get NetStream.seek() to work. When I enter a seek number and push my seek button... the video stops. No matter how much video has played and what number I type in. However, when I seek to 0,NetStream.seek(0), it rewinds the video and plays from the start like it should.
I have an embedded video with an instance name: flashVid_video.
I have a seek button with an instance name: seek_btn.
I have an inputText with an instance name: seek_txt
I have a .flv at the same level as the .fla named: part3.flv
The code on the first, and only frame is:
//Make NetConnection
var makeConn_nc:NetConnection = new NetConnection(); makeConn_nc.connect(null);
//New NetStream
var netWork_ns:NetStream = new NetStream(makeConn_nc);
//Connect to Video instance
flashVid_video.attachVideo(netWork_ns);
netWork_ns.play("part3.flv");
var seekHear:Object = new Object();
seekHear.click = function() {
var seeker:Number = parseFloat(seek_txt.text);
netWork_ns.seek(seeker);
};
seek_btn.addEventListener("click", seekHear);
Could someone tell me what I am doing wrong and why it will not seek to any other time but 0?
Thanks,
computerpain
NetStream Class
I have been tryin the old netStream class for a while now but just dont really know
Any suggestions critiques..?
http://lmcdizain.co.nz/netstreamtrial_002.html
Clearing FLV Using Netstream
Hi there.
Just put a new site up: www.faithsfx.co.uk which uses flv's in the video section.
Can't work out how to unload an FLV once it has started playing. If someone plays an MP3 on the site, I need the FLV to close the stream and unload.
At the moment, I am getting around it by loading another blank 1 frame long flv, but I would really like to know how to do it properly.
Thanks
Close NetStream
I have a video in a scene and when leaving that scene and going to another scene the audio continues to play. I need a script that closes the netStream object when leaving a scene. I know I can use close(); but I need that to be on exiting the scene, not on a button instance.
Thanks for any help !!!
Targeting A NetStream
I have a netStream in a movie clip with an instance name of "vidOne"
var ns:NetStream = new NetStream(nc)
If I set it up to play a video in the movie clip it works "ns.play("vidname.flv");
but if I try to target it from the root it won't "vidOne.ns.play("vidname.flv");
does anyone have any suggestion's as to why?
flash 8 on windows
NetStream/NetConnection
Does anybody know if you call NetConnection.close() while a NetStream object is loading, if it will now cancel the load?
What I am trying to do is just grab a first frame screenshot of the video without the entire video streaming in the background.
In AS2, there was no way to stop the load progress once it started. But there was a hack. After the first video starts loading, and buffered the first frame, it would then make a call to NetStream.play("non-exist.flv"); in essence killing the last stream.
I'm just wondering if there is a cleaner way of doing this with AS3. Especially since the Loader class has the Loader.close() method which actually stops the download.
Pass NetStream To ASP.NET
I was wondering how do i send NetStream object to ASP.NET page/form.
What i want is actually recording sound using a microphone and then send the result to the Windows server (any format/extension is acceptable).
I found that actually sound cannot be recorded on the client side but, rather you can only set up a small buffer by using NetStream object and finally publish the stream to the server. But, for one Flash n00b like me it's very confusing.
Thanks
Netstream Proxy
Is there a way that I can stream the netstream through a php proxy to use sessions and php specific things? Like can I send video up to the php then the php makes sureyour logged in then sends it to the flash com server?
Complicated Netstream...4 Me Anyway
Hi all
OK here is my problem. Researching I find that it might be because of the flash 9 problem of releasing NetStream actions from the cache?
Anyway. I have a movie on frame 1 that loads FLVs and thumbnails from gallery.xml.
Then, what I am trying to do is have my button take me to frame 2 where I have the same movie (in a independant frame). Now the AS on this frame is the same except it calls portfolio.XML to load a different set of thumbnails and FLVs. O I am trying to use the same movie clip with different actionscript on seperate frames in the same timeline.
The problem is that the content from the first frame does not dissappear, the new frame content just loads on top of it making a mess and piling up assets. So it just doesn't work . I've gotten around it by having seperate movies for each catagory but this is not ideal.
Basically I am trying to have this frame full of Netstream and action code, act just like any other frame and dissappear, sounds stop, and clear out when a new frame is navigated to. Hope this makes sense.
Research shows that adding event listerners or something is the way around this bug. Unfortunetly the solution is beyond me at this level, If anyone can help or offer a solution you will be on my Christmas card list.
Netstream Buffer Or ?
hi all - anyone know the answer to this question?
i have an fla that calls external classes to get things working, in that class there is a call to set up and connect to a netstream function/object - that creates the connection and attaches the video to play using this
PHP Code:
}
private function loadVideo(n:String):void{
if(video !== null){
removeChild(video);
video = null
}
if(!imageArray[n]['video']){
return;
}
var connection:NetConnection = new NetConnection();;
var stream:NetStream;
trace("playing video");
video = new Video();
connection.connect(null);
stream = new NetStream(connection);
stream.client = this;
addChild(video);
video.attachNetStream(stream);
stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, function(){});
stream.bufferTime = 1;
stream.receiveAudio(true);
stream.receiveVideo(true);
trace(videoPath + imageArray[largeImageItem]['video']);
stream.play(videoPath + imageArray[largeImageItem]['video']);
addChild(video);
}
the first click/viewing works fine, so i close it and then choose another flv to play - but this time the flv will only play, say 5-10 seconds of new flv - then the flv freezes and doesn't play any more of the flv.
there is some script that functions on the click of the 'close' button that is this:
PHP Code:
/**
* FUNCTION
* _______________________________________________________________________________________________________________________________________
*
* hide large image when close on controlpanel is clicked.
* @eventType MouseEvent
* @param none
*
*/
private function hideLargeImage(event:MouseEvent):void
{
/**
* remove eventlistener from stage for zooming large image.
*
* @fixed 06/11/08
* @comment listener is now removed properly after closing large image zoom viewmode
*
*/
stage.removeEventListener(MouseEvent.MOUSE_WHEEL, zoomLargeImage);
/**
* @version 2.0
* remove previous and next image buttons.
*
*/
Tweener.addTween(prevThumbnailContainer, { _autoAlpha:0, time:0.5, delay:0, onComplete:function():void {
removeChild(prevThumbnailContainer);
prevThumbnailContainer = null;
} } );
Tweener.addTween(nextThumbnailContainer, { _autoAlpha:0, time:0.5, delay:0, onComplete:function():void {
removeChild(nextThumbnailContainer);
nextThumbnailContainer = null;
} } );
Tweener.addTween(video, { _autoAlpha:0, time:0.5, delay:0, onComplete:function():void {
removeChild(video);
video = null;
SoundMixer.stopAll();
} } );
/**
* hide tooltip on click.
*
*/
removeTip();
/**
* set help box status to false for proper loading next time.
*
*/
helpShowStatus == false;
/**
* fade out help box.
*
*/
Tweener.addTween(helpBox, { _autoAlpha:0, time:0.5, delay:0 } );
/**
* set image info status to false for proper loading next time.
*
*/
imageDescriptionShowStatus = false;
/**
* fade out image info container if displayed.
*
*/
Tweener.addTween(imageInfoBoxContainer, { _autoAlpha:0, time:0.5, delay:0 } );
/**
* fade out zoomcontainer with large image.
* @onComplete remove large image containers.
*
*/
Tweener.addTween(zoomContainer, { _autoAlpha:0, time:0.5, delay:0.25, onComplete:removeContainer } );
}
in particular these lines
PHP Code:
Tweener.addTween(video, { _autoAlpha:0, time:0.5, delay:0, onComplete:function():void {
removeChild(video);
video = null;
SoundMixer.stopAll();
} } );
that kills the audio and video
this works and fades out all of the elements including the netstream - and the movie works as it should, but then if another flv gets chosen - it goes a bit bonkers and won't play any more than a few second of the flv.
this happens if you choose the same flv or a totally different flv.
is this something to do with the buffering? is it to do with the way the close function works? should i be using additional code to play the netstream smoothly?
anyone know?
NetStream Cuepoint
Hello everybody,
i use NetStream do load my flv. I would like to add cuepoint in AS. I don't found no information to add cuepoint with netStream
Thanks
NetStream Reload...
Hey there...
I have to reload an FLV once it ends but I need it to stop playing and display the overlay button once again. Im stuck and I have no idea of how to make it happen! I have to say this... I am a very new scripter and I would love some help! here's the code!
var waitingForEmpty = false; myNetStream.onStatus = function(info) {
if(info.code == "NetStream.Buffer.Empty" && waitingForEmpty == true) {
myNetStream.seek(0);
}
waitingForEmpty = (info.code == "NetStream.Play.Stop");
}
var videoNetConnection:NetConnection = new NetConnection();
videoNetConnection.connect(null);
var videoNetStream:NetStream = new NetStream(videoNetConnection);
vFLV.attachVideo(videoNetStream);
videoNetStream.play("Suckless_Promo.flv");
videoNetStream.pause(False);
videoNetStream.onStatus = function(info)
{
if(info.code=="NetStream.Buffer.Empty" && waitingForEmpty==true)
{
videoNetStream.play("Suckless_Promo.flv");
}
waitingForEmpty = (info.code=="NetStream.Play.Stop");
};
waitingForEmpty=false;
nsVideo.onMetaData = function(oMetaData:Object):Void {
nDuration = oMetaData.duration;
};
btnOverlay_mc._alpha = 90;
btnOverlay_mc.onPress = function():Void {
videoNetStream.pause(False);
btnOverlay_mc._visible = false };
btnOverlay_mc.onRelease = function() {
videoNetStream.pause(False);
};
mPlay.onPress = function():Void {
videoNetStream.pause(false);
};
mPause.onPress = function():Void {
videoNetStream.pause(true);
};
var allsound:Sound = new Sound(this);
mMute.onRelease = function() {
if (allsound.getVolume() == 100) {
allsound.setVolume(0);
} else {
allsound.setVolume(100);
}
};
setInterval(updateProgress, 100);
function updateProgress():Void {
var nPercent:Number = 100 * nsVideo.time / nDuration;
mProgress.mPercent._xscale = nPercent;
}
Thanks!!
NetStream OnMetaData
Could someone clarify what this means:
Quote:
onMetaData event
Language version: ActionScript 3.0
Player version: Flash Player 9
Dispatched when Flash Player receives descriptive information embedded in the FLV file being played.
This special event is primarily intended for use with a server, such as Flash Media Server; for more information, see the class description. It is not technically part of the Flash Player API, but is included in this language reference for your convenience. You cannot use the addEventListener() method, or any other EventDispatcher methods, to listen for or process this event. Rather, you must define a single callback function and attach it directly to one of the following objects:
The object that the client property of a NetStream instance references.
An instance of a NetStream subclass. NetStream is a sealed class, which means that properties or methods cannot be added to a NetStream object at runtime. However, you can create a subclass of NetStream and define your event handler in the subclass or make the subclass dynamic and add the event handler function to an instance of the subclass.
Netstream Stop() ?
Hi
I am trying to figure out simple functionality - stop the movie (). Usually in video players when stop button is being pressed movie stops.... (I know I discovered america ). By move stops I mean go back to first frame or make screen black.
In case of progresive diownload this works fine
ActionScript Code:
_netStream.seek(0);
_netStream.pause();
but unfortunetly in case of streaming it won't. After few tries I came with solution with works
ActionScript Code:
_netStream.close();
but this time last seen frame just stays (with may be confiusing from user point of view).
I have figureed a way around, but it requires setting video visibility to false I wonder if there is a simpler way
Netstream Events
Is there any way to detect when a netstream 'opening' and when it progress. The object seems to be woefully lacking in events.
NetStream Question
So I have a video that is using NetStream and all that jazz to play the flv. Is there a way I can restrict the video from play until say, 20% of it is loaded?
Here is my code so far.
Code:
var video:Video = new Video(600, 300);
addChild(video);
video.x = 10;
video.y = 10;
VideoMask.cacheAsBitmap = true;
video.mask = VideoMask;
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);
function onStatusEvent(stat:Object):void
{
trace("MOVIE LOADED");
}
var meta:Object = new Object();
meta.onMetaData = function(meta:Object)
{
}
ns.client = meta;
video.attachNetStream(ns);
ns.play("assets/content/video/FormativeDemoReel.flv");
Flv Playback - With Netstream
Hello
Im tackling this AS3 migration like NZ trying bring down Johnny Wilkinson at the World cup, but i just cant get my flv player working.
I want to read the old ns.time(); property...
In the past i used the standard code: (AS2 CODE!)
ActionScript Code:
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
theVideo.attachVideo(ns);
//with this to find out the time:
var myTime:Number = ns.time;
and then the 00:00 breakdown of ns.time() occurs after that. bosch.
Noooww, in the lovely AS3 - its looking like this:
-the video is playing fine. i can toggle pause fine...
ActionScript Code:
var videoScreen:Video = new Video();
addChild(videoScreen);
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.client = {onMetaData:ns_onMetaData};
videoScreen.attachNetStream(ns);
and at the end of the onMetaData event i begin a timer function,
ActionScript Code:
var playHeadTime:Number = 0;
var myTimer:Timer = new Timer(10);
myTimer.addEventListener("timer", timedFunction);
function timedFunction(eventArgs:TimerEvent) {
playHeadTime = ns.time();
trace(playHeadTime);
}
myTimer.start();
which is supposed to read ns.time() and then provide it for breaking down and displaying in nice 00:00 format.
the breakdown is fine, but how to i find out what the current time is!
Any help would be much appreciated, and thanks in advance.
Promise ill post the whole lot up as a tutorial once its done!
Problems With NetStream
Hi all,
I'm trying to create my own flash video player (like youtube or any other standard video player out there) and im having a few problems.
As far as i can tell, the best/only way to add a video to you flash using AS3 is to use flash.net.NetStream and stream the video.
Ok, all the examples out there for NetStream use .flv video formats. I have been trying to display .mov, .avi, .wmv, and .mpg files... which i now realise you can't do?
Is it true that you need to convert your video into .flv first to be able to use AS3 to add the video to your flash (even if you dont intend to stream, and just do a progressive download), and if so, is there any way to do this convert in flash or do i need to find a piece of software to do it for me?
cheers
Fish
NetStream Autoplay
is it so much to ask for NetStream.autoplay to be false?
I am loading a using the NetStream class but dont want the video to run when the page fires up mroe when you press play ?
I thought it would be something like NetStream.autoPlay = false but i get
1119: Access of possibly undefined property autoPlay through a reference with static type flash.net:NetStream.
Is there a simple way to do this other than set functions etc and pause without needing to?
NetConnexion & NetStream
Hi,
I have a big problem to add a video on a streaming server.
I have a file fla with an action script as:
ActionScript Code:
// ***********************************************************
var netcom : NetConnection;
var netStream : NetStream;
var duration : Number;
var client:Object = new Object();
var myVideo : Video = new Video ();
// Define NetConnection and NetStream
netcom = new NetConnection();
netcom.objectEncoding = ObjectEncoding.AMF0;
netcom.connect("rtmp://n°.streamedia.info/StreamPlayer"); // a french server
netStream = new NetStream ( netcom );
netStream.bufferTime = .1;
netStream.client = new Object ();
myVideo = new Video ();
myVideo.attachNetStream( netStream );
// Play Video
netStream.play("BOUYOUD"); // my vidéo
addChild(myVideo);
No error but I haven't video on my stage.
If sombody see the problem, thank's in advance for your help.
Regards
Alain
NetStream.liveDelay Always Zero
Does anyone know why the liveDelay property of my netStream object is always 0? Can't find anyone who has the same problem. I need to synchronise slide changes to the streamed video, and so need to know exactly how much the video is lagging. When I test by pointing the cam at a clock, the delay is usually around 10s, but liveDelay is still always 0.
NetStream Woes
Hello all,
I have a simple video recorder, which records over the same flv. But I have a slight problem. I can record once fine and then record again and again fine, it saves to the same flv. But when I record after the second time and onwards I can't see what I am recording although it dooes record and I can play it back! Why is the case? Is it because of not attaching the video object??
ActionScript Code:
//global variables
var nc:NetConnection;
var ns:NetStream;
var cam:Camera;
var mic:Microphone;
var lastVideoName:String;
//the recording fuunction
function playClick():void
{
ns.attachCamera(cam);
ns.attachAudio(mic);
ns.publish(lastVideoName, "record");
}
//stop record
function stopClick():void
{
ns.close();
}
//preview button - plays back last video
function stopClickEvent(event:Event):void
{
playLastVideo();
}
plays back last video
function playLastVideo():void
{
trace("Trying to play video");
videoContainer.attachNetStream(ns);
ns.play(lastVideoName);
}
Thank you for any guidance.
Big Problems With NetStream
i have a list of videos that user can choose to play. If I start clicking on videos one by one after random tries the next video wont play. After some looking into it seems possible (regretfully) that the connections arent clearing on NetStream.close(); and on slower networks it leads to too many connections to server which really wreaks havoc with the site. Not only cant user choose any new videos to play (the ones already started streaming do play tho). It is needed to clear browser cache and/or close browser to reload the site swf successfully.
Really troubled with this...
|