In AS3, when a streamed video freezes, how can you detect that? - actionscript-3

What is a good, reliable way to detect if a video over a NetStream freezes mid-stream? I need to know this for RTMP and RTMFP, although my guess is that the protocol doesn't really matter here. Thanks!

You'll most likely have to run the debugger or set up a timer to poll this but take a look at
netstream.info
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#info

Related

Buffered audio in SoundJS

I'm using SoundJS 0.5.2 to play audio in a music player that I'm designing for a client.
According to the documentation, I have to register or preload an audio file before I can use it, by using the registerSound method of the Sound Class and the audio cannot be played before it is fully loaded.
But how I do I go about buffering the audio while it is being played? Like wait till 10% of the audio is buffered, then play the song? Can this be accomplished using PreloadJS ?
After Googling about it, I found this thread. It says that the WebAudioPlugin does not support buffering because of the underlying technology, but the HTMLAudioPlugin can play the audio before it is fully loaded.
But it does not mention how to do that. When using HTMLAudioPlugin, do I still have to register the sound using registerSound ?
Also, when using FlashPlugin as a fallback, will the buffering still be supported by FlashPlugin?
HTMLAudioPlugin fires the ready event when it receives the canplaythrough event from the audio tag, so it supports buffering by default (no setup required). You have to register sounds for them to start loading, either with PreloadJS or internal SoundJS methods. Buffering will work the same regardless.
Buffering is not supported by the FlashPlugin as far as I know.
Hope that helps.

Play HTML5 Audio immediately without waiting for the entire buffering to complete?

I have a very fast connection and it takes about 2-3 seconds before the song actually starts playing. It's a relatively average 128kbps MP3 size (3mb-4mb). I have set preload="auto" but that didn't help much. Is there a way to just start playing the audio right away and continue to buffer it (sort of like YouTube does)?
Here is an example that I am currently working on. It's going to play an audio simultaneously on all connected clients. So if you have 2+ laptops, you can try it out. All computers must be connected before you start playing the audio. (double click on a song to start playing).
Running video and audio without complete buffering is called smooth / adaptive streaming. It can be achieved in players like silverlight and flash.
What it actually does is to create chunks of files and let the user play file chunk by chunk. Since you are downloading chunks, it will not require whole file to download.
Well, I am not giving you the full fledged answer since I haven't studied much but I am giving you the exact idea of how it works.
I had same issue but with HTML5 Video.. I overcame it with using Smooth streaming media Azure..
Here is a tutorial of the same : http://www.wrapcode.com/featured/windows-azure-media-services-mp4-to-smooth-streaming/
I will keep you updated once I find something useful :-)
If you use preload=none, then you have no buffer at the beginning but it will buffer your content "on the fly"
I have an Icecast server which streamsmy contet, and when I use pause and play, it buffers my content, even with preload=none.
Do not use preload=auto. It will take some time to start.

Stop download of streaming audio to HTML5 element with Buzz

I am using Buzz to abstract HTML5 audio for internet radio. This works well, but I need a way to stop downloading the stream when audio is stopped.
For example, when I start playing, I can see the network requests for the stream begin. When I stop audio, that data for the stream is still being transferred, as if it were a static resource. I need to either prevent that from happening, or get it to stop once audio is stopped.
I believe jPlayer does this by destroying the <audio> element, but I don't see any method for doing this in Buzz. Is it possible? If so, how?
After spending some time with the Buzz source, I don't see any method for doing this currently. Fortunately, the raw audio element is exposed, allowing something like this:
buzz.sound.prototype.destroy = function () {
this.set('src', '');
}
This probably messes up some internal state information for Buzz. I'm looking into that right now.

FLV's not caching

working on a project with a custom flv player.
Everything works as it should
However, the flv's don't seem to be caching, if I play the video once, close the player, and replay again, the video has to cache -load entirely again before the video starts playing.
Can anyone suggest troubleshooting steps since, as far as i know, this should not be the way it works...
As spender mentioned, if you are not loading the flv via http, then caching does not apply.
You might want to check out Greensock's LoaderMax, as it provides highly configurable and easy-to-use video playback functionality which has ironed out many of the kinks in Adobe's own video player classes:
http://www.greensock.com/loadermax

FLVPlayback won't seek when streaming from flash media server. How to fix?

I have a simple video player set up that streams from a flash media server. The video plays fine, but the majority of the seek commands send it back to the first frame of the video. If I don't use flash media server it will seek to any point which has already been loaded.
Any ideas what could cause this?
Try and download jw player from here http://www.longtailvideo.com/players/jw-flv-player/ and test if it works with that player. The problem could lay with the streaming server.
the majority of the seek commands send
it back to the first frame
What happens with the rest? - Do they work or does nothing happen?
The problem was I was checking the FLVPlayback playing property to see if I wanted to call play after the seek (The video didn't auto-play, and I wanted it to play if you seeked). The playing property however is set to false after a seek call till it is done seeking apparently. This resulted in play being called every time, which reset the playhead to the start.