ActionScript 2.0 :: Playing FLV From Dynamic URL Using Netstream
Mar 14, 2008
I have a URL that dynamically serves an FLV file or GIF file at different times.
For example, if I put [URL] in my browser, and the server happens to serve an FLV file at that time, the browser will ask me to download the FLV file. If the server happens to serve a GIF file at that time, the browser will display the GIF. Basically [URL] will generate dynamic file content.
In my actionscript I have the following code (assume the video object, netconnection, and other initialization are already done):
When the URL serves an FLV file, the video plays successfully in my flashplayer.
Note that the *actual* FLV file is not specified, only the path that is supposed to contain it. I haven't seen any example of this before, but it works when I try it.
Problem: If the URL happens to serve a GIF, my flashplayer stalls.
Question:
How can I detect that the URL served a GIF? (so that my player can recover) I tried checking if an onStatus event was fired (I'm expecting NetStream.Play.StreamNotFound), but there doesn't seem to be any. It looks like the netstream object did not react to the wrong input.
I am using NetStream, NetConnection and Video object to play an mp4 file which is hosted over a web server using http.This is an AIR application and the relevant code is pasted below:
var url:String = <some http url>; connect_nc = new NetConnection(); connect_nc.connect(null);
I've been searching for this for a while, and either my google-fu is weak or there is no easy to find answer yet...
I am using a NetStream to stream a video file from anywhere. The NetStream is NOT connected to any server. Here is the code:
// Create new connection and stream _netCon = new NetConnection(); _netCon.connect(null);
[Code]....
This basically works, of course, but the video always starts playing only when it is fully loaded. It also passes the metadata only then. But the main reason to use a NetStream is so that you can play a video BEFORE it is fully loaded.
I tried playing around with the bufferTime property, but to no avail. Also made sure that there is no caching involved when loading the video. I always load a "new one" by adding some "?bla=date" value behind the url.
Is it possible that the "real" streaming only works when really connected to a server? Or am I missing something else?
I'm brininging in external .flv's into my swf using the NetStream method, I can't seem to detect when the flv has finished playing so I can reset the buttons in my video playlist.
I'm sure this is a simple question, but I just can't crack it. In my video player I want to detect if the current status is playing or paused. But I can't figure out where this info comes from. Is it a property of the ns object?
I am reusing a NetStream object to play different live streams.
What annoys me is that even though I start playing another stream name on this same stream object, when it is attached to a new Video object after issuing the "play" call, there is stale data after the previous playback. It's NOT the video object obviously, as I already create a new Video object every time I play another stream name on this NetStream object (Video.clear does not work anyway - known player bug).
I can rectify the situation by "resetting" the NetStream object - creating and setting up a new one for each playback, assigning it to the old reference - essentially transparent to the application. The problem is performance - there is the overhead of creating and setting up a new stream object every time. I wish to avoid such overheads.
I wish there was some form of "clear" call for the NetStream class as well...
I'm currently creating a video player to play files from a different server.
We have chosen to use a token authentication system to check where the files are from. This is a one number authentication code.
We can link to the files by going to a dynamic url such as...
[URL]
The server has to recieve this token when you try to connect the movie or it won't allow it.
I've tried adding it as a dynamic url but ns.play() doesn't seem to recognise it at all that way, unless I'm really missing something with the parameters.
I'm trying to play a 10 minute long video (h264/mp4) which is 39MB in size, after I call stream.play(fileURL) it doesn't start playback until its loaded around 12-16MB of the file (many many seconds later), I finally get onMetaData at this point too. Why doesn't it begin playback right away, or at least w/in a couple seconds? What can cause this bloated lead in time?
I am trying to figure out how to use http dynamic streaming with flash 10.1 but I can't get the basic functions working. What is the syntax for using appendbytes with a video file?
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].....
I am working on an app that will take a snapshot of an rtmp stream of an archived video, save it to a file, and ExternalInterface the file name to the hosting page to javascript it up for display.
I actually have all pieces working great. The only time an error is thrown is when I pause the video, seek to somewhere, and then try to take a snapshot. Then there is a runtime error of: SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: mySwf.swf cannot access rtmp://myFlashServer/myApp. No policy files granted access.I've seen post after post of suggestions and have tried them, but without success.
I have the crossdomain.xml and my FlashMediaServer security setup fine (it is actually working, except for this one glitch). It just seems to be the pause-then-seek-then-BitMapData.draw() combination which is creating issues.
Another weird thing: after the error is thrown, if I resume the stream and take a snapshot, it works flawlessly again.
In my application I have a video playing from a NetStream. Every second on timer I update a text label with statistics like stream.info.currentBytesPerSecond. The problem occurs when the NetConnection associated with this NetStream closes: the getter for stream.info throws
In my .smil file, if I put this line it works: <video src="sample.flv" system-bitrate="150000"/> But if I put the following line it doesn't work: <video src="mp4:sample1_150kbps.f4v" system-bitrate="150000"/> Both video files are in the webrootvod folder. I am using the sample dynamicStream.smil code, so my syntax should be right.
A NetStatusEvent with info.code of "NetStream.Connect.Closed" is dispatched by NetConnection when a NetStream is closed. This seems kind of weird, shouldn't the NetStream dispatch the event? how do I know which NetStream has been closed if I have more than one running (which I do)? I need to know so I can cleanup the now dead stream.
tracking a slider's movement while a dynamic piece of media is playing (audio, video) and recording the time and new location of the slider. So if you were watching a 30 sec video clip, and you were rating it in real time, how to record the position of the slider and the time that you moved it? Ugh, if I should explain this better,
I have a sound clip that I'm loading externally into my flash file. The code I'm using looks like this and is placed in the as layer on the first frame,
var mySound:Sound = new Sound(); var myChannel:SoundChannel = new SoundChannel(); var myTransform = new SoundTransform(); var lastPosition:Number = 0; mySound.load(new URLRequest("introaudio.mp3")); myChannel = mySound.play(); [Code]....
I am using AS2 in CS5.5.I am creating a project for a class that introduced me to adobe flash. The issue is I have gotten to a certain point about 15 scenes. During say the 15th scene scrolling through the timeline animations works fine, playing it on test scene works fine. When I go to play it on test movie it stops at a certain point. At first I thought it might have been a misplaced stop action but there is none to be found. The weird part is every other scene I create after that continues to freeze as well, the images are there, but the animations won't play. All my previous animations play before those with the issue, it's justThese new ones won't play for some reason in test movie, but work completely fine in test scene and the timeline.
I am loading an external SWF file into my main timeline. The external SWF file contains an FLV video. At a certain point in my main timeline, the SWF file loads and plays the video. Is there a way to say...
If the VIDEO (FLV) is done playing, gotoAndPlay(X)?
I was wondering, what was the best way to for actionscript 3.0 to detect cuepoints playing from a FLV movie that is playing from an FLV playback component?
I have some animation (programmatic, I'm NOT using keyframed animation in timeline), and some music I want to play in the background. Once the music file reaches the end (about 30 seconds long), I want to trigger the end of the animation functions.I figure I could either use an actionscript timer to trigger the end of the animation or a keyframe with actionscript that is placed on the timeline near the end of the song but these methods assume knowledge about the duration of the wave file. If I changed the framerate or updated the external wave file, these triggers would possibly no longer sync upIs there some sort of event listener or other detection method for an audio file to signal it has finished playing? Or maybe there is a way to get the duration of the audio file to use in the timer
I am creating a game that has 6 movieclips all on the main time line of the game. Each movie clip has three buttons that when clicked plays, pauses or stops a sound clip.When I press any of the sound clip play buttons that sound starts playing, the problem is when I click any of the other sound clip play buttons those sounds also start to play. Is there a way I can disable the other sound clip buttons while the current sound is playing then enable all of the buttons when the current sound has stopped.
This is the code that creates one of the sound objects
So I made a few buttons with sounds within them and when I publish it they work just fine. But what I want them to do is;
Say I click a Button.The sound starts playing.Then I click it again, before the sounds done playing.I want it to stop the playing sound and start playing the button I just clicked on, whether it be the same button, or a different one.Right now it just ends up sounds like an echo because it'll play it as many times as you click it.
The problem I have is I click the play button and start playing. Then I click next and when I click play for another song the songs overlap. How can I stop whatever song is playing and start playing the new one? Has to stop the prev song when I click play_brn.
ok so i have a button that plays an animation for fire when held down. and when realsed goes to and stops and frame one. when it reaches the end of the time line it goes to and plays at frame 10 and goes back to the end of the timeline. I have a sound for the fire animation that plays for the effect. The problem is the sound keeps going untill its over even if the button isnt held down. and when the playhead reaches the end of the timeline it goes to and plays and frame 10 and it replays the sound. if i hold it down it will just keep playing the sound over and over from start to finish. what i want it to do it when i hold the button down i want it to play the sound and when released it stops the sound where ever it is at. I also dont the sound to play again if there is a sound already going to stop it from playing 20 sounds at one time it gets loud and you need asprin after about 5 seconds of that.