开发者

detect user's download speed for flash video

We have a custom flash video player. It uses streaming over a hosted FMS $50/month account.

Some users are complaining that the video doesn't play at all.

With one of these users, we had them go to a speed test website and it was determined that they had a very slow conne开发者_如何学JAVAction which we are assuming is what is causing them to not be able to view the video.

So before we try to load the video we want to determine their connection speed. Then if they have a good enough connection we will play the video and if not then we will do something else like play a lower quality video or simply display a message and not play a video at all.

So, what is the best way to determine the users connection speed in this situation? Should we use actionscript? should we do a streaming test or a progressive test? should we use ajax and send the result into flash?


If you have a hosted FMS account, they often offer pre-built video players with dynamic streaming built in.

If you are using OSMF (the Open Source Media Framework), you can use the Strobe Media Player which offers dynamic streaming, you just have to create a file with all the streams: http://forums.adobe.com/thread/679664?tstart=0

Or if you are building your own OSMF player, you can just write some code:

    var RTMP_URL = "your-rtmp-link";
    var resource:DynamicStreamingResource = new DynamicStreamingResource(RTMP_URL);

    var vector:Vector.<DynamicStreamingItem >  = new Vector.<DynamicStreamingItem > (2);
    vector[0] = new DynamicStreamingItem("mp4:my-high-link.f4v",1500);
    vector[1] = new DynamicStreamingItem("mp4:my-low-link.f4v",400);**
    resource.streamItems = vector;

    videoElement = new VideoElement(resource);
    player = new MediaPlayer;
    player.autoPlay = true;

    container = new MediaContainer;
    addChild(container);

    player.media = videoElement;
    container.addMediaElement(videoElement);

    player.play();

Or, if you wrote your player with regular actionscript (no framework) Influxis has a tutorial: http://labs.influxis.com/?p=91


http://www.bigresource.com/FLASH-Detect-user-connection-speed-grCV5amDJg.html


You can use a SMIL file to define different versions of the video, with different bit rates, and the bandwidth detection should then be taken care of for you, by the FMS server and the FLVPlayback component, I believe:

http://help.adobe.com/en_US/as3/components/WS5b3ccc516d4fbf351e63e3d118a9c65b32-7f13.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜