Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Preloader working, audio starts on video but preloader still shows

Posted on 2006-05-08
5
Medium Priority
?
288 Views
Last Modified: 2012-08-14
It's been long and long since I worked with Flash, and this one has me stumped.  This seems to be worse when it's on my server, but it's still reproducible locally.  I have a Flash file that loads external .swfs (all videos) into a Loader component.  I have a preloader that uses getBytesLoaded() and getBytesTotal() to both update itself and to determine when the movie gets to play.  So far, so good.  Unfortunately, it might be showing only 5 or 10% loaded, but the audio starts on the video!  Still can't see the video itself until the preloader hits 100%.  I've tried changing the threshold for when the movie should start playing, but it doesn't make a difference: audio still starts way before the preloader is complete, and it doesn't want to hide early either.

I tried using the ProgressBar component with the same results.

Any idea what I can do to keep the movie clip loaded into the Loader from starting until I say so?
0
Comment
Question by:valkyrie_nc
  • 3
  • 2
5 Comments
 
LVL 2

Expert Comment

by:rythmik1
ID: 16640087
Are you loading the videos as videos converted into SWFs or as FLVs?
0
 
LVL 9

Author Comment

by:valkyrie_nc
ID: 16640095
They're FLVs embedded into .swfs, so the file being loaded is a .swf
0
 
LVL 2

Accepted Solution

by:
rythmik1 earned 2000 total points
ID: 16640155
This is a function I use to calculate an FLV's load percent.. it uses bufferLength and bufferTime. Not sure if that will help you. I load my flvs into a video object and control them without components. It's alot lighter and easier to work with than dealing with swfs once you get the hang of it.

videoProgress.onEnterFrame = function() {
            nsBufLen = stream_stream.bufferLength;
            bLoaded = Math.floor(stream_stream.time);
            vidPercentLoaded = 100*(Math.floor(nsBufLen)/stream_stream.bufferTime);
            videoProgress.loadText.text = "LOADING: "+vidPercentLoaded+"%";
            if ((vidPercentLoaded<99)) {
                  videoProgress.progressBar._xscale = vidPercentLoaded;
                  videoProgress.progressBar._alpha = 100;
                              
            } else {
                  videoProgress.progressBar._xscale = 100;
                  delete(videoProgress.onEnterFrame);
                  videoProgress.onEnterFrame=function() {
                        videoProgress._alpha=videoProgress._alpha-5;
                        if(videoProgress._alpha<1) {
                              delete(videoProgress.onEnterFrame);
                        }
                  }
                  
            }
      };
0
 
LVL 2

Expert Comment

by:rythmik1
ID: 16640181
note: here's the first part of the code that would actually load the flv and set the volume etc:

      var connection_connection;
      var stream_stream;
      my_video._alpha = 100;
      playVideo = function () {
            connection_connection = new NetConnection();
            connection_connection.connect(null);
            stream_stream = new NetStream(connection_connection);
            stream_stream.setBufferTime(5);
            my_video.attachVideo(stream_stream);
            
            this.createEmptyMovieClip("movFLVAudio", this.getNextHighestDepth());
            movFLVAudio.attachAudio(stream_stream);
            var snd1:Sound = new Sound(movFLVAudio);
            snd1.setVolume(50);
            
            stream_stream.onMetaData = function(obj) {
                  _global.bufTime = obj.duration;
                  totalPlayTime = obj.duration;
                  trace(_global.bufTime);
            };

                  
                  stream_stream.play("YOURFLV.flv");
      };
      playVideo();
0
 
LVL 9

Author Comment

by:valkyrie_nc
ID: 16640187
Thanx, rythmik1 :)  I'll give it a try & see if it behaves itself better.  Appreciate the info. :)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question