How Flash / FMS Runtime Detection Works
I was maintaining a video system for a client that uses JW Player with Flash Media Server to stream video. Until recently, this just pushed one stream at one bitrate. This is obviously not ideal for everyone, so I am looking at bandwidth detection.
I created a demo system that can now dynamically switch between three bitrates using built-in methods in JW Player. Before I can push, I need to answer a question from my client:
Does it have a hysteresis built in such a way that the flow does not fluctuate if the bandwidth is at its limit? Ideally, if the bandwidth is anywhere near the bottom of the range (yeh, yeh ..), I would like it to use the next speed down.
So two questions:
-
What happens when a user's bandwidth is right on the border between two streams? Will they flip flop between the two threads?
-
Are there any recommendations for minimizing the number of threads for such users (and in general)?
source to share
I don't know how JW Player works, but there is a native way to do it. Maybe this player is using it, maybe not - who knows. Flash video players are traditionally custom made, and all the players have been found to be of poor quality overall. This might be fine, given the special requirements of building the player yourself - it's quite a bit of testing, but not so much code.
How it works "initially": detailed information . In a nutshell, you need to implement 2 functions: onBWCheck
and onBWDone
for the object used as the client of the instance NetConnection
. The discovery process is more or less like this: the server sends a packet of a certain size and after receiving it, calculates the time it takes to move the packet. He will try to do this until he "thinks" that he finds a suitable bandwidth.
Now, to try and answer your question: since the throughput test is purely empirical and is only done once per session, several factors can bias the result. So the estimate is not very accurate and can be highly dependent on things like the client machine, torrenting some things at the same time, or connecting to a different streaming server, or Windows decides to update some very important components ... you get the idea.
Truth be told, Flash streaming is a design that prefers low speed with less latency, then high speed, possibly with more latency. But these values โโare not absolute and really depend on each specific situation and from the route to the server, from the user's ISP, etc. So, if I were you, I would not sign a document that says "no hysteresis", offering good quality is not unreasonable :)