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

Looping Video Script Does Not Work, Help

New Here ,
Oct 25, 2017 Oct 25, 2017

Copy link to clipboard

Copied

Hello,

I have a video I am trying to loop.

I have created an Animate file from the ActionScript 3 in Animate, and I have saved it in the same folder that the video resides in.

I have taken a FLVplayback from the components window, and placed it on the stage of the file.

Here is the script I am using, but, it does not work. The video does not even play:

vidplay.source="testvid.mp4";

import fl.video.*;

function onFLVComplete(event:VideoEvent):void{

event.target.play()

}

player.addEventListener(VideoEvent.COMPLETE, onFLVComplete);

Can you let me know what I am doing wrong or, let me know how to change the script to accommodate a loop and allow the video to play? I am running Animate CC 2018.

Thank you,

Sky

Views

894

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Oct 25, 2017 Oct 25, 2017

Here. This Code should do it for you.

import fl.video.*;

instance_name_here.source="video_name_here.mp4";

instance_name_here.addEventListener(Event.COMPLETE,completeF);

function completeF(e:Event):void{

instance_name_here.seek(0);

instance_name_here.play();

}

Votes

Translate

Translate
Community Expert ,
Oct 25, 2017 Oct 25, 2017

Copy link to clipboard

Copied

to start you're using two different names for your flvplayback component, vidplay and player.

it's not clear which, or even if either, is correct. 

did you assign an instance name (in the properties panel) for your flv component?

Votes

Translate

Translate

Report

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
Community Expert ,
Oct 25, 2017 Oct 25, 2017

Copy link to clipboard

Copied

Here. This Code should do it for you.

import fl.video.*;

instance_name_here.source="video_name_here.mp4";

instance_name_here.addEventListener(Event.COMPLETE,completeF);

function completeF(e:Event):void{

instance_name_here.seek(0);

instance_name_here.play();

}

Votes

Translate

Translate

Report

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 ,
Oct 25, 2017 Oct 25, 2017

Copy link to clipboard

Copied

import fl.video.*;

vidplay.source="testvid.mp4";

vidplay.addEventListener(Event.COMPLETE,completeF);

function completeF(e:Event):void{

vidplay.seek(0);

vidplay.play();

}

Hi nickg28,

THANK YOU, this works perfectly!!!

However, on the LOOP, the video actually comes to a stop, then replays, so, I get this like "quick flash" where the video stops and starts. Is there anyway, with ActionScript to get a softer blend at the end of the video, so, when it LOOPs, it looks seamless?

Thank you, again, for your help, really appreciated!

Sky

Votes

Translate

Translate

Report

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
Community Expert ,
Oct 25, 2017 Oct 25, 2017

Copy link to clipboard

Copied

that's expected and there's no way (that i know of) to prevent that unless two flv players are used.  it's usually easier to edit the video so the end and beginning are not interrupted by that white flash (eg, fade from white at the start, fade to white at the end).

Votes

Translate

Translate

Report

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 ,
May 24, 2019 May 24, 2019

Copy link to clipboard

Copied

LATEST

stop();

import fl.video.VideoEvent;

flv_pb.play("videoname.flv");  // flv_pb: being the name of the video component (remove autoplay in component parameters)

flv_pb.autoRewind = true;

flv_pb.addEventListener(fl.video.VideoEvent.AUTO_REWOUND, doLoop);

function doLoop(e: fl.video.VideoEvent): void {

flv_pb.seek(0);

e.target.play();

}

//in this form, dont stop at the end/start of video.

Votes

Translate

Translate

Report

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