dcsimg
A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: netStream..rewind/fast forward an FLV??

  1. #1
    Fusion Of Sound
    Join Date
    Jul 2005
    Location
    Birmingham, UK
    Posts
    12

    netStream..rewind/fast forward an FLV??

    OK well I've made a video player using XML and netstream to bring in the FLV's - but how on earth would I go about making fast forward/rewind buttons to control it? I've browsed forums for ages but can't find a solution..someone please help!

    Thankyou for your time!

  2. #2
    Senior Member
    Join Date
    Jan 2001
    Location
    London
    Posts
    361
    Hi,

    Here's the code to fastforward when using my Custom FLV Player component:

    Code:
    function fastForward (toTime, step)
    {
    	this.toTime = toTime;
    	this.step = step;
    	count = 0;
    	this.onEnterFrame = function()
    	{
    		duration = myDisplay._duration;
    		// Wait until duration property is accessible, only then can we begin fast forward
    		if(myDisplay._duration != null)
    		{
    			delete this.onEnterFrame;
    			this.onEnterFrame = moveForward;
    		}
    	}
    }
    function moveForward ()
    {
    	if(myDisplay._netStream.time >= toTime)
    	{
    		delete this.onEnterFrame;
    		return;
    	}
    	var currentTime = myDisplay._netStream.time;
    	myDisplay._netStream.seek(currentTime + step);
    
    }
    // begin fast forward to 20 seconds, stepping forward by 0.1 seconds each frame
    fastForward(20, 0.1);
    Start the fast-forward by calling the function
    fastForward(toTime, step);
    where 'toTime' is the time in seconds to fast-forward to, and 'step' is the amount of time in seconds to move forward each frame of the fast-forward. The value of 'step' cannot be lower than 0.1. The higher the value of 'step', the faster the fast-forward.

    Dene
    Last edited by Dene; 05-28-2006 at 08:00 AM.

  3. #3
    Senior Member
    Join Date
    Jan 2001
    Location
    London
    Posts
    361
    Your FLV should have plenty of keyframes encoded for the fast-forward effect to work.

  4. #4
    re4m-astic to the bone! =]
    Join Date
    May 2000
    Location
    Skopje
    Posts
    23
    how about in AS3?

    Is there a way to make ff or rw to f4v ?
    Creativity Unleashed!
    http://www.re4m.net

  5. #5
    Senior Member
    Join Date
    Jan 2001
    Location
    London
    Posts
    361
    My video component above was developed for AS2.

    For AS3, coding from scratch would involve calling the seek() function (of the NetStream object) repeatedly while the fast-forward button is held down.

    I would do this with a Timer. Each time the TimerEvent runs, increment the time value passed to seek().

  6. #6
    Senior Member
    Join Date
    Sep 2010
    Posts
    324
    Thanks for the code Dene!
    I'm trying to get this to work and haven't quite got there yet. What is the "my_display" part? Perhaps that's what's missing in my application.
    Best wishes,
    Video Man

  7. #7
    Senior Member
    Join Date
    Jan 2001
    Location
    London
    Posts
    361
    In Custom FLV Player's component's, the Display component (which might have an instance name of 'myDisplay') is the video object which displays the video.

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