0

I'm fiddling around with the YouTube ActionScript 3.0 Player API. It's pretty cool and simple but one thing i can't seem to get to work, nor find any info on the web:

I want to use the SeekBar component with the Youtube API. I tried this, which works with the FLVPlayback component:

var seek:MovieClip = new SeekBar();
player.seekBar = seek;

So i think i might search wrong, try something impossible or thinking to easy? A push in the right direction will be appreciated.

Switching Brains
  • 290
  • 4
  • 15

2 Answers2

0

It is possible and here is a tutorial explaining how to do it:

http://tutorialzine.com/2010/07/youtube-api-custom-player-jquery-css/

You can just implement your own seek bar, then when it's dragged or whatever get the value of the bar and apply it to the youtube object like so:

elements.player.seekTo();

See the tutorial for more information.

  • Thanks for this option but i want to create my own player in AS3. I found this option but i don't learn that much from this. I'll try to create my own seekBar. – Switching Brains Sep 22 '11 at 08:26
0

I created my own seekbar in the Flash IDE (can be a simple movieclip with 100x10px dimensions). It has a certain widht (variable) and can be clicked on. This is the function to skip to the movie position clicked.

    private function controlsSeek():void {

        // Get distance in pixels where the mouse is clicked
        var mouseGlobalPosition = new Point(mouseX,mouseY);
        var mouseLocalPosition = playerControls.seekbar.globalToLocal(mouseGlobalPosition);

        // Afstand van de balk vanaf het nulpunt
        var pixelsClicked:int =  mouseLocalPosition.x;
        // Percentage aan de hand van het aantal pixels
        var pixelsPercentage:int = (pixelsClicked / playerControls.seekbar.seekbarLoadedBackground.width) * 100;
        // Converteer pixels naar het aantal seconden waar de film heen moet
        var pixelsToSeconds:int = Math.ceil(pixelsPercentage * (player.getDuration() * 0.01));

        player.seekTo(pixelsToSeconds, true);

    }

It works for me, if someone has a better solution or idea please throw it at me. If you use this method and it works oké, please let me know also.

Switching Brains
  • 290
  • 4
  • 15