Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6546389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:42:05+00:00 2026-05-25T11:42:05+00:00

I have a VideoDisplay instance playing some video. When I click on the video

  • 0

I have a VideoDisplay instance playing some video. When I click on the video slider (also my component) the property videoDisplay.playheadTime is set and the videoDisplay.state goes from ‘playing’ into a ‘seeking’ state for a brief moment (the videoDisplay seeks for a new position and then plays the video again). Intended bevaiour.

But if I’m (or any random user) fast enough, I can set the playheadTime again while the player is still in ‘seeking’ state. When repeated several times every click is enqueued and the videoDisplay jump on every place of the video I have clicked(this is happening in an interval about 10-15 second after my last click). When I use live dragging the videoDisplay, overwhelmed by seekings, goes into ‘error’ state.

My question is – is there any way to cancel seeking state of the VideoDisplay class? For example player is in ‘seeking’ state, I set playheadTime, and the player forgets about last seeking and try to find the new place of the video.

I will downvote pointless answers like ‘Use the Flex4 VideoPlayer class’!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:42:06+00:00Added an answer on May 25, 2026 at 11:42 am

    One possible way is wrap the video display in a component and manage the seek a little better yourself. So if someone calls seek, make sure that the video is not currently seeking, if so, then wait till the current operation is complete before proceeding to the new one. If the user tries to seek again, discard all currently pending operations and make the latest one the next operation. Working on this exact problem right now…. Here’s the code:

    public function Seek(nSeconds:Number, bPlayAfter:Boolean):void
    { 
        trace("Player Seek: "+ nSeconds);
        var objSeekComand:VideoPlayerSeekCommand = new VideoPlayerSeekCommand(ucPlayer, nSeconds, bPlayAfter);
        ProcessCommand(objSeekComand);
    }
    
    protected function ProcessCommand(objCommand:ICommand):void
    {
        if(_objCurrentCommand != null)
        {
            _objCurrentCommand.Abort();
        }
    
        _objCurrentCommand = objCommand
        objCommand.SignalCommandComplete.add(OnCommandComplete);
        objCommand.Execute();
    }
    

    Here’s the Command

    public class VideoPlayerSeekCommand extends CommandBase
        {
            private var _ucVideoDisplay:VideoDisplay;
            private var _nSeekPoint:Number;
            private var _bPlayAfterSeek:Boolean;
            private var _bIsExecuting:Boolean;
    
            public function VideoPlayerSeekCommand(ucVideoDisplay:VideoDisplay, nSeekPointInSeconds:Number, bPlayAfterSeek:Boolean,  fAutoAttachSignalHandler:Function = null)
            {
                _ucVideoDisplay = ucVideoDisplay;
                _nSeekPoint = nSeekPointInSeconds;
                _bPlayAfterSeek = bPlayAfterSeek;
    
                super(fAutoAttachSignalHandler);
            }
    
            override public function Execute():void
            {
                //First check if we are playing, and puase if needed
                _bIsExecuting = true;
                if(_ucVideoDisplay.playing == true)
                {
                    _ucVideoDisplay.addEventListener(MediaPlayerStateChangeEvent.MEDIA_PLAYER_STATE_CHANGE, OnPlayerStateChangedFromPlay, false, 0, true);
                    _ucVideoDisplay.pause();
                }
                else
                {
                    DoSeek();
                }
    
            }
    
            protected function OnPlayerStateChangedFromPlay(event:MediaPlayerStateChangeEvent):void
            {
                _ucVideoDisplay.removeEventListener(MediaPlayerStateChangeEvent.MEDIA_PLAYER_STATE_CHANGE, OnPlayerStateChangedFromPlay);
                if(_bIsExecuting == true)
                {
                    if(_ucVideoDisplay.playing == false)
                    {
                        DoSeek();
                    }
                    else
                    {
                        throw new Error("VideoPlayerSeekAndPlayCommand - OnPlayerStateChangedFromPlay error");
                    }
                }
            }
    
            private function DoSeek():void
            {
                if(_bIsExecuting == true)
                {
                    _ucVideoDisplay.seek(_nSeekPoint);
                    CheckSeekComplete();
                }
            }
    
            private function CheckSeekComplete():void
            {
                if(_bIsExecuting == true)
                {
                    if (Math.abs( _ucVideoDisplay.currentTime - _nSeekPoint) < 2)
                    {
                        if(_bPlayAfterSeek == true)
                        {
                            _ucVideoDisplay.play();
                        }
                        DispatchAndDestroy();
                    }
                    else
                    {
                        CoreUtils.CallLater(CheckSeekComplete, .07);
                    }
                }
            }
    
            override public function Abort():void
            {
                _bIsExecuting = false;
                SignalCommandComplete.removeAll();
            }
        }
    

    Im Using AS3 Signals here instead of events, and the CoreUtils.Call later you can use setInterval, or a Timer. But the idea is to not call seek until the video is paused, and to keep track of when the seek is complete.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a VideoDisplay <mx:VideoDisplay id=myVideo width=100% height=100%> </mx:VideoDisplay> and i put the video
I want to have a canvas with some floating property. Basically when I add
I have something like this: private var myVideo:Video; public var videoDisplay:UIComponent; ... videoDisplay.addChild(myVideo); ...
In Flex 4.0, I have a project with a videodisplay, and below it some
I have a VideoDisplay that is able to connect to a source and play.
I have a youtube video like so... <object id=video_1 class=a_video ....... However the css
I have a videoDisplay object in a popup. When I remove the popup the
I have code like this: private var video:Video; ... private function init():void { ...
I am using Flash Builder 4 and need a VideoDisplay component that works with
I have Cheese application. But, it has mentioned to change video output as xvimagesink

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.