How to play a video (.flv) without displaying a loading image for buffering during playback?

I want to play the FLV video file on my website. The video will start playing based on the speed of the client machine’s Internet connection so that the video never stops displaying the boot image for buffering.

Any buffering / streaming will be completed first, and then play back or the video will start playing after a short delay while buffering is done, for example. 40%, and the rest of the buffering will go at the same time so that the video never stops and does not show the loaded image.

How to do it? Is it possible to implement?

Please help implement this.

+3
source share
6 answers

One thing that can really help you is to encode the video at different bitrates. There is no way around the fact that some people simply will not have enough bandwidth to play video sequentially. Fortunately, Flash allows you to dynamically switch threads based on the detected bandwidth of the client. To use this function, instead of playing FLV directly, you give the player a playlist of SMIL files with the various streams listed. FLVPlayback has built-in functionality. Here is an example SMIL file stolen from here :

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE smil PUBLIC "-//W3C//DTD SMIL 2.0//EN"
    "http://www.w3.org/2001/SMIL20/SMIL20.dtd">
<smil xmlns="http://www.w3.org/2001/SMIL20/Language">
    <body>
        <switch>
            <video src="video2.flv" system-bitrate="512000" />
            <video src="video1.flv" system-bitrate="256000" />
            <video src="video0.flv" />
        </switch>
    </body>
</smil>
+2
source

wikipedia]. " , ".

:

  • / - .
  • .

, . (tm), ; .

? , , X . , , Ethernet , . , .

: , , , .

+1

- Pre load manager manager. :

import gs.dataTransfer.PreloadAssetManager;
var preloader_obj = new PreloadAssetManager(["myFile1.swf","myFile2.swf"]);
this.onEnterFrame = function() {
    myPreloader_mc.bar_mc._xscale = preloader_obj.percentLoaded_num;
    if (preloader_obj.percentLoaded_num == 100) {
        gotoAndPlay("start");
    }
}

percentLoaded_num , . swf flv, . flv, . . .

, flv. .

0

. , , , . . .

0

flex, .

Sample player with and without a video controller

Hope this will give you an idea.

0
source

Try it. Get the duration of the video and set it to the buffer time:

var netConn:NetConnection = new NetConnection();

// Create a local streaming connection
netConn.connect(null);
// Create a NetStream object and define an onStatus() function
var netStream:NetStream = new NetStream(netConn);
netStream.onStatus = function(infoObject) {
   status_txt.text += "Status (NetStream)" + newline;
   status_txt.text += "Level: "+infoObject.level + newline;
   status_txt.text += "Code: "+infoObject.code + newline;
};
// Attach the NetStream video feed to the Video object
my_video.attachVideo(netStream);
my_video.onMetaData = function(videoMetaData:Object):Void {   
   var videoDuration = videoMetaData.duration;
}
// Set the buffer time
netStream.setBufferTime(videoDuration);
// Begin playing the FLV file
netStream.play("http://www.mydomain.com/myvid.flv");
0
source

Source: https://habr.com/ru/post/1721955/


All Articles