3 Replies Latest reply on Mar 18, 2010 1:55 PM by WebAppEngineer

    Accessing the ControlBar Scrubber

    WebAppEngineer

      I am using the OSMFPlayer which utilizes the ChromeLibrary for the ControlBar. I need to be able to attach a listener to the slider i.e. Scrubber within the ControlBar for a mouse-up event. Upon receiving this event I need to be able to get the max value of the slider and the current value of the slider. Seems simple enough but I’m having trouble figuring it out.

        • 1. Re: Accessing the ControlBar Scrubber
          Edwin van Rijkom Level 2

          The scrubber is an internal asset to the scrub bar, so no listeners can be added to it in a clean way.

           

          If the goal is to have a listener triggered when the user seeks though, then that can be done by getting the SeekTrait object from the current media element, and listening for a SeekEvent.SEEKING_CHANGE event being dispatched by it. The time property on the event holds the target seek time, and using the element's TimeTrait, its total duration can be queried for.

          • 2. Re: Accessing the ControlBar Scrubber
            WebAppEngineer Level 1

            Thank you for the help.

            I am attempting to add a listener as you suggested but I am getting a null object refence error on the bolded line.


                         mediaElement = createMediaElement(url);
                       
                        if (mediaElement)
                        {
                            var seekTrait:SeekTrait = mediaElement.getTrait(MediaTraitType.SEEK) as SeekTrait;
                            seekTrait.addEventListener(SeekEvent.SEEKING_CHANGE, onSeekChange);
                        }

             

            What am I doing incorrectly here?

            • 3. Re: Accessing the ControlBar Scrubber
              WebAppEngineer Level 1

              I got it. You have to use this.

              mediaElement.addEventListener(MediaElementEvent.TRAIT_ADD, onTraitAdd);

              To wait till the trait is avalible.