Skip to main content
Participating Frequently
April 14, 2014
Question

control two FLVPlayback by one seekBar or another controller

  • April 14, 2014
  • 1 reply
  • 1164 views

Hii

i have two FLVPlayback on stage i need to control the both videos by one controller when back or skip some second the both videos moved to the same second , i have created seekBar "seekbar_mc" at stage and typ the code

myflv1.seekBar =myflv2.seekBar =seekbar_mc;

it give me 2 slider on seekBar but i need one only can controlling the 2 FLVPlayback

any one can help me please ?!

This topic has been closed for replies.

1 reply

Inspiring
April 14, 2014

1. add an EnterFrame eventlistener to the stage that checks if any seekbar is being scrubbed

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/video/FLVPlayback.html#scrubbing

2.If yes:use

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/video/FLVPlayback.html#playheadTime

to get the value the user scrubbed to

3.use at last: the seek function on the other flvComponent:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/video/FLVPlayback.html#seek%28%29

to synchronize both videos

when synchronized the seekbars should be in synch to

you should be able to translate that to the case were you have a third, central seekbar on stage:

Caveat: its highly unlikely that this double streaming will work efficiently in a web based environment.

If you want to have it functioning reliably you should abandon the flvplayback component (which is only good when it comes to streaming)

and preloading both your videos in total, before you allow the user to scrub.

amsh127Author
Participating Frequently
April 14, 2014

Thanks so much moccamaximum for your help but sorry can you explain in more details cos i am new in Flash

The instance name of FLVPlayback#1 : "myflv1", FLVPlayback#2 : "myflv2" and the seekBar on stage "seekbar_mc"

Thank you so much

Inspiring
April 14, 2014

if you absolutely must have a 3rd controller you shouldn`t take a seekbar, but a slider, and using the sliders value to jump to the playHEadTime of both videos.

1.drag a slider component on stage and name it "slider"

import fl.events.SliderEvent;

slider.addEventListener(SliderEvent.CHANGE, sliderChanged);

function sliderChanged(e:SliderEvent):void {

            trace(e.target.value);  

           myflv1.seek(e.target.value);

          myflv2.seek(e.target.value);

        }

2.adjust the sliders maximum to your videos runtime

if your video is 300 seconds long use

slider.maximum = 300;

All bold text goes on the first frame of your timeline