A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 28

Thread: Ok at least 6 on this page have the same question! No one answers

  1. #1
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127

    Ok at least 6 on this page have the same question! No one answers

    I have searched several sites including this one.
    Lots of people obviously have the same issue.
    I have found info for preloading flv's. BUT
    I want to have an adaptive preload, that is only enough preloads to ensure smooth playback. This adapts to the users bandwidth.
    I actually had this working in flash mx where my videos were swf's loading into an empty mc.
    see this site I made, go to the video section
    http://www.frampton.com/flash.html

    Now I am trying to do video with flv's and the new components in flash pro 8 and can not work out how to do it. I am an amateur every thing I work out like this is a long and painful experience, I went crazy for a couple of weeks making the frampton thing work ;-)
    PLEASE help.

    Is there a reason not to do this?
    No one seems to be answering the many requests.
    I am not using a streaming server.
    I just load flv's which are in the same folder as my movie.

    Mark

  2. #2
    Senior Member
    Join Date
    Oct 2002
    Posts
    211
    All the videos on this page are FLVs loading using an adaptive preloader:
    http://www.theaustralian.news.com.au...004020,00.html

    They are done in Flix Pro.

  3. #3
    Junior Member
    Join Date
    Nov 2005
    Location
    New Zealand
    Posts
    12
    I believe the only way to detect the user's connection speed is to use a streaming server. If you aren't using a streaming server you will need to ask the user to indicate their connection speed, then set the buffer time accordingly.

  4. #4
    Senior Member
    Join Date
    Oct 2002
    Posts
    211
    Not so. There's various ways. The simplest would be to include a small test file of, say, 10K, time the download on that and make buffer calculations. The Wildform adaptive preloader works in a more sophisticated way, as do other adaptive preloaders for example on the Imagematics WebDev pro product.

  5. #5
    Junior Member
    Join Date
    Nov 2005
    Location
    New Zealand
    Posts
    12
    Fair call. Do you know how these more sophisticated methods work?

    I assume the test-file-method would have some limitations, e.g. if the user leaves the page and comes back, the test file will still be in their cache so the calculation will be incorrect.

    Slightly OT, how useful do you think adaptive preloaders are? Especially since the SWF file will have to be (slightly) heavier just to calculate the buffer time? Just curious.

  6. #6
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    The problem with the flixpro adaptive preloader is of course that I need to buy FlixPro!
    but you are right it is exactly what I want to implement.
    basically it just writes some code for you via a dialog box interface. click the adaptive preloader button, get the code.
    An adaptive prelaoder monitors byte downlaoded against byte total and a timer, does some math including framerate and makes what is an educated guess about the amount required to download before starting to play.
    Just out of interest here is my code from the Frampton site I mentioned above. This works with swf's loading into an empty mc, not flv's into a playback component.
    Code:
    //~ This is the function which loads a swf into the holder (target)
    function loadAdaptive (url, target) {
    	this.target    = target;
    	this.once 	   = false;
    	//~ start timer
    	this.startTime = getTimer();
    	//~ be sure not to cache it (can be disabled, but for testing...)
    	//url = url+"?"+new Date().getTime();
    	//~ load the swf
    	loadMovie(url, target);
    	//~ Begin SureStream
    	this.gotoAndPlay ("calculate");
    }
    //~ stop here
    stop ();
    this function is in frame one of a mc that is called loader I then send this mc to a frame called "calculate" where it lgoes into a frame loop. executing this code
    Code:
    //~ frames per second of the video
    fps = 10;
    /*~ define a buffer factor (in case the connection gets slower than faster)
    	set 1.0 for NO buffer */
    bufferFactor = 1.1;
    
    
    //~ ############### END OF USER-DEFINED OPTIONS ###############
    
    
    //~ total bytes of the swf
    totalBytes   = eval(this.target).getBytesTotal();
    //~ total frames of the swf
    totalFrames  = eval(this.target)._totalframes;
    //~ actual frame of the swf
    currentFrame = eval(this.target)._currentframe;
    //~ loaded bytes of the swf
    
    loadedBytes  = eval(this.target).getBytesLoaded();
    
    //~ loaded frames of the swf
    loadedFrames = eval(this.target)._framesloaded;
    
    //~ bytes still to load
    leftBytes	 = totalBytes - loadedBytes;
    
    //~ time since loading started (in milliseconds)
    loadTime	 = getTimer() - this.startTime;
    
    //~ determine connection speed (in KB/second)
    speed = loadedBytes / loadTime;
    
    //~ determine total playing time of the movie
    totalTime	 = totalFrames / fps;
    
    //~ determine time currently could be played (in seconds)
    playTime     = loadedFrames / fps;
    _root.playTime =math.floor(playTime)+" SECONDS";
    //feed value to mp3 volume panel in main movie
    _root.myInputSoundDurationText = math.floor(totalTime);
    
    //~ sec played
    TimePlayed = eval(this.target)._currentframe/fps;
    _root.TimePlayed = math.floor(TimePlayed)+" SECONDS";
    //feed value to mp3 volume panel in main movie
    _root.myInputSoundPositionText = math.floor(TimePlayed);
    
    //~ determine time which is needed to complete loading of the swf (in seconds)
    leftLoadTime = (leftBytes / 1024) / speed;
    //trace(leftLoadTime);
    	
    //~ Prevent loading bug
    s = totalFrames / currentFrame;
    
    
    //~ some information for your visitors (unimportant for the loader itself)
    percentOfSWFLoaded = Math.round(100 / totalBytes * loadedBytes)+" % OF THE VIDEO LOADED";
    _root.percentOfSWFLoaded = percentOfSWFLoaded;
    TimeTrack =Math.round((leftLoadTime * bufferFactor) - playTime);
    if(TimeTrack > 0){
    waitingTime = "TIME TO WAIT "+TimeTrack+" SECONDS";
    _root.waitingTime = waitingTime;
    }
    else{
    	waitingTime = "NO MORE WAITING";
    	_root.waitingTime = waitingTime;
    }
    if (s > 1 || once == true) {
    
    	/*~ if time which can be displayed is longer
    		than the time needed to load start the swf */	
    	if (playTime > (leftLoadTime * bufferFactor) && once == false) {
    		status = "PLAYING...";
    		_root.status=status;
    		eval(this.target).play();
    		once = true;
    	//~ if playing ended, stop the swf
    	} else if (currentFrame == totalFrames && once == true) {
    		status = "FINISHED PLAYING...";
    		_root.status=status;
    		eval(this.target).stop();
    		this.stop();
    	}
    
    } else {
    	eval(this.target).stop();
    	status = "BUFFERING...";
    	_root.status=status;
    }
    not simple ;-)
    took me a couple of weeks to kluge this together from other peples stuff with help from these boards, I am not a coder.
    So seems to me with all the metadata encoded into a flv when you encode it with flash, such as totalseconds, farmerate, videodatarate etc that this should still be possible

    please help
    mark
    mark
    Last edited by mgason; 05-08-2006 at 11:00 AM.

  7. #7
    Flash Video Moderator Wheels's Avatar
    Join Date
    Dec 2000
    Location
    Minneapolis
    Posts
    1,590
    Nice job, looks like the old Wildform adaptive system.

    Adaptive is the best way, if you have the ability to code up your own. I'm disappointed that MM has never done this for us, and that they haven't provided better documentation on how to use their components.

    I'm guilty of not responding to to many threads here any more, I used to - back in the Flash 6 days of video. I've asked for other moderators as well, but nobody qualified (besides E) has stepped up.

    Sorry guys, but about the time you figure out how to fix the MM components - you figure out a way to not have to bother with all the headaches they create - so we don't have much info on how to use them on a daily basis.

    The issues with MM components are frustrating I know, and we could try to solve their problems - but I've built my own systems to accomplish what I need and have yet to delve too deep into the components.

    There are some good commercial alternatives available out there, so look around. I've thought about concentrating on components myself, but I just don't see how it would pay - as I'm having a hard enough time just keeping up with the changes in AS over the last couple of years, much less take on such a big project just to fix something that should work already.

    I'm still using .swf's with an adaptive system unless the client asks for .flv on a Comm server - then I use some prebuilt stuff from the clients.

  8. #8
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    Yes I think the wildform loader was probably where I started. Its a long time ago now.
    I haven't written any actionscript for a while. Flash is not my regular job.

    I have been digging back in pretty hard for the last few weeks on a project for a friend and I know what you mean about keeping up. Actionscript has changed so much! For the better though, coding can be a lot more elegant now. Which is one of the reasons to build a new preloader.

    I pretty much came to the same conclusion as you, I am building my own player so I know exactly whats going on and I am pretty sure I will be able to get adaptive preload happening then.

    By the way you mentioned "There are some good commercial alternatives available out there, so look around"
    Are there any you could recommend?

    thanks for taking the time to comment, even your negative comments about the components was usefull, it helped confirm my decision to abandon them and build my own.

    mark

  9. #9
    Flash Video Moderator Wheels's Avatar
    Join Date
    Dec 2000
    Location
    Minneapolis
    Posts
    1,590
    Not off the top of my head, a quick google for Flash Video Component will likely yield the bulk of what's out there.

    Which one you'll want to use depends on your requirements, all of the ones I've seen have different features available.

  10. #10
    Junior Member
    Join Date
    May 2005
    Posts
    20

    adaptive preloader... continued

    Hi Mark, or anyone else.... I too have need to calculate automatically how much time to spend in preloader depending on the speed of the connection. I would like not to have to ask the visitor. Any more info, or if can point me to the code and directions would be so appreciated. I have some script experience, yet it's fairly shallow. I've used component before yet never found one that does what I want.
    Thanks for any help,
    Cliff

  11. #11
    Flash Video Moderator Wheels's Avatar
    Join Date
    Dec 2000
    Location
    Minneapolis
    Posts
    1,590
    I'll just add that the F8 FLV playback component is pretty good, well documented .. I've seen very few issues with it that can't be overcome by just reading the documentation.

  12. #12
    Junior Member
    Join Date
    May 2005
    Posts
    20
    My previous experience with FLV was about 8 months ago, wasn't on F8 (still not), but couldn't solve getting a preloader to work. Decided to just use .swf files. Would like to get a preloader working that adjusts amount to preload based on connection/transfer speed. Code suggestions are appreciated.

  13. #13
    Flash Video Moderator Wheels's Avatar
    Join Date
    Dec 2000
    Location
    Minneapolis
    Posts
    1,590
    .swf files are the best in my opinion. But the buffering/loading on the new F8 component is pretty good.

  14. #14
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    I actually found the buffering on the new flash8 component pretty much useless when I was not using streaming. It stopped and started videos on all sorts of different speed connections.

    swf adaptive preload works nicely. swf's are not really bigger than flv's. A lot of people think they would be.

    I have a movie player that does adaptive perload that I used on a site
    http://www.frampton.com/flash.html
    check out the video section.

    its pretty easy to work with, I will try and extract it from the main file in an understandable way and post it later today if you are interested.

    Again it is for SWF's not flv's
    mark

  15. #15
    Flash Video Moderator Wheels's Avatar
    Join Date
    Dec 2000
    Location
    Minneapolis
    Posts
    1,590
    I have my own adaptive system that is quite advanced and works great with .swf files.

    I plan on releasing the code in the near future, as soon as I get a chance to rewrite it for .flv and .mp3 loading.

  16. #16
    Junior Member
    Join Date
    May 2005
    Posts
    20
    mgason ... RE: "its pretty easy to work with, I will try and extract it from the main file in an understandable way and post it later today if you are interested." ----yes, would like to see whatever you could show me on it. I like your volume control too... is that part of a component?
    I did notice that you have not implemented any fix for the Active Content thingy that IE put in recently. (www.adobe.com/devnet/activecontent) Are you planning on using the swfobject fix or the Adobe fix built into their DW8.02 ?

  17. #17
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    Hi SanDiego,
    I will have a go at pulling it apart. I have a meeting this afternoon, so not much chance of getting it done today.
    Tomorrow I will post it.
    It is not a "component" at all.

    The volume control actually works site wide, I can show you how it ties to the videos volume. It also controls all mp3's etc on the site.
    Remember the Frampton video is swf's loading in not flv's.
    seems to work fine though.

    I have a player that is based on the mx video component with non component self made controls. It does not adaptively preload, might get to that one day. You can see it at
    http://www.tossfad.com/

    I have used the Adobe Active Content fix that installs as a command and option in flash 8 on a newer site. I am not bothering with Frampton until we rebuild it completely. That was not my contract, a sub contract, I just did all the flash, in other words nearly everything!

  18. #18
    Junior Member
    Join Date
    May 2005
    Posts
    20
    Hi mgason,
    Viewed your tossfad site... very slim-line controller in bottom of videos. Nice.
    I'm not using .flv's ... only swf's. Gave up on those awhile back and will wait to revisit that subject.
    I've been considering using the Adobe Active Content fix, but have been putting off upgrading to dw8 and all.
    Will look forward to anything you can show me.

  19. #19
    Senior Member
    Join Date
    Apr 2000
    Location
    Minneapolis
    Posts
    2,127
    edit 2
    just uploaded a new file with positioning of loaded movie fixed
    explanation is in movie.
    edit 1
    saved as MX, thought I did before
    that flv player at Tossfad works in MX by the way

    boy that took longer than I thought!
    anyway here is the video player adaptive preload part of the frampton site.
    quite a few other goodies in it still, tooltips, mp3 player etc.
    I did not have time to comment all that extra stuff.
    The video stuff is pretty well commented though.
    download it grab some swf's and mp3's and give it a spin ;-)
    good luck
    mark
    Last edited by mgason; 06-14-2006 at 07:02 PM.

  20. #20
    Junior Member
    Join Date
    May 2005
    Posts
    20
    Thanks Mark, I downloaded it immediately and tried to open it in Flash MX 2004. It gave error message 'failed to open'. Could it be you saved the .fla in Flash 8 and perhaps not readible in MX? I really appreciate you taking the time. Hopefully I can return the favor sometime. Could you try again...?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center