Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

control two FLVPlayback by one seekBar or another controller

New Here ,
Apr 13, 2014 Apr 13, 2014

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 ?!

TOPICS
ActionScript
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Apr 14, 2014 Apr 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#scrubbi...

2.If yes:use

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

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...

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 14, 2014 Apr 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Apr 14, 2014 Apr 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 14, 2014 Apr 14, 2014

Thank you moccamaximum but its not working

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Apr 14, 2014 Apr 14, 2014

"its not working"

too unspecific to work with.

Errors when publishing. Look at the output (window>Outpit)

what does it say?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 15, 2014 Apr 15, 2014

the slider didn't moved with videos like seekBar

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Apr 15, 2014 Apr 15, 2014

myflv1.addEventListener(VideoEvent..PLAYHEAD_UPDATE, updateSlider);

//assuming you adadpted the maxValue of your slider to match the duration (in seconds) of your video

function updateSlider(e:VideoEvent):void{

   slider.value = Math.round(myflv1.playheadTime);

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 17, 2014 Apr 17, 2014

Error  "1119: Access of possibly undefined property PLAYHEAD_UPDATE through a reference with static type Class."

The Code

myflv1.addEventListener(VideoEvent.PLAYHEAD_UPDATE, updateSlider);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Apr 21, 2014 Apr 21, 2014

to be able to use

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/VideoEvent.html

you have to import the necessary class at the beginning of your code:

so this hgoes into the first frame of your first scene of your fla file:

import flash.events.VideoEvent

then don`t copy the code from the forums here, because the linebreaks might break the code in flash.

write it out like:

myflv1.addEventListener(VideoEvent.PLAYHEAD_UPDATE, updateSlider);

(without the new Line)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 22, 2014 Apr 22, 2014
LATEST

Thanks so much moccamaximum for your help but it is the same error

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines