Preloading multiple videos in Flash? In flex?

I am doing a project in which we play back a few videos, and if we upload them in the usual way, providing the URL of the stream, there is a delay time for each next video.

I have looked at Adobe documents for Flash and Flex, and I cannot find a way to preload the video. Embedding them in this application does not work. Ideally, we preloaded them, show a progress bar or other short video, and just start playing the video when all the videos have loaded.

I'm not used to asking others questions for programming, I am RTFM, but I think that Adobe docs are not enough, and the problems with switching to flash-flash-flash-hard drives are complicated. Sift a lot there, and I can not find the appropriate technique / solution.

As for Flex / Flash, I'm interested in a solution for both or both. Perhaps this is the same as ActionScript?

+3
source share
2 answers

It should be very simple. For direct flash use fl.video. VideoPlayer or fl.video. FLVPlayback . Create several players, one per video, call load () for each with a URL for the original video. Then listen to the VideoProgressEvent.PROGRESS events to find out when the video is loading. Finally, you can attach the video in series to the visual component and call play () to play them.

Sample code (not verified):

var video1:VideoPlayer = new VideoPlayer();
video1.load("http://example.com/video1.flv");
video.addEventListener(VideoProgressEvent.PROGRESS,
                       function(e:VideoProgressEvent):void
                       {
                         if (e.bytesLoaded == e.bytesTotal)
                         {
                           trace("video1 loaded.");
                           parent.addChild(video1);
                           video1.play();
                         }
                       }
var video2:VideoPlayer = new VideoPlayer();
video2.load("http://example.com/video1.flv");
video.addEventListener(VideoProgressEvent.PROGRESS,
                       function(e:VideoProgressEvent):void
                       {
                         if (e.bytesLoaded == e.bytesTotal)
                         {
                           trace("video2 loaded.");
                         }
                       }
+3
source

bulk-loader , .

:

"BulkLoader - , ActionScript 3 (AS3), ​​ . BulkLoader , aproach [sic]. AS3, BulkLoader , ".

+3

All Articles